on-off_swapCtrCaps.sh 504 B

1234567891011121314151617
  1. #!/bin/bash
  2. # on/off toggle swapping between Ctrl <-> Caps
  3. isCtrlCapsLockSwitched=`setxkbmap -query | grep ctrl:nocaps`
  4. if [ -z ${isCtrlCapsLockSwitched}] # default
  5. then
  6. {
  7. setxkbmap -option ctrl:nocaps
  8. notify-send -i dialog-information "CapsLock has been turned off."
  9. }
  10. else # switched
  11. {
  12. setxkbmap -option &&
  13. setxkbmap -layout us,ru -option grp:menu_toggle,grp_led:scroll,grp:win_space_toggle
  14. notify-send -i dialog-information "CapsLock has been turned on."
  15. }
  16. fi