summaryrefslogtreecommitdiff
path: root/mwarp.py
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-10-09 01:19:04 -0500
committerzachir <zachir@librem.one>2022-10-09 01:19:04 -0500
commit0ad890bae271b17a7eaf76f70b2c462e4ca10333 (patch)
treee81457c2d4cf414a66edb010b4cfbc2e0974e400 /mwarp.py
parentd36e7cd095371deb8b70115fc7817d351bcfa645 (diff)
reorganize .local/bin folder
Diffstat (limited to 'mwarp.py')
-rwxr-xr-xmwarp.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/mwarp.py b/mwarp.py
new file mode 100755
index 0000000..abe34b8
--- /dev/null
+++ b/mwarp.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+import subprocess
+import sys
+
+arg = sys.argv[1]
+
+screeninfo = [
+ s for s in subprocess.check_output("xrandr").decode("utf-8").split()\
+ if s.count("+") == 2
+ ]
+
+if arg == "left":
+ match = [s for s in screeninfo if s.endswith("+0+0")][0]
+elif arg == "right":
+ match = [s for s in screeninfo if not s.endswith("+0+0")][0]
+
+data = [item.split("x") for item in match.split("+")]
+numbers = [int(n) for n in [item for sublist in data for item in sublist]]
+coord = [str(int(n)) for n in [(numbers[0]/2)+numbers[2], (numbers[1]/2)+numbers[3]]]
+
+subprocess.Popen(["xdotool", "mousemove", coord[0], coord[1]])
+