mudesk: A Desktop Manager

mudesk is a simple desktop manager which recognizes GNOME style .desktop files. It draws some icons on a virtual root window to interact with files in the directory $HOME/Desktop. You can download it here:

Compilation and Installation

As in my other packages, simply run If you have trouble with compiler/linker options, simply modify the script. It's pretty straightforward.

There is no installation. Just put the binary 'mudesk' somewhere permanent. There are no other files to install.


The following command line arguments are recognized:
Runs the program in a normal window which can be raised/lowered like other windows. Useful for testing mostly.
-d directory
Uses the given directory instead of ~/Desktop.
-w number
The created window will be number pixels wide. If number is negative, this will be subtracted from the width of the display. The default is to create a window as wide as the display.
-h number
Works similarly to -w, but for height.
The environment variable XDG_CONFIG_HOME is also influential. The program stores its files under the directory $XDG_CONFIG_HOME/mudesk.

Once started, it will look at the files in ~/Desktop (or the given directory with the -d option) and create some icons for them on the background of your X11 screen.

You can drag icons with the left mouse button to position them. To execute the action associated with an icon, double click it.

You can right-click on the desktop to see a menu of operations:

Refresh All
Re-scans the desktop directory and makes the necessary changes to the display
Reads the configuration once more, computes all icons afresh and then updates the display. The program is not restarted but the end effect is the same.
There are other options there as well, but they are not operational yet.

The program has no means to pass right-clicks on the window to a window manager etc. to let that program show its menu. Instead of doing that, I run it with a height slightly smaller than the display. This way, the small strip below the desktop window is the root window showing from behind and can be used to access the window manager's menu. My xinitrc looks like this:


xsetroot -solid '#222200'
export TZ
mudesk -h 980 &
exec mupanel 


Configuration is stored in a text file $XDG_CONFIG_HOME/mudesk/config. It has the following options, dimensions are in pixels, font sizes are in points.
define file_type
  array string extensions;
  string command;
  string icon;

define menu_style
  int pad_hor;  // horizontal padding to window border
  int pad_ver;  // vertical padding to window border 
  int pad_mid;  // padding between the lines of the menu
  int font_size;
  string font_name;
  int bgcolor;
  int fgcolor;
  int hilight;  // hilight color is XORed with the menu item when
                // the item is hovered 

top_level desk
  array string icon_path; // where to look for icons when they are not
                          // specified with full paths
  array file_type file_type;
  string directory_icon;  // icon to be displayed for directories
  string file_manager;    // command line for the file manager, which
                          // will be used for opening directories.
                          // something like "xfe %f" 
  int pad_mid;            // padding between the icon and its text
  int icon_size;          // 48 works best for me
  int max_width;          // maximum width allocated for text.
                          // if some text doesn't fit this, it will
                          // be truncated
  int font_size;
  string font_name;       // full path to a .ttf file
  int foreground;         // text color
  string background_image; // only PNG images
  int double_click_threshold; // in milliseconds
  int drag_threshold;     // number of pixels of mouse movement
                          // after which a drag will be recognized
  menu_style menu_style;
The file_type option can be used to teach mudesk how to open files. You can provide icons, command lines or both for each type of file. By default, mudesk tries to use "xdg-open %f" to open a file, which may do some stupid things. Here is an example of how to use this option:

   command "okular %f"
   extensions ".pdf"

   command "viewnior %f"
   extensions { ".jpg" ".gif" ".png" ".jpeg" }
   icon "/home/dodo/bin/image.png"

Usage Tips

mudesk can only process PNG icons. When you mention icons to the program, it's best to provide it with big icons so that you don't have to modify your other settings or shortcuts in case you want to change the displayed icon size. The program can scale icons down quite nicely. If you give it big icons, it will simply scale them down. If you give it small icons, it can't scale them up and will use the small icons even if your preferred icon size is bigger.

The background image also has to be in PNG format. It's best to trim down your image to the desktop window size because otherwise the program scales it down to fit the desktop and this will take some time. Even if this is a very short time, it's annoying to slow down a program for no good reason.

The program stores the state of your desktop in $XDG_CONFIG_HOME/mudesk/desk. If you make a change and don't see it applied, remove this file and restart the program: not from the right click menu, but by actually killing the process and running the program again.

For some reason, if the program seems to forget about the effects of your most recent configuration changes then it means that the program isn't writing out the cache file $XDG_CONFIG_HOME/mudesk/desk when it should. In order to force a write, simply drag an icon to a different position.

Things to Do and Bugs

Menu options 'New Shortcut' and 'Edit Shortcut' are not implemented. For them to work, I need some toolkit so that I can display some simple dialogs. There are a couple of options: The program ignores the 'Name' field in .desktop files and simply shows the name of the icon file on the desktop. This isn't very nice, but it's caused by the retarded way .desktop files are written: the key is Name[EN] or some such shit for different languages and I have to figure out the preferred language of the user. I don't need this.

The program could use the Linux inotify interface to discover when files have changed etc. instead of relying on the user to click 'refresh'. However, I don't think it's such a critical feature. My desktop rarely changes and I'm very aware of it when it does, since nothing automatic changes it. I do it manually by creating a new shortcut etc. So, clicking refresh after doing my changes is quite trivial.

Icon search algorithm could be improved, but I'd have to follow some retarded conventions set by