Files
public-setupfiles/mac-scripts/tile-windows/tile-windows.applescript
T
WickedYodaandWicked Yoda af1d1634c2 feat: add macOS window tiling script (Hammerspoon) (#91)
- 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>
2026-08-11 21:53:55 -05:00

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"