diff --git a/SpyderScripts/resize_window.py b/SpyderScripts/resize_window.py new file mode 100644 index 0000000..c9144aa --- /dev/null +++ b/SpyderScripts/resize_window.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +""" +Core module for resizing the active window on macOS. +""" + +import subprocess +import sys + + +def resize_active_window(width: int, height: int): + """ + Resize the currently active window to the specified dimensions. + Keeps the window in its current position. + + Args: + width: Target width in pixels + height: Target height in pixels + """ + applescript = f''' + tell application "System Events" + set frontApp to first application process whose frontmost is true + tell frontApp + set size of window 1 to {{{width}, {height}}} + end tell + end tell + ''' + + try: + subprocess.run(['osascript', '-e', applescript], check=True, capture_output=True) + print(f"✓ Resized active window to {width}x{height}") + except subprocess.CalledProcessError as e: + print(f"✗ Error resizing window: {e.stderr.decode()}") + sys.exit(1) \ No newline at end of file diff --git a/SpyderScripts/window_maximum.py b/SpyderScripts/window_maximum.py new file mode 100644 index 0000000..2bfbae4 --- /dev/null +++ b/SpyderScripts/window_maximum.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +""" +Resize active window to Maximum preset (2400x3500) +""" + +from resize_window import resize_active_window + +if __name__ == "__main__": + resize_active_window(width=2400, height=3500) \ No newline at end of file diff --git a/SpyderScripts/window_medium.py b/SpyderScripts/window_medium.py new file mode 100644 index 0000000..c063476 --- /dev/null +++ b/SpyderScripts/window_medium.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +""" +Resize active window to Medium preset (2300x2250) +""" + +from resize_window import resize_active_window + +if __name__ == "__main__": + resize_active_window(width=2300, height=2250) \ No newline at end of file diff --git a/SpyderScripts/window_minimal.py b/SpyderScripts/window_minimal.py new file mode 100644 index 0000000..309a378 --- /dev/null +++ b/SpyderScripts/window_minimal.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +""" +Resize active window to Minimal preset (2042x1262) +""" + +from resize_window import resize_active_window + +if __name__ == "__main__": + resize_active_window(width=2042, height=1262) \ No newline at end of file diff --git a/SpyderScripts/window_minimalist.py b/SpyderScripts/window_minimalist.py new file mode 100644 index 0000000..f0d07a5 --- /dev/null +++ b/SpyderScripts/window_minimalist.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 +""" +Resize active window to Minimalist preset (1250x810) +""" + +from resize_window import resize_active_window + +if __name__ == "__main__": + resize_active_window(width=1250, height=810) \ No newline at end of file