Switch keyboard layout by clicking the xmobar indicator
Left-click cycles it -> us -> sk(qwerty), right-click cycles backwards, via a new kbd_cycle.sh that calls setxkbmap like the M-i/M-u/M-s keys.
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Cycle keyboard layout it -> us -> sk(qwerty); "prev" cycles backwards.
|
||||||
|
|
||||||
|
current=$(setxkbmap -query | awk '/^layout:/ {split($2, a, ","); print a[1]}')
|
||||||
|
|
||||||
|
if [[ "$1" == "prev" ]]; then
|
||||||
|
case "$current" in
|
||||||
|
it) next=sk ;;
|
||||||
|
us) next=it ;;
|
||||||
|
*) next=us ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case "$current" in
|
||||||
|
it) next=us ;;
|
||||||
|
us) next=sk ;;
|
||||||
|
*) next=it ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$next" == "sk" ]]; then
|
||||||
|
setxkbmap -layout sk -variant qwerty
|
||||||
|
else
|
||||||
|
setxkbmap -layout "$next" -variant ""
|
||||||
|
fi
|
||||||
@@ -57,5 +57,5 @@ Config { overrideRedirect = True
|
|||||||
]
|
]
|
||||||
, sepChar = "%"
|
, sepChar = "%"
|
||||||
, alignSep = "}{"
|
, alignSep = "}{"
|
||||||
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | %kbd% { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% "
|
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% "
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,5 +58,5 @@ Config { overrideRedirect = True
|
|||||||
]
|
]
|
||||||
, sepChar = "%"
|
, sepChar = "%"
|
||||||
, alignSep = "}{"
|
, alignSep = "}{"
|
||||||
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | %kbd% { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% %_XMONAD_TRAYPAD% "
|
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% %_XMONAD_TRAYPAD% "
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user