8

Let's say I usually have three windowed apps running at the same time:

  1. Chrome
  2. Emacs
  3. Terminal

I like for them to be arranged the same way. I want this to happen on all of my desktops (or whatever the heck they are officially known as). How can I open these apps so that they appear in the same location?

  • Pro tips: emacs has --fullheight: http://www.gnu.org/software/emacs/manual/html_node/emacs/Window-Size-X.html This can be used in combination with --geometry. When used together, it seems that the height specification in --geometry is used when you move the window. – allyourcode Jun 24 '13 at 23:34
  • Pro tip: You can create a keyboard shortcut to open all of these at once. There are two ways to do this: via ccsm (search for "commands"), or System Settings (under Keyboard > Shortcuts). Amazingly, you can use both, but you probably want to choose one or the other for your own sanity. I recommend ccsm, because I use it for positioning my Chrome window, since --window-position doesn't seem to work in my version of Chrome. – allyourcode Jun 24 '13 at 23:36

3 Answers3

5

Once upon a time, you could use a command line parameter like -geometry wxh+x+y. It looks like this is still possible, but some programs (like gnome-terminal) require --geometry instead.

Note that gnome-terminal uses units of characters; other programs generally use units of pixels.

So all you need to do is write a script that starts each program in the background with your desired geometry settings. Something like this:

#!/bin/sh

gnome-terminal --geometry 80x24+0+0 &
gnome-terminal --geometry 80x24+82+0&
google-chrome --geometry ... &
# etc.

(I'm not sure if Chrome supports this - you'll need to check)

Finally, set your script to run automatically on startup.

Robie Basak
  • 15,670
  • 1
    Chrome has --window-size=width,height: https://code.google.com/p/chromium/issues/detail?id=27550 That thread also claims that --window-position also exists, but it doesn't work for me. Found someone else for whom --window-position doesn't work: http://productforums.google.com/forum/#!topic/chrome/79i1oLYhK8g – allyourcode Jun 24 '13 at 23:31
  • Another sad thing: --window-size doesn't seem to work if Chrome is already running. – allyourcode Jun 24 '13 at 23:45
  • Great and useful answer Robie Basak!! Is there any possibility to have 3 separate gnome-terminal sessions with 3 different customized profiles (I know this is a new question!) – v2r Aug 12 '14 at 12:57
2

Compiz supports such functionality.

You will need to install compizconfig-settings-manager. Once installed, run ccsm.

You can now use ccsm to configure/enable Grid and Place Windows, under Window Management.

Once you've set up where to open the windows, you can use Startup Applications found under System Tools > Preferences.

earthmeLon
  • 11,247
  • I don't think I completely get your answer. How does this open the applications involved? – gertvdijk Jun 23 '13 at 21:48
  • You will use Startup Applications. I have added this to the answer itself. – earthmeLon Jun 23 '13 at 21:50
  • Ah, you mean, this remembers the window position for an indefinite amount of time and will restore it on the next time it starts? – gertvdijk Jun 23 '13 at 21:52
  • The user will have to configure what windows he or she wants to place, and where he or she wants them to be placed. Once this is accomplished, the user will have to run said applications. If the user decided to have them start at startup, then they can add the applications to their Startup Applications. The user may decide this is a good feature, or may decide to load the applications manually when he or she is in need of said application. – earthmeLon Jun 23 '13 at 21:58
1

if "desktops (or whatever the heck they are officially known as)" is what KDE calls "virtual desktops", i.e. you define e.g. 8 desktops and have different windows on each, but "sticky" windows are shown on all desktops, then the answer (at least with KDE) is to use kstart. It has a --desktop option to specify the desktop:

kstart --desktop 3 chromium-browser
kstart --desktop 3 konsole -geometry 600x400+0+0

It's not very robust though. It first launches the program and then waits for the window to appear. If the window title is not what it guesses you have to use the --window option. When the window appears it is relocated to the given desktop.

kstart also has a --geometry option to specify the window geometry but in my case it was ignored. Instead I specified the geometry with application specific geometry options, see Robie Basak's answer above

user829755
  • 121
  • 4