OSDN Git Service

add gxkb to ilayout
authorpaperbenni <paperbenni@gmail.com>
Fri, 31 Jul 2020 14:19:17 +0000 (16:19 +0200)
committerpaperbenni <paperbenni@gmail.com>
Fri, 31 Jul 2020 14:19:17 +0000 (16:19 +0200)
programs/ilayout
rootinstall.sh

index db0a190..987c80a 100755 (executable)
@@ -22,6 +22,38 @@ else
 
 fi
 
+# convert layout selection to applet
+if [ "$1" = "apply" ]; then
+    pgrep gxkb && RESTARTAPPLET=true
+    if [ -e ~/.config/gxkb/gxkb.cfg ] && grep '^layout' ~/.config/gxkb/gxkb.cfg; then
+        echo "gxkb config found"
+    else
+        echo "initiating gxkb config"
+        pgrep gxkb || gxkb &
+        for i in {1..15}; do
+            echo "waiting for config: $i"
+            sleep 2
+            if [ -e ~/.config/gxkb/gxkb.cfg ]; then
+                pkill gxkb
+                break
+            fi
+        done
+    fi
+
+    echo "applying layouts to gxkb"
+    LAYOUTS="$(tr '\n' ',' <~/.config/instantos/layouts | grep -o '.*[^,]')"
+    echo "setting layouts to $LAYOUTS"
+
+    if [ -n "$RESTARTAPPLET" ]; then
+        echo "restartring gxkb"
+        pkill gxkb
+        sleep 2
+        gxkb &
+    fi
+
+    exit
+fi
+
 # layout list editor
 while :; do
     LIST=">>h Keyboard layouts
index 5811081..168d1b4 100755 (executable)
@@ -4,7 +4,7 @@
 ## installs all system wide tweaks for instantOS  ##
 ####################################################
 
-if ! [ $(whoami) = "root" ]; then
+if ! [ "$(whoami)" = "root" ]; then
     echo "please run this as root"
     exit 1
 fi