dotfiles/.config/wm_scripts/layout.sh
2021-09-23 03:33:36 +08:00

37 lines
590 B
Bash
Executable File

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