Difference between revisions of "Dmenu"

From ArchWiki
Jump to: navigation, search
(added i18n)
m (link to the French page)
 
(94 intermediate revisions by 48 users not shown)
Line 1: Line 1:
[[Category:Utilities (English)]]
+
{{DISPLAYTITLE:dmenu}}
[[Category:HOWTOs (English)]]
+
[[Category:Application launchers]]
 +
[[Category:Suckless]]
 +
[[da:Dmenu]]
 +
[[es:Dmenu]]
 +
[[fr:Dmenu]]
 +
[[ja:Dmenu]]
 +
[[zh-hans:Dmenu]]
 +
{{Related articles start}}
 +
{{Related|List of applications/Other#Application launchers}}
 +
{{Related articles end}}
  
{{i18n_links_start}}
+
[http://tools.suckless.org/dmenu dmenu] is a fast and lightweight dynamic menu for X. It reads arbitrary text from stdin, and creates a menu with one item for each line. The user can then select an item, through the arrow keys or typing a part of the name, and the line is printed to stdout. dmenu_run is a wrapper that ships with the dmenu distribution that allows its use as an application launcher.
{{i18n_entry|English|Dmenu}}
 
{{i18n_entry|Español|Dmenu (Español)}}
 
{{i18n_entry|简体中文|Dmenu (简体中文)}}
 
{{i18n_links_end}}
 
  
= Introduction =
+
== Installation ==
  
dmenu is a fast and lightweight dynamic menu launcher for X.  It can be compared to 'Quicksilver' on OS X, or 'Launchy' on Windows.  With a quick keystroke, the dmenu menu appears, enabling you to type the name of a program you wish to start.
+
[[Install]] the {{Pkg|dmenu}} package, or {{AUR|dmenu-git}} for the development version.
  
= Installation =
+
Various patched variants exist which extend dmenu's default functionality. Consider installing one of the following packages from the [[AUR]]:
  
Installing dmenu is simple:
+
* {{AUR|dmenu2}}: dmenu fork with many useful patches applied and additional capabilities added including dimming, specifying a custom opacity, and underlining.
pacman -S dmenu
 
  
Once it is installed, you will need to create a shell script to run it.  The following script presents some common defaults:
+
You may run ''dmenu'' with:
#!/bin/sh
 
$(dmenu_path | \
 
dmenu -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*' \
 
-nb '#000000' -nf '#FFFFFF' -sb '#0066ff')
 
  
Save the script somewhere (~/bin is a good choice) and make it executable.
+
$ dmenu_run
  
= Configuration =
+
== Configuration ==
Now, you will need to attach that shell script to a keystroke combination.  This can be done either via your window manager or desktop environment configuration, or with a program like xbindkeys.  See the [[Hotkeys]] article for more information.
 
  
= Additional Resources =
+
Now, you will want to attach the {{Ic|dmenu_run}} command to a keystroke combination. This can be done either via your window manager or desktop environment configuration, or with a program like {{Pkg|xbindkeys}}. See the [[Hotkeys]] article for more information.
* [http://www.suckless.org/programs/dmenu.html Dmenu] - The official dmenu website
+
 
 +
=== Displaying Custom Items ===
 +
Custom items may be shown by piping them into ''dmenu''. For example:
 +
 
 +
$ echo -e "first\nsecond\nthird" | dmenu
 +
 
 +
=== Manually Adding Items ===
 +
''dmenu'' will look for executables in the directories defined in your {{ic|$PATH}}. For information on modifying your {{ic|$PATH}} see [[environment variables]].
 +
 
 +
=== Fonts ===
 +
 
 +
{{Out of date|Since dmenu 4.6 XFT font rendering is enabled by default: [http://lists.suckless.org/dev/1511/27503.html 4.6 Release Notes]. Specifying fonts via [[wikipedia:XLFD|X logical font description]] does not work anymore. Instead {{Pkg|fontconfig}}'s [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html font.conf syntax] is used.}}
 +
 
 +
''dmenu'' can display fonts using the [[wikipedia:XLFD|X logical font description]] as found using the tool ''xfontsel'', which is provided by {{Pkg|xorg-xfontsel}}. This example will run dmenu using the {{Pkg|terminus-font}}:
 +
 
 +
$ dmenu_run -fn "-xos4-terminus-medium-r-*-*-14-*"
 +
 
 +
The syntax is similar if using a ''dmenu'' variant patched with XFT support.
 +
 
 +
$ dmenu_run -fn 'Droid Sans Mono-9'
 +
 
 +
=== Support for shell aliases ===
 +
''dmenu'' does not support [[Bash#Aliases|shell aliases]]. To have ''dmenu'' recognize your aliases, [[install]] the {{AUR|dmenu-recent-aliases}}{{Broken package link|{{aur-mirror|dmenu-recent-aliases}}}} package  from the [[AUR]] and run {{ic|dmenu_run_aliases}}. Your aliases must be in either {{ic|~/.bash_aliases}} or {{ic|~/.zsh_aliases}} to be recognized by ''dmenu_run_aliases''.
 +
 
 +
== Troubleshooting ==
 +
 
 +
=== No locale support ===
 +
 
 +
Running ''dmenu_run'' results in the following error message:
 +
 
 +
{{hc|$ dmenu_run|
 +
no locale support
 +
}}
 +
 
 +
Make sure that the environment variable {{ic|LANG}} is correctly set. See the following for more information: [[Locale#Troubleshooting]]
 +
 
 +
=== Missing menu entries ===
 +
 
 +
If certain entries are missing from ''dmenu'', the cache may be malformed. Delete it and restart ''dmenu''.
 +
$ rm ~/.dmenu_cache
 +
$ rm ~/.cache/dmenu_run
 +
Note that there will most likely be only one cache file, depending on if {{ic|$XDG_CACHE_HOME}} is set. See the contents of {{ic|/usr/bin/dmenu_run}} for more information.
 +
 
 +
=== Environmental Variables ===
 +
 
 +
Environmental variables needed for applications should instead be added to {{ic|/etc/environment}}.
 +
 
 +
== See also ==
 +
* [http://tools.suckless.org/dmenu dmenu] – The official dmenu website
 +
* [https://bbs.archlinux.org/viewtopic.php?id=80145 Dmenu Hacking thread ] – Dmenu hacking thread in arch linux forums. An overview of scripts is provided in the [https://github.com/orschiro/dmenu-scripts-collection dmenu_scripts collection].

Latest revision as of 07:12, 26 October 2018

dmenu is a fast and lightweight dynamic menu for X. It reads arbitrary text from stdin, and creates a menu with one item for each line. The user can then select an item, through the arrow keys or typing a part of the name, and the line is printed to stdout. dmenu_run is a wrapper that ships with the dmenu distribution that allows its use as an application launcher.

Installation

Install the dmenu package, or dmenu-gitAUR for the development version.

Various patched variants exist which extend dmenu's default functionality. Consider installing one of the following packages from the AUR:

  • dmenu2AUR: dmenu fork with many useful patches applied and additional capabilities added including dimming, specifying a custom opacity, and underlining.

You may run dmenu with:

$ dmenu_run

Configuration

Now, you will want to attach the dmenu_run command to a keystroke combination. This can be done either via your window manager or desktop environment configuration, or with a program like xbindkeys. See the Hotkeys article for more information.

Displaying Custom Items

Custom items may be shown by piping them into dmenu. For example:

$ echo -e "first\nsecond\nthird" | dmenu

Manually Adding Items

dmenu will look for executables in the directories defined in your $PATH. For information on modifying your $PATH see environment variables.

Fonts

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: Since dmenu 4.6 XFT font rendering is enabled by default: 4.6 Release Notes. Specifying fonts via X logical font description does not work anymore. Instead fontconfig's font.conf syntax is used. (Discuss in Talk:Dmenu#)

dmenu can display fonts using the X logical font description as found using the tool xfontsel, which is provided by xorg-xfontsel. This example will run dmenu using the terminus-font:

$ dmenu_run -fn "-xos4-terminus-medium-r-*-*-14-*"

The syntax is similar if using a dmenu variant patched with XFT support.

$ dmenu_run -fn 'Droid Sans Mono-9'

Support for shell aliases

dmenu does not support shell aliases. To have dmenu recognize your aliases, install the dmenu-recent-aliasesAUR[broken link: archived in aur-mirror] package from the AUR and run dmenu_run_aliases. Your aliases must be in either ~/.bash_aliases or ~/.zsh_aliases to be recognized by dmenu_run_aliases.

Troubleshooting

No locale support

Running dmenu_run results in the following error message:

$ dmenu_run
no locale support

Make sure that the environment variable LANG is correctly set. See the following for more information: Locale#Troubleshooting

Missing menu entries

If certain entries are missing from dmenu, the cache may be malformed. Delete it and restart dmenu.

$ rm ~/.dmenu_cache
$ rm ~/.cache/dmenu_run

Note that there will most likely be only one cache file, depending on if $XDG_CACHE_HOME is set. See the contents of /usr/bin/dmenu_run for more information.

Environmental Variables

Environmental variables needed for applications should instead be added to /etc/environment.

See also