2021-02-18 22:18:26 +08:00
|
|
|
#!/bin/bash
|
2021-05-23 14:32:27 +08:00
|
|
|
|
|
|
|
#
|
2021-09-22 16:33:10 +08:00
|
|
|
# Script to change keyboard layout.
|
2021-05-23 14:32:27 +08:00
|
|
|
#
|
2021-02-18 22:18:26 +08:00
|
|
|
|
|
|
|
# dmenu
|
|
|
|
#option=$(echo -e $options | dmenu -i)
|
2021-05-23 14:32:27 +08:00
|
|
|
|
2021-09-22 16:33:10 +08:00
|
|
|
# create script file
|
|
|
|
script_file="setlayout.sh"
|
|
|
|
if [ ! -f $script_file ]
|
|
|
|
then
|
|
|
|
touch $script_file
|
|
|
|
chmod +x $script_file
|
|
|
|
fi
|
|
|
|
|
2021-02-18 22:18:26 +08:00
|
|
|
# rofi emulation of dmenu
|
|
|
|
option=$(echo "1) US|2) Colemak" | rofi -dmenu -sep '|' -i)
|
|
|
|
|
|
|
|
echo $option
|
|
|
|
|
|
|
|
case $option in
|
|
|
|
1*)
|
2021-09-22 16:33:10 +08:00
|
|
|
loadkeys us
|
|
|
|
cmd="setxkbmap us"
|
|
|
|
echo $cmd > $script_file
|
|
|
|
$($cmd)
|
2021-02-18 22:18:26 +08:00
|
|
|
;;
|
|
|
|
2*)
|
2021-09-22 16:33:10 +08:00
|
|
|
loadkeys colemak
|
|
|
|
cmd="setxkbmap us -variant colemak -option caps:ctrl_modifier -option altwin:swap_alt_win"
|
|
|
|
echo $cmd > $script_file
|
|
|
|
$($cmd)
|
2021-02-18 22:18:26 +08:00
|
|
|
;;
|
|
|
|
esac
|