vermaden/scripts

desktop-pause.sh does not minimize

BSDer opened this issue · 1 comments

BSDer commented

When using -A or -S minimize does not work when multiple windows are associated to the same process.
Example:

> xdotool search --pid 69309
104857602
104857610
104857616
104857622

The following patch solves the problem:

--- desktop-pause.sh.old        2018-09-21 19:16:07.831708000 +0200
+++ desktop-pause.sh    2018-09-21 19:18:18.392168000 +0200
@@ -134,7 +134,9 @@
 
 if [ "${MIN}" = "1" -a "${SIGNAL}" = "STOP" ]
 then
-  xdotool windowminimize $( xdotool search --pid ${PID} )
+  for i in `xdotool search --pid ${PID}`; do
+    xdotool windowminimize $i
+  done
   echo "INFO: xdotool windowminimize \$( xdotool search --pid ${PID} )"
 fi
 kill -${SIGNAL} ${PID}
@@ -144,7 +146,9 @@
     do
       if [ "${MIN}" = "1" -a "${SIGNAL}" = "STOP" ]
       then
-        xdotool windowminimize $( xdotool search --pid ${PID} )
+        for i in `xdotool search --pid ${PID}`; do
+          xdotool windowminimize $i
+        done
         echo "INFO: xdotool windowminimize \$( xdotool search --pid ${PID} )"
       fi
       kill -${SIGNAL} ${I}

Thank you for pointing that, fixed in two steps :)

6cfe556
9931d20