mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
- Tile two most-recent windows side by side on main screen - Includes Hammerspoon config, clickable AppleScript .app, and README - Fixes pre-existing merge conflict markers in mac-scripts READMEs Co-authored-by: Wicked Yoda <noreply@users.noreply.github.com>
27 lines
1.2 KiB
AppleScript
27 lines
1.2 KiB
AppleScript
-- tile-windows.applescript
|
|
-- A clickable macOS app that tells Hammerspoon to tile the two most-recent
|
|
-- windows side by side on the main screen.
|
|
--
|
|
-- REQUIREMENTS:
|
|
-- 1. Hammerspoon must be installed and running (https://hammerspoon.org)
|
|
-- 2. This file's companion init.lua must be loaded in ~/.hammerspoon/init.lua
|
|
-- 3. In Hammerspoon → Preferences → "Enable CLI (IPC Server)" must be checked
|
|
-- (this registers the `hs` command on your PATH)
|
|
--
|
|
-- BUILD INSTRUCTIONS (creates a double-clickable .app):
|
|
-- Open Script Editor.app → File → Open... navigate to this file.
|
|
-- Or use osacompile from Terminal:
|
|
-- osacompile -o ~/Applications/Tile\ Windows.app tile-windows.applescript
|
|
-- Then double-click "Tile Windows.app" in Finder/Dock to run it.
|
|
|
|
try
|
|
set resultText to do shell script "/opt/homebrew/bin/hs -c 'tileTwoWindows()'"
|
|
on error errMsg number errNum
|
|
-- If the IPC call fails, fall back to a friendly notification
|
|
display notification "Could not reach Hammerspoon IPC. Make sure Hammerspoon is running and IPC Server is enabled." with title "Tile Windows" subtitle "❌"
|
|
return
|
|
end try
|
|
|
|
-- Optional: brief visual confirmation
|
|
display notification "Windows tiled ✓" with title "Tile Windows"
|