This is a collection of useful shell functions for managing terminal windows on macOS.
- Control window position, size, and theme
- Works with Terminal.app and Warp.app
- Uses AppleScript under the hood, so for now it only works for macOS
Example function that will open a new terminal window, resize, reposition, change theme, and SSH to a remote server.
Open a new terminal window.
Print the current window position and size as percentages and pixel values.
Get the pixel bounds of the current screen.
Move the current window to a new x,y position. Accepts either pixels or percentages.
Resize the current window to new width and height. Accepts either pixels or percentages.
Change the theme/appearance of the current terminal.
Get the name of the current terminal application.
Change theme specifically for Warp.
Change theme specifically for Terminal.app.
Source dans_window_functions.sh in your shell startup file.
# .zshrc or .bash_profile
source dans_window_functions.sh