The Linux Moderate

One Man Standing Up for Computers That Get Work Done

Transforming Xubuntu into DBCOS

with 3 comments

Part 3: Editing the IceWM Menu

We’ve installed the Ice Window Manager or IceWM, and we’ve made it start up with the GTK theme we chose (and in my case with the Network Manager applet so that I can connect to wireless).

Now it’s time to attack that mostly useless IceWM menu. By the time we’re through with it, we’ll have a menu that’s as useful and well-designed as any XFCE, KDE, or Gnome menu, and we’ll have done it by editing a text file.

Please don’t run away screaming. I hate editing configuration files as much as you do, but this one is really easy.

Part of what makes it easy is that IceWM is very tolerant of mistakes. If it comes across something it doesn’t understand in a configuration file, it doesn’t give you an error message and freeze. It just skips what it doesn’t understand and goes on to the next thing it does understand. For a mid-Clintonian window manager, it’s actually pretty smart.

So, for example, we can stuff our menu with programs that we haven’t even installed yet. If IceWM doesn’t find a program where it should be in your computer, it simply skips it and won’t put it in the menu. Later, when you do install that program, it will appear in the menu the next time you start IceWM.

The menu is controlled by a text file called menu that will live in your .icewm folder—the folder we bookmarked. There’s a master menu file in /etc/X11/icewm, but any menu file you create will override it.

To add a program to the menu, all you have to do is add a line to the text file like this:

prog Blah blah blah

Or, to explain it in more detail,

prog “Name of Program as You Want It to Appear in the Menu” icon-filename program-command

Often the name of the program, the name of the icon, and the program command are the same. So, for example, to add Mousepad to the menu, we can add a line like this:

prog Mousepad mousepad mousepad

Sometimes the icon doesn’t have the same name as the program, and sometimes you might not want to use the icon that comes with the program. For those cases, it’s useful to know where the icons live. There are two good folders to know:

/usr/share/pixmaps

and

/usr/share/icons

The pixmaps folder has icons for most of the programs installed on your computer. Unless you specify a path, IceWM looks for an icon in the pixmaps folder. The icons folder has more general icons for system functions and the like; there’s a separate folder of icons for each icon theme you have installed.

If the icon you’ve named doesn’t exist, IceWM just won’t put an icon next to that item in the menu. Everything else will still work.

Now, I could go on and on to explain how the menu works, but I think it’s much easier to learn by example. So I’m giving you Dr. Boli’s Celebrated Menu File, the menu that goes with Dr. Boli’s Celebrated Operating System. I’ve stuffed it full of explanatory notes. Feel free to copy the menu into a text file and save it as “menu” in your .icewm folder.

# DR. BOLI'S CELEBRATED MENU FILE.
#
# The master menu lives in /etc/X11/icewm.
# A menu file in $HOME/.icewm will override it.
# Thus it's easy to have a customized menu for each user
# by creating a folder called .icewm in each user's
# home folder and placing the user's menu file there.
#
# Lines that begin with a pound sign are comments
# and will not be part of the menu.
#
# This example menu file is designed to be well organized,
# while still keeping every common program only two clicks
# away from the menu button.
#
# To add a program to the menu, just add a line like this:
#
# prog "Name of Program as You Want It to Appear in the Menu" icon-filename program-command
#
# Unless you specify a path, IceWM looks for icons in /usr/share/pixmaps.
# Often these icons bear the same name as the programs they represent,
# so a typical menu entry might look like this:
#
# prog Mousepad mousepad mousepad
#
# Note that quotation marks aren't necessary if the name of the program is
# only one word, and that you need not include the extension of the
# icon filename.
#
# Other icons may be found in /usr/share/icons.
#
# If a program isn't found on your system, it simply won't appear
# in the menu.
#
# My menu begins with an item that launches an "About" page:

prog "About DBCOS" /home/christopher/Pictures/boli-icon-26.png kazehakase http://drboli.wordpress.com/2008/06/02/release-announcement/

# To add a rule, simply add the word "separator" (note that the dashes after
# the pound sign have no effect; they simply make it more obvious to me where
# I've put a separator in this file):

separator #---------------------------------------------------------
separator #---------------------------------------------------------

# The programs I use most often go here at the top of the menu:

prog "File Manager" /usr/share/icons/gnome/16x16/places/gnome-fs-home.png pcmanfm
prog "Web Browser" /usr/share/pixmaps/kaze_icon.xpm kazehakase
prog "OpenOffice.org" /usr/share/icons/gnome/16x16/apps/openofficeorg24-writer.png ooffice

separator #---------------------------------------------------------
separator #---------------------------------------------------------

# Now we add a submenu. A brief glance at the following example should be enough
# explanation. Don't forget the opening and closing brackets.

menu "Desk Accessories" folder {
    prog "PCman File Manager" /usr/share/pcmanfm/icons/folder.png pcmanfm
    prog "Thunar File Manager" /usr/share/pixmaps/Thunar/Thunar-fallback-icon.png thunar
    prog "XFE File Manager" xfe xfe
    separator #-------------------------------------------------
    prog Calculator gcalctool xcalc
    prog "Character Map" /usr/share/icons/gnome/16x16/apps/gucharmap.png gucharmap
    prog gcalctool gcalctool gcalctool
    prog Magnify /usr/share/icons/gnome/16x16/actions/viewmag+.png xmag
    prog Mousepad mousepad mousepad
    prog "Network Applet" /usr/share/icons/gnome/16x16/categories/preferences-system-network.png nm-applet
    prog "Screenshot in 5 Seconds" login-photo scrot -d 5
    prog Terminal xterm x-terminal-emulator -ls
    prog xterm xterm xterm -ls
}

separator #---------------------------------------------------------

prog "Package Manager" /usr/share/synaptic/pixmaps/synaptic_32x32.xpm /bin/sh -c "/usr/bin/gksu /usr/sbin/synaptic"

# ------------------------------------------------------------------
# The Games menu, which includes the games that come with Xubuntu,
# is divided into submenus because there are so many games.
# I haven't changed the default menu in this section.
# ------------------------------------------------------------------

menu "Games" folder {
    menu "Action" folder {
        prog    "Gnibbles" /usr/share/pixmaps/gnibbles.xpm /bin/sh -c "/usr/games/gnibbles"
    }
    menu "Blocks" folder {
         prog    "Gnometris" /usr/share/pixmaps/gnometris.xpm /bin/sh -c "/usr/games/gnometris"
    }
    menu "Board" folder {
        prog    "Four-in-a-row" /usr/share/pixmaps/gnect.xpm /bin/sh -c "/usr/games/gnect"
        prog    "GL Chess" /usr/share/pixmaps/glchess.xpm /bin/sh -c "/usr/games/glchess"
        prog    "Gnome GYahtzee" /usr/share/pixmaps/gtali.xpm /bin/sh -c "/usr/games/gtali"
        prog    "Gnome Iagno" /usr/share/pixmaps/iagno.xpm /bin/sh -c "/usr/games/iagno"
        prog    "Gnome Lines" /usr/share/pixmaps/glines.xpm /bin/sh -c "/usr/games/glines"
        prog    "Gnome Mahjongg" /usr/share/pixmaps/gnome-mahjongg.xpm /bin/sh -c "/usr/games/mahjongg"
    }
    menu "Card" folder {
        prog    "Gnome Blackjack" /usr/share/pixmaps/blackjack.xpm /bin/sh -c "/usr/games/blackjack"
        prog    "Gnome FreeCell" /usr/share/pixmaps/freecell.xpm /bin/sh -c "/usr/games/sol --variation freecell"
        prog    "Gnome Solitaire Games" /usr/share/pixmaps/aisleriot.xpm /bin/sh -c "/usr/games/sol"
    }
    menu "Puzzles" folder {
        prog    "Gnome Klotski" /usr/share/pixmaps/gnotski.xpm /bin/sh -c "/usr/games/gnotski"
        prog    "Gnome Robots" /usr/share/p/usr/share/icons/gnome/16x16/appsixmaps/gnobots2.xpm /bin/sh -c "/usr/games/gnobots2"
        prog    "Gnome Sudoku" /usr/share/pixmaps/gnome-sudoku.xpm /bin/sh -c "/usr/games/gnome-sudoku"
        prog    "Gnome Tetravex" /usr/share/pixmaps/gnotravex.xpm /bin/sh -c "/usr/games/gnotravex"
        prog    "Gnomine" /usr/share/pixmaps/gnomine.xpm /bin/sh -c "/usr/games/gnomine"
        prog    "Same Gnome" /usr/share/pixmaps/gsame.xpm /bin/sh -c "/usr/games/same-gnome"
    }
    menu "Toys" folder {
        prog    "Oclock" - /bin/sh -c "oclock"
        prog    "Xclock (analog)" - /bin/sh -c "xclock -analog"
        prog    "Xclock (digital)" - /bin/sh -c "xclock -digital -update 1"
        prog    "Xeyes" - /bin/sh -c "xeyes"
        prog    "Xlogo" - /bin/sh -c "xlogo"
    }
}
# ------------------------------------------------------------------------

menu Graphics folder {
    prog Fontforge /usr/share/icons/gnome/16x16/actions/format-text-italic.png fontforge
    prog Gimp gimp gimp
    prog GPicView gpicview gpicview
    prog GQview gqview gqview
    prog Inkscape inkscape inkscape
    prog "OpenOffice Draw" /usr/share/icons/gnome/16x16/apps/openofficeorg24-draw.png oodraw
    prog Pencil pencil pencil
    prog "Ristretto Image Viewer" ristretto ristretto
}

menu "Internet" folder {
    prog Claws-mail claws-mail claws-mail
    prog Thunderbird thunderbird thunderbird
    separator #------------------------------------------------------
    prog Dillo /usr/share/icons/gnome/16x16/stock/net/stock_internet.png dillo
    prog Epiphany /usr/share/icons/gnome/16x16/stock/net/stock_internet.png epiphany
    prog Firefox /usr/share/pixmaps/firefox-3.0.png firefox
    prog Galeon galeon galeon
    prog Kazehakase /usr/share/pixmaps/kaze_icon.xpm kazehakase
    prog Konqueror konqueror konqueror
    prog Midori /usr/share/icons/gnome/16x16/stock/net/stock_internet.png midori
    prog Netsurf netsurf netsurf
    prog Opera opera opera
    separator #------------------------------------------------------
    prog Transmission transmission transmission
}

menu "Office" folder {
    prog AbiWord abiword abiword
    prog "Gnumeric Spreadsheet" gnome-gnumeric.png gnumeric
    prog "OpenOffice.org" /usr/share/icons/gnome/16x16/apps/openofficeorg24-writer.png ooffice
}

menu "Sound & Video" folder {
    prog "Volume Control" /usr/share/icons/gnome/16x16/apps/volume-knob.png gamix
    separator #-------------------------------------------------
    prog Totem totem totem
    prog VLC vlc vlc
    separator #-------------------------------------------------
    prog "Denemo Score Editor" denemo denemo
    prog "NtEd Score Editor" nted nted
    prog "Burn CD" /usr/share/icons/gnome/16x16/devices/media-optical.png brasero
}

separator #---------------------------------------------------------

menu System folder {
    prog "Shut Down Misbehaving Program" /usr/share/icons/gnome/16x16/actions/gtk-close.png xkill
    separator #-------------------------------------------------
    prog "Burn CD" /usr/share/icons/gnome/16x16/devices/media-optical.png brasero
    prog "Check for Updates" update-manager update-manager
    prog "Xfce Application Finder" /usr/share/pixmaps/xfce4-appfinder.xpm /bin/sh -c "xfce4-appfinder"
    separator #-------------------------------------------------
    menu "Window Managers" folder {
        restart "FluxBox" - /bin/sh -c "/usr/bin/startfluxbox"
        restart "IceWM" /usr/share/icewm/icons/icewm_16x16.xpm /bin/sh -c "/usr/bin/icewm"
    }
}
menu Utilities folder {
    menu Multimedia folder {
            prog XPlayCD xplaycd xplaycd
            prog XMixer xmixer xmixer
    }
    prog "Font Selector" xfontsel xfontsel
    prog Clock xclock xclock
    prog Magnify xmag xmag
    prog Calculator xcalc xcalc
    prog Colormap xcolormap xcmap
    prog Clipboard xclip xclipboard
    prog "Screen Saver" xlock xlock -nolock
    prog "Screen Lock" xlock xlock
}
separator
#
# The items that appear below here are controlled by your
# "preferences" file. I recommend ShowProgramsMenu=0 to
# turn off the "Programs" menu once you've set up your
# menu file the way you like it.

Once you’ve put this menu in your .icewm folder, your menu will look something like this:

Although we’ve put nine different Web browsers in our menu, the only one we have installed is Firefox, so that’s the only one that appears in the menu. Pretty smart, huh?

Now we have an installation of IceWM that’s actually useful. The menu can launch any of the programs we’re likely to use. But we can still make our system a lot more useful. In the next installment, we’ll make a toolbar that’s actually helpful, and after that we’ll look into the preferences file.

Correction: In an earlier version of this article, I told you to make the menu file executable. Actually, you don’t have to do that. The startup file needs to be executable, but the menu will work even if it’s not executable. No harm done if you did make it executable, but it’s not necessary.

Advertisements

Written by cbaile19

August 5, 2008 at 10:47 pm

3 Responses

Subscribe to comments with RSS.

  1. […] really usable. But there’s still one more important step before it’s really useful. The next thing we have to do is attack the IceWM […]

  2. […] just finished editing the IceWM menu. Now on to the toolbar, and then the […]

  3. […] the way, if you used the sample menu and toolbar file I gave you, when you restart IceWM all our newly installed applications will […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: