Setting layout now persists between xorg sessions.

This commit is contained in:
Sheldon Lee 2021-09-22 16:33:10 +08:00
parent ffc32accc2
commit 21b560621a
2 changed files with 18 additions and 3 deletions

View File

@ -16,3 +16,4 @@ run firefox
run discord run discord
run alacritty "--working-directory $HOME/" run alacritty "--working-directory $HOME/"
run feh "--bg-fill $HOME/wallpaper/ff_campfire.jpg" run feh "--bg-fill $HOME/wallpaper/ff_campfire.jpg"
[ -f "setlayout.sh" ] && ./setlayout.sh

View File

@ -1,12 +1,20 @@
#!/bin/bash #!/bin/bash
# #
# Script to change Xorg layout. # Script to change keyboard layout.
# #
# dmenu # dmenu
#option=$(echo -e $options | dmenu -i) #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 # rofi emulation of dmenu
option=$(echo "1) US|2) Colemak" | rofi -dmenu -sep '|' -i) option=$(echo "1) US|2) Colemak" | rofi -dmenu -sep '|' -i)
@ -14,9 +22,15 @@ echo $option
case $option in case $option in
1*) 1*)
setxkbmap us loadkeys us
cmd="setxkbmap us"
echo $cmd > $script_file
$($cmd)
;; ;;
2*) 2*)
setxkbmap us -variant colemak loadkeys colemak
cmd="setxkbmap us -variant colemak -option caps:ctrl_modifier -option altwin:swap_alt_win"
echo $cmd > $script_file
$($cmd)
;; ;;
esac esac