소스 검색

Add Pointer Center script

Samuel W. Flint 6 년 전
부모
커밋
c2463939e8
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  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