3

It know that it is possible to pass the --geometry=WxH arguments when using launcher, but how to set this option with the ~/.bashrc file.

2 Answers 2

6

You need to install the wmctrl package. Then, add this to your ~/.bashrc file:

HORIZONTAL=600
VERTICAL=400
wmctrl -r ":ACTIVE:" -e 0,-1,-1,${HORIZONTAL},${VERTICAL}

It will resize your active window (should be the terminal), to the size specified by the ${HORIZONTAL} and ${VERTICAL} variables. Note that these are measured in pixels. You can set your terminal's geometry to what you want, then use the screenruler package to measure the dimensions in pixels.

Hope this helps :)

EDIT: Actually you can run this to show the size of all the gnome-terminal's that are open:

wmctrl -l -x -G | grep gnome-terminal.Gnome-terminal | awk '{ print "Horizontal: "$5" pixels; Vertical: "$6" pixels" }'
0
0

You can put the following command in your .bash_profile file.

gnome-terminal --geometry=WIDTHxHEIGHT+XPOS+YPOS

In which:

  • WIDTH is the width in characters

  • HEIGHT is the height in rows

  • XPOS is the X-positon in pixels

  • YPOS is the Y-position in pixels

Notice that an x separates WIDTH from HEIGHT. A + separates the HEIGHT from XPOS. Another + separates XPOS from the YPOS.

1
  • No effect on Ubuntu 22.04.2 LTS
    – helcim
    Jul 15, 2023 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .