From 1ffe58f3ee6eeb2d81729eb7c458a8979eb2df68 Mon Sep 17 00:00:00 2001
From: Timmy Keller <tjk@tjkeller.xyz>
Date: Thu, 20 Jan 2022 17:07:39 -0600
Subject: moved many scripts around, small tweaks/rewrites, mounter verify
 xsudo and xclick scripts

---
 x11/testtimmywm | 1 -
 x11/xclick      | 7 +++++++
 x11/xsudo       | 7 +++++++
 x11/xvsync      | 2 +-
 4 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100755 x11/xclick
 create mode 100755 x11/xsudo

(limited to 'x11')

diff --git a/x11/testtimmywm b/x11/testtimmywm
index 330a328..33cda37 100755
--- a/x11/testtimmywm
+++ b/x11/testtimmywm
@@ -1,5 +1,4 @@
 #!/bin/sh
-
 Xephyr -br -ac -reset -screen 2160x1440 :1 &
 sleep 1
 export DISPLAY=:1
diff --git a/x11/xclick b/x11/xclick
new file mode 100755
index 0000000..3b05b38
--- /dev/null
+++ b/x11/xclick
@@ -0,0 +1,7 @@
+#!/bin/sh
+pkill xdotool && echo 'Killed old xclick process! Exiting...' && exit 0
+
+delay=${1:-`seq 500 500 10000 | dmenu -p 'Delay between clicks (in milliseconds): '`}
+click=${2:-`seq -f'Button %g' 5 | dmenu -p 'Mouse click: ' | tr -cd '[:digit:]'`}
+
+xdotool click --delay $delay --repeat 2147483647 $click # signed 32-bit integer limit is probably enough clicks since xdotool doesn't have an infinite repeat option
diff --git a/x11/xsudo b/x11/xsudo
new file mode 100755
index 0000000..5feabb1
--- /dev/null
+++ b/x11/xsudo
@@ -0,0 +1,7 @@
+#!/bin/sh
+sudo=doas
+while ! echo "$pass" | $sudo -n true; do
+	pass="$(dmenu -p 'Password: ' <&-)" # Ask user for password pass is incorrect (skipped if nopass in enabled)
+	[ "$pass" = '' ] && exit 0
+done
+echo "$pass" | $sudo xauth -f /root/.Xauthority add $(xauth list $DISPLAY) && echo "$pass" | $sudo "$@"
diff --git a/x11/xvsync b/x11/xvsync
index e80edab..0d5cd5c 100755
--- a/x11/xvsync
+++ b/x11/xvsync
@@ -1,5 +1,5 @@
 #!/bin/sh
 # Since this script runs xrandr to get the connected monitors, it is unnecessary to run xrandr by itself in your xinitrc
 for monitor in `xrandr | sed -n 's/ connected.*//p'`; do
-	#xrandr --output $monitor --set TearFree ${1:-on}
+	xrandr --output $monitor --set TearFree ${1:-on}
 done
-- 
cgit v1.2.3