You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
385 B

  1. #!/bin/bash
  2. # Get current state of Caps Lock and Escape key swap
  3. current_state=$(setxkbmap -query | grep options | grep "caps:escape" | wc -l)
  4. # If the swap is off, turn it on; otherwise, turn it off
  5. if [ $current_state -eq 0 ]; then
  6. echo "Swapping Caps Lock and Escape..."
  7. setxkbmap -option caps:escape
  8. else
  9. echo "Reverting to normal layout..."
  10. setxkbmap -option
  11. fi