dmenu - the lightweight, efficient app launcher

dmenu is a dynamic menu for X, originally designed for dwm. It manages large numbers of user-defined menu items efficiently. - http://tools.suckless.org/dmenu/. Simply put, dmenu is an extremely lightweight, text based application launcher. If you are familiar with gnome-do, launchy or the standard run dialog (alt+f2), dmenu provides similar functionality with less of a footprint. For a screenshot of dmenu in action see here. dmenu is a small script that, when ran, displays a thin list of applications across the screen. You can type or arrow to the item you wish to launch and press enter to launch the application. I realize dmenu may not be for everyone but it is unique (and well suited for me/a minimalist) in two ways:

  • lightweight - demu is not a background process, rather it is available (started) when you invoke/need it so it takes no resources unless you need it
  • simple - dmenu is simple yet flexible, it is command line based, very quick, and very flexible

dmenu allows you to launch commands quickly by invoking dmenu and simply typing a few characters. For example, if I want to start firefox I simply hit SUP+Space (see keybinding section for more info on shortcut key), type fir and hit enter. That is it, firefox will start as normal. A few more examples:

  • launch skype: SUP+Space followed by: skype
  • launch synaptic with sudo privileges: SUP+Space followed by: gksu synaptic
  • launch thunar, starting in your home/bin directory: SUP+Space followed by: thunar /home/drad/bin

Starting dmenu Quickly

dmenu needs to be started each time you wish to use it and while you can simply run 'dmenu_run' from a terminal, the run dialog, or any other app launcher this kind of defeats the purpose of dmenu. Most users want a shortcut key to start dmenu quickly and then use dmenu to start the application you are looking for. There are several ways to do this, all dependent upon your desktop manager. I typically run xfce or openbox so I'll provide a method for creating a shortcut key for each:

  • XFCE - open the Settings Manager (Menu>Settings>Settings Manager) and go to the Keyboard settings item. In the Keyboard settings dialog, select the Application Shortcuts tab and do the following:
    • click the add button to add a new shortcut
    • in the command box, enter "dmenu_run" (no double quotes) and click ok
    • next the command shortcut dialog will appear, hold the Super (Windows) Key down and press the Spacebar
    • You are all set, now when you press Super + Spacebar dmenu will be started
  • OpenBox -
  • open your rc.xml file in a text editor and add a new keybind element such as follows: <keybind key="S-space"> <action name="Showdmenu"> <menu>dmenu_run</menu> </action> </keybind>
  • restart openbox

Installation

dmenu can be installed through most package managers; however, I've notices some differences depending on the distribution/version/repo. Generally if you search for dmenu you should find it in suckless-tools along with a few other small/useful apps. Simply install suckless-tools and you will get demu. I've also notices dmenu in the i3 or dwm packages, so long as you get dmenu and dmenu_run you should be ok. Another option is to get it from the maintainer, suckless.org.

Customize dmenu Look

dmenu's background, foreground, font, color can all be customized to your liking. See the dmenu man page for all of the options. I've also provided my customizations below as an example:

  • dmenu_run -p drad$ -nb '#000000' -nf '#FFFFFF' -sb '#848484' -sf '#000000'
  • see attached screenshot for how it looks

Fix dmenu Dual Open Issue

There is an issue with dmenu (at least my instances) where dmenu will open after closing an app launched with dmenu. For instance, use dmenu to open feh, feh opens as normal, use feh, upon exit of feh dmenu is opened again (automatically). This is rather odd and confusing as if you are not looking for dmenu to be open it appears your session is froze (mouse clicks dont work, cannot type into anything other than dmenu box, etc.). This appears to be a known issue in how dmenu is launched. The fix I found is simple and as follows:

  • modify your dmenu-bind.sh script (usually located in ~/.config/dmenu/dmenu-bind.sh) to execute dmenu as follows (note: I have commented out the original line to provide a reference):
    • #!/bin/bash
      
      #exe=`dmenu_run | dmenu -nb '#000000' -nf '#d8d8d8' -sb '#d8d8d8' -sf '#000000'` && eval "exec $exe"
      
      exe=`dmenu_run -nb '#000000' -nf '#d8d8d8' -sb '#d8d8d8' -sf '#000000'` && eval "exec $exe"

Now dmenu should behave normally upon launching and exiting applications.

More Info

The following links provide more info on dmenu: