use XF86LaunchA for changing the keyboard layout
authorAmin Bandali <me@aminb.org>
Sat, 7 Mar 2015 17:49:11 +0000 (12:49 -0500)
committerAmin Bandali <me@aminb.org>
Sat, 7 Mar 2015 17:49:11 +0000 (12:49 -0500)
sxhkd/.config/sxhkd/sxhkdrc
sxhkd/.local/bin/toggle-layout [new file with mode: 0755]

index 4a8c6ea..cc7ec59 100644 (file)
@@ -137,3 +137,6 @@ XF86AudioLowerVolume
 
 XF86AudioMute
        pamixer --toggle-mute
 
 XF86AudioMute
        pamixer --toggle-mute
+
+XF86LaunchA
+  toggle-layout
\ No newline at end of file
diff --git a/sxhkd/.local/bin/toggle-layout b/sxhkd/.local/bin/toggle-layout
new file mode 100755 (executable)
index 0000000..fcae134
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+lang="$(setxkbmap -print | grep xkb_symbols | cut -d'+' -f 2)"
+
+if [ "$lang" = "us" ]; then
+    setxkbmap ir
+else
+    setxkbmap us
+fi
\ No newline at end of file