I'm on Ubuntu 18.04, and I'm trying to make it so that when I open terminal by pressing CTRL-ALT-T, the terminal would open in the center of the screen instead of in the top left corner of the screen. I already tried editing the gnome-terminal.desktop file by adding --geometry xxxxxxx to the Exec line, and it doesn't seem to work. Any suggestions?
-
Have you tried the command in a terminal to check if it works at all? Are you using Xorg or Wayland? – danzel May 18 '18 at 08:34
-
I'm not using either because I don't know what they are.. How would you recommend using either? – Brian Ko May 19 '18 at 02:18
-
These are display servers and you are using one of them (Xorg by default), but it doesn't matter because the command works when executed in a terminal. I just read your question again, and I think the problem is that the desktop file is not executed when you open gnome-terminal by keyboard shortcut. Try disabling the default shortcut in settings and add a custom shortcut with your command. Then bind the custom shortcut to [Ctrl]+[alt]+[del]. – danzel May 19 '18 at 07:52
2 Answers
So you changed the Exec
line of your gnome-terminal.desktop
file. Now the terminal should be located as expected when you execute the .desktop
file, either from Nautilus (file manager/desktop) or the activities overview. The Launch terminal
keyboard shortcut is a different kettle of fish. In fact, there doesn't seem to be a correct way to change the default terminal command, and some parts of GIO even today have a hardcoded list of terminals that are tried to run in a specific order.
Anyways, this shouldn't bother you because if you want the terminal to be opened with specific arguments when you press Ctrl+Alt+T, there is an easy solution:
- Disable the default
Launch terminal
shortcut inSettings->Devices->Keyboard
- Scroll down and click the
+
at the end of the list to create a custom shortcut - Choose any name for it and input the command that you used in the
.desktop
file, for example:gnome-terminal --geometry 30x30+100+0
- Bind it to Ctrl+Alt+T (or any other key combination)
This will, of course, only change the behaviour when opening the terminal via keyboard shortcut. If you want to know more about the default terminal problem in gnome, you can start with this bug.
-
@BrianKo, Unfortunately
gnome-terminal --geometry 30x30+100+0
does not work.gnome-terminal
has no support for the part after+
likexterm
. But there may be a solution viagsettings
or via some custom setting via the normal 'Properties' menu system. This link may help, How to resize terminal window permanently using CLI? -- Otherwise you can usewmctrl
for this purpose (more complicated, but I use it, so I know that it works; Let me know if you want details aboutwmctrl
). – sudodus May 19 '18 at 09:14 -
@sudodus Ubuntu 18.04.0 default, i.e. gnome 3 on Xorg, gnome-terminal 3.28.1. It works in my computer. The gsettings value is, according to its description, deprecated and ignored. – danzel May 19 '18 at 09:22
-
It works in Lubuntu 18.04 but not standard Ubuntu 18.04. I am testing right now. These are installed systems, up to date with the same
gnome-terminal
. I notice what happens, and I cannot explain why this does not work in my standard Ubuntu. (I have not installed much in the Ubuntu system, the Lubuntu system is my 'work-horse' with a lot of things installed.) I am interested in understanding and solving this problem. – sudodus May 19 '18 at 09:28 -
1@sudodus if you are using Wayland, positioning the window might be prohibited for security reasons. – danzel May 19 '18 at 09:34
-
Yes, I was on Wayland. I logged out and logged into X11, and then
gnome-terminal --geometry 30x30+100+0
works. Thanks for solving this problem :-) -- But it it funny that this kind of positioning is working withxterm
in Wayland. – sudodus May 19 '18 at 09:39
As danzel suggested in comments, try to run the command manually to see that positioning works. When it will work manually it should work via Ctrl+Alt+T, too.
If geometry command line option does not work, use devilspie2 (http://www.nongnu.org/devilspie2/).

- 4,362
-
When I do it manually, it works perfectly fine. But when I edit the file, it won't work. – Brian Ko May 19 '18 at 02:25