OSDN Git Service

switch dswitch to wmutils
authorpaperbenni <paperbenni@gmail.com>
Wed, 11 Dec 2019 18:47:47 +0000 (19:47 +0100)
committerpaperbenni <paperbenni@gmail.com>
Wed, 11 Dec 2019 18:47:47 +0000 (19:47 +0100)
dswitch
install.sh

diff --git a/dswitch b/dswitch
index 1911eca..41c5f11 100755 (executable)
--- a/dswitch
+++ b/dswitch
@@ -33,23 +33,6 @@ if ! [ -e ~/paperbenni/ismultimonitor ]; then
     exit
 fi
 
-winequal() {
-    [[ $1 =~ "," ]] && return 1
-    if [ "$(wincomp $1)" = "$(wincomp $2)" ]; then
-        return 0
-    else
-        return 1
-    fi
-}
-
-currentwin() {
-    xprop -root | head -1 | grep -o '0x.*' | sed 's/0x/0x0/'
-}
-
-wincomp() {
-    grep -Eo '.{7}$' <<<"$1"
-}
-
 getmonitor() {
     XPOS=$(xdotool getwindowfocus getwindowgeometry | grep -Eoi 'position.*,' | grep -o '[0-9]*')
     if [ "$XPOS" -gt "1919" ]; then
@@ -59,34 +42,17 @@ getmonitor() {
     fi
 }
 
-OLDWID=$(currentwin)
-echo "oldwid $OLDWID"
-OLDMONITOR=$(getmonitor)
+OLDWID=$(pfw)
 focuswin "$WID"
 
-if winequal "$(currentwin)" "$WID"; then
-    echo "success current $(currentwin)"
-
-    if ! [ "$(getmonitor)" = "$OLDMONITOR" ]; then
-        xdotool key "super+comma"
-        if ! winequal $(currentwin) "$OLDWID"; then
+if [ "$(pfw)" = "$WID" ]; then
+    exit
+else
+    if ! [ "$(pfw)" = "$OLDWID" ]; then
+        if ! [ "$OLDWID" = "0x000001e1" ]; then
             xdotool key "super+Tab"
         fi
-        xdotool key "super+comma"
-
-    else
-        echo "not on any active window"
     fi
-    echo "success"
-    exit
-else
-    echo "not successful"
-    focuswin "$OLDWID" || xdotool key "super+Tab"
     xdotool key "super+comma"
-    echo $(currentwin)
     focuswin "$WID"
 fi
-
-# xdotool key "super+comma"
-# xdotool key "super+comma"
-# xdotool key "super+Tab"
index eaa5526..cb2f546 100755 (executable)
@@ -223,6 +223,16 @@ if ! command -v dragon &>/dev/null; then
     rm -rf dragon
 fi
 
+if ! command -v lsw &>/dev/null; then
+    test -e core && (echo "core dir existing" && exit 1)
+    git clone --depth=1 https://github.com/wmutils/core.git
+    cd core
+    make
+    sudo make install
+    cd ..
+    rm -rf core
+fi
+
 mkdir ~/paperbenni &>/dev/null
 
 # automatic wallpaper changer