- Open Automator. You can do this with Spotlight search by hitting CMD-Space and type 'Automator'
- Click New Document
- Select Quick Action
- In the second column on the left-side, Double-Click Run AppleScript
- Paste the contents from below into that template
- In the File menu, choose Save.
- Give it a name like MaximizeVertically
- This will create a new service that you can trigger with a hotkey
- Test it by clicking the Apple menu and choosing Services and then MaximizeVertically
- That should give you a pop-up saying whatever app you are in wants access to control "System Events.app". Go ahead and allow it
- You'll get 2 more pop-ups, The first one is asking you to open system settings and grant access but the 2nd pop-up is covering that. You'll need to dismiss the 2nd pop-up so you can respond to the first. In my case, I was doing this from Alacritty so I had to give Apacritty Accessibility access.
- Create a hot-key
- Go to System Settings -> Keyboard -> Keyboard Shortcuts...
- Within that, choose Services
- Expand General. You should see MaximizeVertically.
- Assign a hotkey to that. I chose Shift-CMD-0
on run {input, parameters}
-- Get the frontmost application
tell application "System Events"
set frontApp to first application process whose frontmost is true
tell frontApp
tell window 1
-- Get current window bounds {x, y, width, height}
set windowBounds to position & size
set xPos to item 1 of windowBounds
set yPos to item 2 of windowBounds
set currentWidth to item 3 of windowBounds
set currentHeight to item 4 of windowBounds
-- Set new height (change this value as needed)
set newHeight to 2500
-- Keep the same x position and width, only change height
set position to {xPos, 0}
set size to {currentWidth, newHeight}
end tell
end tell
end tell
return input
end run