Created
May 11, 2025 21:01
-
-
Save kyeotic/07281c3d9de106ad11b2a6d158e89347 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter script code | |
#from autokey_lib import altHigh, altLow, altFull | |
import os | |
from pathlib import Path | |
script_dir = Path(__file__).resolve().parent.resolve() | |
with open(os.path.join(script_dir, "autokey_lib.py"), 'r') as file: | |
exec(file.read()) | |
altHigh.move_window() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter script code | |
#from autokey_lib import altHigh, altLow, altFull | |
import os | |
from pathlib import Path | |
script_dir = Path(__file__).resolve().parent.resolve() | |
with open(os.path.join(script_dir, "autokey_lib.py"), 'r') as file: | |
exec(file.read()) | |
altLow.move_window() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter script code | |
import subprocess | |
def log(data): | |
dialog.info_dialog("Debug", | |
"Debug: '%s'" % | |
(data) | |
) | |
class Geo: | |
def __init__(self, geo): | |
self.x = geo[0] | |
self.y = geo[1] | |
self.width = geo[2] | |
self.height = geo[3] | |
def debug_window(win_id): | |
size = subprocess.run(["xdotool", "getwindowgeometry", win_id], capture_output=True, text=True) | |
log(size.stdout) | |
def move_window(win_id, geo): | |
#log(win_id) | |
resize = subprocess.run(["xdotool", "windowsize", win_id, str(geo.width), str(geo.height)], capture_output=True, text=True) | |
move = subprocess.run(["xdotool", "windowmove", win_id, str(geo.x), str(geo.y)], capture_output=True, text=True) | |
#log({resize: resize, move: move}) | |
def get_window_id(): | |
return subprocess.check_output(["xdotool", "getactivewindow"]).decode().strip() | |
class ScreenPosition: | |
def __init__(self, geo): | |
self.geo = Geo(geo) | |
def move_window(self): | |
active = get_window_id() | |
move_window(active, self.geo) | |
#debug_window(active) | |
altHigh = ScreenPosition([2534, 69, 1491, 1256]) | |
altLow = ScreenPosition([5068, 2532, 1491, 1316]) | |
altFull = ScreenPosition([2534, 69, 1491, 2518]) | |
mainFull = ScreenPosition([24,516, 2529, 1383]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment