14

I've just installed Ubuntu 14.04 alongside Windows and I am finding one thing to be very irritating. That is, when I open any application, it opens at the top-left of the screen.

The first thing I have to do for every application opened is to move it to the center of the screen (or wherever I want it to be). Then later on I'll close the app. But next time around, it's back at the top-left of the screen again!

I have read related questions on AskUbuntu and across the web. However I was wondering, since those questions were asked with regards to Ubuntu 12.04, if there was a better solution to this problem for 14.04 users? Shouldn't something like this be in Settings? I mean, that's just common sense really. Isn't it? I really don't know anymore.

1
  • 3
    You can use CCSM (Compiz Config Settings Manager) to control window settings. sudo apt-get compizconfig-settings-manager (if it is not already installed)
    – No Time
    Jul 9, 2014 at 22:29

4 Answers 4

5

(My other answer describes why restoring a window position is not possible for the general case.)

For special cases where saving and restoring a window position is feasible, one can use shell scripts to save and restore the position or geometry (geometry is position plus size) for cases that can not be handled by the window manager configuration (see below).

There are various command line tools to read and set properties of windows - for example wmiface and wmctrl.
A minimal example:

Get the geometry of a window in X geometry format (usually WxH+X+Y) (note the y coordinate - I am using 16 compiz virtual desktops/viewports):

$ wmiface windowGeometry 46137711
1256x814+1186+5005

Move the window elsewhere (note the different format for geometry):

wmctrl -i  -r 46137711 -e "0,1186,4005,1256,814"


Another approach is to define fixed positions for certain windows instead of restoring its position. This can usually be configured in the details of window handling configuration, like ccsm.

2
  • In the above answer wmiface which is a bit dated and isn't packaged for ubuntu can be replaced with xdotool getwindowgeometry or wmctrl -lGi | grep(needs hexadecimal convertion). For me, both of them disregard a panel at the bottom of the screen, but given that wmctrl -lGi returns its size as well, the window position/size can be backuped and restored after some time. Whatever the use case might be.
    – Ufos
    Aug 28, 2018 at 18:07
  • In general, I decided to stick with backing up wmctrl -lGi and restoring the same way its described in the answer.
    – Ufos
    Aug 28, 2018 at 18:10
3

Install ccsm (CompizConfigSettingsManager).

After starting ccsm (launched from the Unity Search Button) perform the following:

(Click on) Windows Manager
(Click on) Place Windows

Use these settings:

Workarounds Unticked
Multi Output Mode Place across all outputs

The Placement Mode Smart is the key for remembering your desired position.

Please keep in mind that some applications are programmed to override your system's perferred settings.

2

Window positions are not that simple to handle as "common sense" may suggest.
A position is ralative to some reference - like "the screen". But tere are so many variants of what "the screen" could mean here (see below), that it is not possible to save positions in a general way.

Of course it can be done in various ways which are adapted to some environment - but if it's about "just save a position, and restore later" - that's not possible because the coordinate system to restore the position in is unclear.

So, what's difficult about showing a window at some position on a screen?

Under Ubuntu - as on any modern X11-based system - the "screen" can change in various ways - during runtime, so saving position needs to handle that.

For example, the shape can change; From one rectangle to two rectangles side by side, to three rectangles with unaccessible space in between. The "Virtual desktop" can change. The viewport can change. Each affecting the coordinates that would be restored.

A special problem is to make sure nothing is moved out of the currently accessible part of the "screen".


On the side issue of opening windows at the top left: You can choose one of multiple algorithms to decide where to place a new window in the window handling settings (eg. in ccsm). For example, you could have them opened where the current mouse pointer is.

1

Just in case anyone lands here and really wants windows to be where you put them- install Enlightenment desktop. You can right click the icon top left of any page, select window, remember, and select size and position. I love that option and is one of the reasons I stay with e17.

1
  • Enligihtment is like "remembering window positions" on steroids. Oct 22, 2018 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.