A Django site.
July 10, 2008
» Edit The Applications Menu With Two-Clicks : Ubuntu 8.04

Do you have applications in your main menu that you never, ever use?  Would you like to get rid of them?  Perhaps you’d like to reorganize some of your menu entries?  This can be done two ways, both of which take only two-clicks.

Editing The Main Menu

Method number one is done via right-click + left-click.  Bring your pointer to your main menu and right-click on Applications.  Within the resulting options you should see “Edit Menus”.  Left-click on that and the Main Menu Editor will appear.  You’ll now be able to edit the items displayed in your menus by simply checking and unchecking boxes.  You can even add new items if, for some reason, your installed application did not create one.

main menu editor

Method number two is probably even simpler, but I outline Method One above because I’ve had situations where the Main Menu Editor did not appear within my menu.  Sure makes it difficult to add the Main Menu Editor to the menu when you can’t get there in the first place!

To launch the Main Menu Editor navigate to:

System > Preferences > Main Menu

Either of these methods will launch the same tool and give you the same options.  As I mentioned above, I’m glad I know both methods because there have been times when “Main Menu” did not appear within my menu for some reason.  This way you’re always able to find it.

Other Points of Interest

November 3, 2007

Hans Fugal
no nic
The Fugue :
» Backticks 2.0

When you've been bitten by spaces and other odd characters in filenames as often as I have, you begin to get not a little bit paranoid. Beginners often make this mistake (ruby syntax, but the same thing happens in bash, perl, python, etc.):

foo = `file #{filename}`

They quickly learn to do this instead:

foo = `file "#{filename}"`

This works fine until they come across a filename with quotes or any other characters that are special to the shell from within quotes.

What's needed is something akin to what can be done with exec and system. With those two, you can do something like this and it doesn't matter what crazy filename is thrown at it, you won't have any trouble:

system 'file', filename

But exec and system don't return stdout, like backticks do. The former doesn't return at all, and the latter returns the return value. Here is an idiom that works like glorified array-parameter backticks in ruby:

def backtick(cmd,*args)
  IO.popen('-') {|f| f ? f.read : exec(cmd,*args)}
end

Everything you need to understand that code can be found in ri IO.popen and ri Kernel.exec. If you can think of a better name than backtick do let me know. Now our code becomes paranoid-friendly:

foo = backtick('file',filename)

While we're on the subject, a very handy method is Open3#popen3, which is a bit overkill for this glorified backticks problem but could very well simplify your life (or mine) in the future.