dotfiles/.config/wm_scripts/menuitems/layout.sh

35 lines
557 B
Bash
Raw Normal View History

#!/bin/sh
2021-05-23 14:32:27 +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
# 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-23 03:33:36 +08:00
cmd="setxkbmap us -option"
echo $cmd > $script_file
$($cmd)
2021-02-18 22:18:26 +08:00
;;
2*)
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