From: paperbenni Date: Sun, 26 Jul 2020 09:20:03 +0000 (+0200) Subject: init layout switcher editor X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d66c1712e89e0d9f9b633ce3c9ec8d32ff9d955c;p=instantos%2FinstantOS.git init layout switcher editor --- diff --git a/autostart.sh b/autostart.sh index 7248cfc..9800c76 100755 --- a/autostart.sh +++ b/autostart.sh @@ -201,8 +201,8 @@ if ! islive; then fi & # apply keybpard layout - if [ -e ~/instantos/keyboard ]; then - setxkbmap -layout $(cat ~/instantos/keyboard) + if iconf layout; then + setxkbmap -layout "$(iconf keyboard)" else CURLOCALE=$(locale | grep LANG | sed 's/.*=\(.*\)\..*/\1/') case "$CURLOCALE" in diff --git a/programs/ilayout b/programs/ilayout new file mode 100644 index 0000000..3585a41 --- /dev/null +++ b/programs/ilayout @@ -0,0 +1,36 @@ +#!/bin/bash + +# keyboard layout switcher + +if [ -z "$1" ]; then + echo "no options" + exit +fi +mkdir -p ~/.config/instantos/ +cd ~/.config/instantos/ +if [ -e ./layouts ] && grep -q .. ./layouts; then + echo "layouts found" +else + ./layouts + echo "inititalizing layouts" + if ! iconf layout; then + iconf layout us + fi + iconf layout >layouts + +fi + +# layout list editor +while :; do + LIST=">>h Keyboard layouts +$(cat layouts) +:gadd layout +:rclose menu" + CHOICE=$(echo "$LIST" | sed 's/^$/>/g' | instantmenu -c -w -1 -l 40 -q 'search' -p 'keyboard layout manager' -bw 4) + [ -z "$CHOICE" ] && exit + if grep "^$CHOICE$" layouts; then + echon ">>h $CHOICE +:b Move up +:b Move down" + fi +done