Ubuntu – How to disable or reorder gnome-terminal right-click context menu

context menugnome-terminal

gnome terminal context menu image

I'm using Gnome Terminal 3.6.2 on Ubuntu 14.04.

On my trackpad I'm frequently accidentally opening a new terminal (even though I've disabled tap-to-click), I think the prominent placement of 'Open Terminal' here is to blame. Can I remove that entry or re-order them? It would be great to have Copy come first and Paste second? I use those much more often that opening a tab or terminal (intentionally).

update

I can duplicate the behavior (in 13.10) with a mouse- right clicking and dragging diagonally right and down will open a new terminal, but only if done quickly. If I right click and pause then I have to left click the menu options as expected.

update 2

It's starting to become more clear: there is an intentional feature of the right click menu that allows a right click and hold followed by the release of the right click on the context menu item of choice, which coexists with the right click release followed by a selection of the menu item and second right or left click.

The problem for me is when I'm intending to right click release and then select a menu item and a perform a second click. If the cursor is already moving down and right, or if I begin to make that move before releasing the right click, I get the undesired new terminal. I may be unconsciously trying to optimize the operation by getting a running start, or it is just random mouse movement.

Best Answer

In order to disable or reorder the gnome-terminal context menu, you should try editing the terminal.xml file located in /usr/share/gnome-terminal/ directory.

1) Make a backup of the terminal.xml file.
Open a Terminal window Ctrl+Alt+T and type:

  • cd /usr/share/gnome-terminal/
  • sudo cp -p terminal.xml terminal.xml.bak

2) Edit the terminal.xml file with your favorite editor. eg: nano

  • sudo nano -c /usr/share/gnome-terminal/terminal.xml

Regarding to your question you can comment the lines for the PopupNewTerminal PopupNewTab PopupCloseTab PopupCloseWindow menus. (Lines 88 to 93)

enter image description here

You can comment those lines with <!-- lines --> symbols.

enter image description here

To save the changes in nano.. Ctrl+O,Enter then Ctrl+X.

Exit or Close the Terminal window and open it again to see the changes.

BEFORE:

enter image description here

AFTER:

enter image description here

This is just an example, you can comment, delete or change the order in the menus (put the PopupCopy and PopupPaste menus before the PopupNewTerminal) in the file.

Just in case... please remember you have a backup of the terminal.xml.

Hope this helps.