Selaa lähdekoodia

Add Pointer Center script

Samuel W. Flint 4 vuotta sitten
vanhempi
commit
c2463939e8
1 muutettua tiedostoa jossa 16 lisäystä ja 0 poistoa
  1. 16 0
      center-pointer

+ 16 - 0
center-pointer

@@ -0,0 +1,16 @@
+#!/bin/sh
+
+HERE=`xdotool getwindowfocus`
+
+ULX=`xwininfo -id $HERE | grep "  Absolute upper-left X:" | awk '{print $4}'`
+ULY=`xwininfo -id $HERE | grep "  Absolute upper-left Y:" | awk '{print $4}'`
+
+# If there is no window, ULX == 1 and ULY == 1.
+if [ $ULX != "-1" -o $ULY != "-1" ]; then
+    eval `xdotool getwindowgeometry --shell $HERE`
+
+    NX=`expr $WIDTH / 2`
+    NY=`expr $HEIGHT / 2`
+
+    xdotool mousemove --window $WINDOW $NX $NY
+fi