Using wmctrl
The program wmctrl allows to you to get infos and change the states of currently open windows. Install it by typing sudo apt-get install wmctrl
.
Type wmctrl -l
to output a list of currently managed windows:
0x02e00003 -1 username plank
0x02a00003 -1 username wingpanel
0x0340000a 0 username Home: wmctrl
0x0360000a 0 username Scratch
0x03403972 0 username Home: wmctrl
Now you can resize and move the window with wmctrl -r <Window> -e <G>,<X>,<Y>,<W>,<H>
, for example wmctrl -r Scratch -e 0,10,200,600,400
<X>
, <Y>
, <W>
, <H>
can also be set to -1
so the respective value stays the same.
If there are multiple windows with the same name, use the -i switch and input the window id instead of the title. This example will only change the dimensions of the second window called "Home: wmctrl" (a Terminal) wmctrl -i -r 0x03403972 -e 0,10,20,-1,-1
Or change the state with wmctrol -r <Window> -b <State>
.
To learn about all options, type wmctrl --help
or man wmctrl
.
Saved state in gsettings
Most apps save the last position of their window in gsettings, unfortunately quite inconsistently. Some examples for elementary apps:
Audience: No saved state.
Calculator: No saved state.
Files org.pantheon.files.preferences
maximized
(boolean), window-height
, window-width
(no x and y position)
Photos org.pantheon.foto.saved-state
window-state
, window-height
, window-width
(no x and y position)
Calendar (Maya) org.pantheon.maya.saved-state
window-state
, window-height
, window-width
(no x and y position)
Geary Mail org.yorba.geary
window-state
, window-height
, window-width
(no x and y position)
Music (Noise) org.pantheon.noise.saved-state
window-state
, window-height
, window-width
(no x and y position)
Scratch org.pantheon.scratch.saved-state
window-state
, window-height
, window-width
, window-x
, window-y
Sytem Settings (Switchboard) org.pantheon.switchboard.saved-state
window-state
, position
, window-height
, window-width
Terminal org.pantheon.terminal.saved-state
window-state
, opening-x
, opening-y
, window-height
, window-width
You can get the current value of a key by typing the following in your Terminal:
gsettings get org.pantheon.files.preferences window-height
You can change the value by typing:
gsettings set org.pantheon.files.preferences window-height 400