Linux – Bash Resize Terminal Xterm

bashcommand-line-toollinuxmacterminal

I am looking for a universal builtin command that resizes Xterm based terminals.

This is some sort of command that won't make a new window, that I won't need to include in the file that these terminals start up with.

I want to make an app that will open in a 60×30 frame, but only after you run the command

myapp run

I don't want my terminal to always open at 30×60, I just want it to resize when I run myapp.

Best Answer

I don't have a Mac so I can't try this but wmctrl is a UNIX app so it should work for OSX as well. Try something like:

 wmctrl -r :ACTIVE: -e 5,-1,-1,660,540
        -----------   -- -- -- --- ---
             |         | |  |   |   |---> Window height
             |         | |  |   |-------> Window width             
             |         | |  |-----------> Window Y coordinates
             |         | |--------------> Window X coordinates
             |         |----------------> Gravity
             |--------------------------> Apply to the active window

Gravity can be one of (source):

  • NorthWest (1)
  • North (2),
  • NorthEast (3),
  • West (4),
  • Center (5),
  • East (6),
  • SouthWest (7),
  • South (8),
  • SouthEast (9)
  • Static (10).

A gravity of 0 indicates that the Window Manager should use the gravity specified in WM_SIZE_HINTS.win_gravity.

Related Question