Skip to content

Instantly share code, notes, and snippets.

@kopp
Created January 31, 2022 21:51
Show Gist options
  • Save kopp/60fed56e84582df4442e9129798ae9c8 to your computer and use it in GitHub Desktop.
Save kopp/60fed56e84582df4442e9129798ae9c8 to your computer and use it in GitHub Desktop.
toggle-keyboard-layout-on-any-desktop
toggle_keyboard_layout.sh
Mod4+I
#!/usr/bin/bash
# toggle keyboard layout using setxkbmap in between de and us
current=$(setxkbmap -query | grep layout | awk '{print $2}')
case $current in
(us) new=de
;;
(de) new=us
;;
esac
setxkbmap $new && notify-send "Using $new as new keyboard layout."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment