OSDN Git Service

init layout switcher editor
authorpaperbenni <paperbenni@gmail.com>
Sun, 26 Jul 2020 09:20:03 +0000 (11:20 +0200)
committerpaperbenni <paperbenni@gmail.com>
Sun, 26 Jul 2020 09:20:03 +0000 (11:20 +0200)
autostart.sh
programs/ilayout [new file with mode: 0644]

index 7248cfc..9800c76 100755 (executable)
@@ -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 (file)
index 0000000..3585a41
--- /dev/null
@@ -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