Add toggle keyboard script

This commit is contained in:
Ethan Lane 2025-07-28 10:45:44 +01:00
parent 5b0f3bb46a
commit b319fb07f0
2 changed files with 14 additions and 4 deletions

View file

@ -74,6 +74,7 @@ bindsym $mod+u exec --no-startup-id autorandr -c
bindsym $mod+Shift+f exec --no-startup-id firefox --private-window
bindsym $mod+Shift+z exec --no-startup-id i3lock --color 000000
bindsym $mod+F12 exec --no-startup-id dunstctl history-pop
bindsym $mod+F1 exec --no-startup-id "sh /home/vylpes/scripts/system/toggle-keyboard.sh"
# =====
# start a terminal
@ -187,10 +188,6 @@ bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# keyboard layouts
bindsym $mod+F1 exec --no-startup-id setxkbmap -layout us
bindsym $mod+F2 exec --no-startup-id setxkbmap -layout gb
# reload the configuration file
bindsym $mod+Mod1+r reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)

View file

@ -0,0 +1,13 @@
layout=$(setxkbmap -query | awk '/layout/{print $2}')
new=$layout
if [ $layout = "us" ];
then
setxkbmap -layout gb;
new="gb";
else
setxkbmap -layout us;
new="us";
fi
echo "Keyboard layout changed from $layout to $new"