How to customize the right-click menu in Gnome2
December 10, 2012
Kudos to my brilliant co-worker Gerry Gold (http://www.tektwit.com/) for figuring this out.
My favorite desktop environment in Ubuntu is OpenBox for its minimalism, customization capabilities, and speed. Unfortunately, it doesn’t have a GUI file browser, so you have to launch nautilus from the command line in order to get a GUI. This then launches Gnome2. Once we are done using nautilus, we want an easy way to get back to OpenBox.
The command-line way is to type ‘killall nautilus’ in terminal. Unfortunately, you don’t always have access to a terminal, and it takes too long. Therefore, we wanted to add an option to the right-click menu to kill nautilus easily.
is a scripts directory that gets automatically added to the “Scripts” menu option in the right-click panel. We added an option (script) to the panel as follows (in terminal):
$ touch "Kill Nautilus"
Fill contents of the file with these commands:
#!/bin/sh killall nautilus
That’s it! Now, when you right-click, the menu has a “Scripts” option with the “Killall Nautilus” entry in the submenu (the menu display string comes from the filename) that runs this script. It would be a good idea to also type this line while in the nautilus-scripts folder:
ln -s /usr/bin/gnome-terminal
This will create an option to open a terminal, which is nice if you get into a situation (especially when switching between OpenBox and Gnome2) where you can’t open a new terminal.