0

I'm making a custom command that launches gnome-terminal as a sort of overlay window near the bottom of the screen, similar to the Tilda terminal. In order to do this, I'm using gnome-terminal's --geometry argument, which uses the X geometry specification.

However, I'm unable to place the left border on the window near the left edge of the screen. When I supply the +XOFF value, it's positioned relative to the right edge of the Unity launcher bar. If I make the +XOFF value negative, it still won't place the left border further to the left. If I use a -XOFF value, the right border of the window is positioned outside the screen instead of putting the left border of the window closer to the left side of the screen.

So here's my question, how can I put the left edge of the window at the left edge of the screen using a shell command? I'm using Ubuntu 11.10 if it's relevant.

1

You can try wmctrl:

wmctrl -r WINDOW_NAME -e 0,0,0,-1,-1

Moves the window to the top-left corner of the screen (below the menu bar, under the laucher).

The tricky part is how to determine which window to apply the command to. If you give it a descriptive title it can be used as the window name. Alternatively you can use the name of the program if you do not plan to start multiple instances.

Paramters:

  • -r: Move and resize window on the desktop.
  • -e: Specify Gravity, Position and Size (G,X,Y,W,H). Specifying G=0 and W=-1, H=-1 will allow you to position the window by using the X, Y parameters leaving other attributes intact.

More information:

  • man wmctrl
  • wmctrl --help

(If you do not have wmctrl installed, try: sudo apt-get install wmctrl.)

  • Thanks. But for some reason the Y-value doesn't seem to do anything. My window's still positioned at the top of the screen, but I'm trying to place it at the bottom.wmctrl -r windowname -e 0,0,30,-1,-1 But I found a way to do what I'm trying to do by setting a fixed window placement in CompizConfig. – Knut Remi Apr 26 '12 at 13:30
  • Strange: for me 30 is about 5 pixels below the menu. – lgarzo Apr 26 '12 at 13:47
  • Seems to be related to fixed window positions in CompizConfig. I solved the problem by disabling the rule in CompizConfig. And since I'm also using wmctrl to put the window always on top, I think I'll go for the wmctrl solution anyway. Thanks. – Knut Remi Apr 26 '12 at 14:15
  • You're welcome. I don't use the CompizConfig features you're mentioning, but I'm glad it finally worked. – lgarzo Apr 26 '12 at 14:40

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.