Friday, May 3, 2024
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 9576  / 2 Years ago, fri, december 17, 2021, 5:49:38

I want to execute a command in a bash script that will resize the terminal window. In xterm



xterm -geometry=30x30



will create a new xterm window, and



lxterminal --geometry=30x30



will create a new lxterminal window.



Is there a way to resize either terminal without opening a new window? This is what it would look like:



if [ $TERMINALTYPE=xterm ]; then
DASH="-"
else
DASH="--"
endif

echo -e $TERMINALTYPE" "$DASH"geometry 30x30"


BUT: If there is a command that is a nice one-liner that will work with either terminal (vt100 escape sequence maybe) then that is even better.


More From » command-line

 Answers
3

There are two steps to this. First, you need to tell xterm to allow it to happen at all, because by default it ignores requests by hosted programs to resize the window. Add this to your ~/.Xdefaults:



xterm*allowWindowOps: true


For this to take effect, you either have to log out, or run:



xrdb ~/.Xdefaults


Then launch a new xterm, and in your bash script:



echo -ne "e[8;30;30t"

[#31955] Sunday, December 19, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afyess

Total Points: 437
Total Questions: 120
Total Answers: 107

Location: San Marino
Member since Fri, Jul 3, 2020
4 Years ago
;