It's kind of annoying how some Ubuntu (GNOME, X Window System) programs start at the top left of my screen. Is there a way to make the program start in the center of the screen.

(Yeah I know it's a pretty trivial question but it is annoying ;-)

  • Which window manager/desktop environment are you using? – Babu Jul 15 '09 at 2:54

you can use x's geometry to set this.

depending on your x version it can vary.

the man page and it should explain the geometry options

xterm 80x24+nxn or similar.

| improve this answer | |
  • What does nxn do? – Kredns Jul 15 '09 at 2:58
  • n would represent the number you want to set. – egorgry Jul 15 '09 at 3:01
  • Why is it so hard to find information about geometry using a man page? – Kredns Jul 15 '09 at 3:05
  • 'man X', search for "GEOMETRY SPECIFICATIONS". – Craig Sanders Jul 15 '09 at 3:47
  • It says 'No manual entry for X. See man 7 undocumented for help when manual pages are not available'. – Kredns Jul 16 '09 at 0:43

In gnome-terminal (ubuntu) the geometry specification is slightly different:

gnome-terminal --geometry=114x32+0+0 

As ever the man pages are your friend:

man gnome-terminal
| improve this answer | |

most (probably all) window managers have configuration options that you can tweak to set where new windows are opened.

some examples:

openbox has a check-box "Center new windows when they are placed". that causes all new windows(*) to open in the centre of the screen.

sawfish is very flexible and programmable - you can set rules so that windows matching certain criteria are always centered, always opened in desktop 2, have a different frame style, and so.

i can't remember exactly what metacity is capable of...haven't used it for ages. i think it can centre windows by default.

(*) by default, that is. if they're opened with a specific geometry then that overrides the default.

| improve this answer | |

The question title is only about the Terminal, however, it seems the body is more general about "programs start at the top left of [… the] screen".

So, since GNOME v3.30 there is a visible option in GNOME Tweaks, which makes it easy to enable it for all windows:

GNOME Tweaks with Windows->"Center New Windows" highlighted

Just select "Center New Windows" under "Windows".

| improve this answer | |
  • BTW, in contrast to what i said, (that it's the default in Ubuntu now) this topic is not dead and still in discussion in Fedora & Ubuntu. – rugk Mar 30 '19 at 15:15

I couldn't figure out the centering problem (in X) either, so I just did some rough math on my screen dimensions to determine a close centerpoint. I needed this for my terminal window, similar to Ken above.

Here is what i have my terminal icon mapped to, which is close to center on my 1900x1200 resolution:

gnome-terminal --geometry=90x20+400+300

(That's width(columns) x hight(rows) + xoffset + y offset

To add to this, I have an alias in my .bashrc which I use when I need to open 4 terminals fast. The below will open 4 terminals, each pinned to the 4 corners, and 100 columns by 23 rows. Note that I go out of order in the calls so that the last line executed (the last terminal opened) is the upper left one, allowing me to start there.

# Open 4 terminal windows on the corners.  Upper rt, low left, low right, upper left
alias bam="     gnome-terminal --geometry=100x23-700+0; 
                gnome-terminal --geometry=100x23+0-400; 
                gnome-terminal --geometry=100x23-700-400;
                gnome-terminal --geometry=100x23+0+0;"
| improve this answer | |

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.