Trivial zat optimizations
authorSergey Matveev <stargrave@stargrave.org>
Mon, 9 Nov 2020 18:47:10 +0000 (21:47 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 9 Nov 2020 18:47:10 +0000 (21:47 +0300)
bin/bin/zat

index 0431ab99b33f9da0ccbdbe84b09a4cb7e34442f6..becc82ff3e6ff55d9c29f56a938e68badcef4b82 100755 (executable)
@@ -1,14 +1,14 @@
 #!/bin/sh
 
 w=/tmp/tabbed-winid
-winid=`cat $w`
-wmclass=`xprop -id $winid WM_CLASS 2>/dev/null`
-if echo "$wmclass" | grep -q tabbed; then
-    (
-        zathura -e $winid $@
+[ -r "$w" ] && {
+    read winid < $w
+    wmclass=`xprop -id $winid WM_CLASS 2>/dev/null`
+    echo "$wmclass" | grep -q tabbed && {
+        XDG_DATA_DIRS=$HOME/zathura bin.zathura -e $winid $@
         rm -f zathura.core
-    ) &
-else
-    tabbed -cd > $w
-    exec $0 $@
-fi
+        exit
+    }
+}
+tabbed -cd > $w
+exec $0 $@