OSDN Git Service

add instantdpi
authorpaperbenni <paperbenni@gmail.com>
Mon, 3 Aug 2020 17:33:27 +0000 (19:33 +0200)
committerpaperbenni <paperbenni@gmail.com>
Mon, 3 Aug 2020 17:33:27 +0000 (19:33 +0200)
autostart.sh
programs/instantdpi [new file with mode: 0755]

index 5f3d4e5..a66ad9e 100755 (executable)
@@ -275,7 +275,10 @@ if ! iconf -i nostatus; then
        source /usr/bin/instantstatus &
 fi
 
-iconf -i potato || ipicom &
+# compositing
+if iconf -i potato || iconf -i nocompositing; then
+       ipicom &
+fi
 
 while :; do
        lxpolkit
diff --git a/programs/instantdpi b/programs/instantdpi
new file mode 100755 (executable)
index 0000000..aaa7d6f
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# apply instantOS dpi settings
+
+DPI="$(iconf dpi)"
+
+resetdpi() {
+    echo "resetting dpi"
+    sed -i '/^Xft\.dpi/d' ~/.Xresources
+}
+
+appendresources() {
+    echo "setting dpi to $DPI"
+    echo "Xft.dpi: $DPI" >>~/.Xresources
+}
+
+if [ -z "$DPI" ]; then
+    resetdpi
+    exit
+fi
+
+[ "$DPI" -eq "$DPI" ] || exit
+
+# resetting
+if [ "$DPI" = "96" ]; then
+    resetdpi
+    exit
+fi
+
+if ! [ -e .Xresources ]; then
+    echo "initializing xresources"
+    touch ~/.Xresources
+    appendresources "$DPI"
+else
+    if grep -q '^Xft.dpi' ~/.Xresources; then
+        resetdpi
+    fi
+    appendresources "$DPI"
+fi