Skip to content

Instantly share code, notes, and snippets.

@chuhlomin
Last active March 7, 2025 20:23
Show Gist options
  • Save chuhlomin/58a5f569d1706a15439ab5f09465c642 to your computer and use it in GitHub Desktop.
Save chuhlomin/58a5f569d1706a15439ab5f09465c642 to your computer and use it in GitHub Desktop.
Apple Script that iterates over all opened Zed windows and forces them to go fullscreen
set targetApp to "Zed"
set windowsMenuName to "Windows"
set lastMenuItemBeforeWindowsList to "Zoom"
set viewMenuName to "View"
set fullScreenMenuItem to "Enter Full Screen"
tell application "System Events"
tell process targetApp
set frontmost to true
delay 0.5
try
-- Collect list of opened windows from Windows menu.
-- Other implementations may skip other windows if current one is in full screen mode.
set collectingWindows to false
set menuItems to {}
repeat with menuItem in menu items of menu windowsMenuName of menu bar 1
try
if name of menuItem is equal to lastMenuItemBeforeWindowsList then
set collectingWindows to true
else if enabled of menuItem and collectingWindows then
set end of menuItems to menuItem
end if
end try
end repeat
repeat with menuItem in menuItems
log "Window: " & (name of menuItem)
click menuItem
delay 1
set viewMenuItems to menu items of menu viewMenuName of menu bar 1
repeat with viewMenuItem in viewMenuItems
try
if name of viewMenuItem is equal to fullScreenMenuItem then
click viewMenuItem
delay 1
log "Full screen menu item clicked"
exit repeat
end if
end try
end repeat
log "Already full screen"
end repeat
on error errMsg
display dialog "Error setting window to full screen: " & errMsg
end try
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment