I understand it's a bit late maybe with this kind of reply. But I think it can still be useful for someone. If I understand the original question right, by Cipricus, he wanted to change the size of a running terminal. Not open a 2th terminal from terminal 1 and change the size of the 2th terminal window afterwards. The big issue, a running bash script will stop the script after opening the 2th terminal window, which is not what a bash developer wants.
I have frustrated myself today while trying to use your replies for this question in combination with a large bash script. Doesn't work. And even if you try to make it work you probably don't want to open a second terminal while running a bash script.
Most important, before I will show you my trick, a short message;
Dear gentlemen elementary developers,
Please don't let us find endless workarounds for functions that anyone would expect to be available to work when needed. Changing a terminal window size should be a matter of one terminal command that is supplied by default after installing the o.s. on a computer.
Please provide this for other people like me, not wanting to install another terminal application and keep elementary os as original as possible.
Ok. Having said that, here is what I found.
In your bash script use these lines to change the size of your terminal while running a script:
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' wmctrl|grep "install ok installed")
echo Checking for wmctrl: $PKG_OK
if [ "" == "$PKG_OK" ]; then
clear
echo "Please Wait a moment....."
sudo apt-get install --yes wmctrl > /dev/null 2>&1;
fi
wmctrl -r script.sh -e 0,-1,-1,1400,800;
In the last line you need to change the name of the script (script.sh) to the filename of your running bash script and adjust the size values "1400,800" to your wish. That should be enough to use it.
It will probably work after that.
What it does:
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' wmctrl|grep "install ok installed")
echo Checking for wmctrl: $PKG_OK
if [ "" == "$PKG_OK" ]; then
In this part the script is checking for a package named "wmctrl" whether it is installed or not.
then,
clear
echo "Please Wait a moment....."
sudo apt-get install --yes wmctrl > /dev/null 2>&1;
fi
if it doesn't find the package installed, it will install the package,
but it will not confuse the user with terminal output of the installation
process. This hiding is done by: > /dev/null 2>&1;
The user will only see an empty screen with a message "Please wait a moment" while waiting 10 seconds for the installation.
If there is no installation needed, the better. The script will end the boolean with fi and go to the last line;
wmctrl -r script.sh -e 0,-1,-1,1400,800;
Where it will actually use the command to adjust the terminal window.
It is handy to do a #wmctrl -l
to examine the names of the windows in the list. Probably you will see the name of your running sh script in the list.
Only the "exact" name of your script should be enough for wmctrl to find the right window. (Because that is what is does, it finds the right window among the list of all open windows and change it)
The last numbers are the ones to adjust the window settings. In my example I only wanted to change the size of the running terminal window (last 2 values, 1400 and 800) and not the position (value 2 and 3 in the line) -1 -1
For all options take a look at : wmctrl -h
Pfew...! And all that to avoid one missing logical terminal command...
Works for me, hope you can use it!