10
  1. How can I set geometry for applications by console command?
  2. How can I remove borders (title, close minimie maximize buttons) from application by console command?

For example, I want to start a windows in virtualbox and make a screencast. I want to set a precise position of virtualbox window and same precise position in screencast application.

5
  • geometry's an interesting way to put it. Commented Jul 17, 2015 at 16:26
  • @Huey While perhaps strange from a computing perspective, it's technically correct. Geometry relates to both shape and relative position. Commented Jul 17, 2015 at 17:43
  • These are two seperate questions and should be split. I think I've got part 1 covered, part 2 is basically a theming question. Removing / changing window control buttons is already answered elsewhere. Commented Jul 17, 2015 at 19:24
  • Yes, part 1 about windows size is covered. But part 2 about remove window borders is not coved. Your link is about change buttons in all windows. Bu I want to remove full border with title for 1 window. Commented Jul 20, 2015 at 6:05
  • So you want only the window content, nothing else? Commented Aug 28, 2015 at 0:59

1 Answer 1

6

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

1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.