User Tools

Site Tools


xtermsize
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


xtermsize [2008/02/12 13:56] (current) – created kleiner
Line 1: Line 1:
 +====== Programatically Setting the XTerm Screen Size ======
 +
 +This is a nice thing that works for any XTerm based terminal, in particular for Mac OS X's default terminal. To change the terminal window size from the command line, use a command of the following form:
 +<code>
 +echo -ne '\e[8;Y;Xt'
 +</code>
 +where ''X'' stands for the desired window width and ''Y'' stands for the desired window height. For example, to get an 80x50 terminal, you could use the following script:
 +<code>
 +#!/bin/sh
 +echo -ne '\e[8;50;80t'
 +</code>
 +or you could place this into an inline function, loaded in your ''.bashrc'' file or similar:
 +<code>
 +function ts
 +{
 +    if [[ -n "$1"  &&  -n "$2" && $1 > 0 && $2 > 0 ]]; then
 +        echo -ne "\e[8;$2;$1t" 
 +    fi  
 +}
 +function ts8025
 +
 +    ts 80 25
 +}
 +<code>
 +You can also set the window size in pixels instead of characters if you prefer. Just replace the 8 in the above command with a 4, like:
 +  echo -ne '\e[4;Ypix;Xpixt'
  
xtermsize.txt · Last modified: 2008/02/12 13:56 by kleiner