xmenu: Desktop Agnostic Menu Utility

Introduction⌗
In the past, I have detailed some of the helper programs I use with the i3
window manager. I have a new one, something that is actually really helpful for my workflow.
So far, my workflow has been entirely keyboard driven. But that doesn’t mean I hate the mouse. I really hate switching between the keyboard and mouse. So if I am just using the
mouse to click youtube videos or play a game, why would I want to reach for the keyboard to bring up rofi
?
That’s where xmenu comes in. xmenu
gives you the openbox style menu that can be navigated with either the keyboard or the mouse.

Installation⌗
Since I run arch, I was able to grab the xmenu
program off of the AUR with
yay -Syu xmenu
Otherwise you can clone the repository, enter it, and
make
sudo make install
I choose to build from source because it allows me to theme on the fly.
Usage⌗
The beauty of xmenu
is that it works like dmenu
or rofi
, and takes its options from STDIN
.
This means that by default, xmenu
does nothing. When we want to invoke it, we would pipe in the options we want, usually through a bash script for convenience.
For example, to create the example in the above gif
, simply use this script:
Each value is separated by the TAB
character. On the left is the name to be displayed, and then one tab over is the command/script to be run if that option is selected.
You can make nested menus by indenting another tab, and line breaks with empty lines. Note that nested line breaks need the appropriate number of tabs at the beginning of the line followed by nothing.
Theming⌗
If you know anything about me, it’s that I will not be happy with that lame white menu. Inside the xmenu directory, we can find a file called config.h
.
This file defines all of the colors and styles used by xmenu
. Changing this file requires a rebuild of xmenu
.
So I created a pywal
template for the config.h
file.
Every time wal
is run, a new file is created in ~/.cache/wal/
. I symlink this file to the location xmenu
, and rebuild it every time I change theme.
I use my own theming tool chameleon to handle themes. If chameleon detects xmenu
on your system, it will attempt to rebuild it on the
fly.
Look at these colors!!

polybar integration⌗
I use i3
, which doesn’t exactly have a built in mechanism for “right click desktop menu”. The author of xmenu
has another tool, xclickroot which helps with this.
However, since my windows are tiled, I rarely see the desktop anyways. That is why I integrated xmenu
into my polybar
like a traditional start menu!
In my polybar
config, I have the following module:
[module/xmenu-left]
type = custom/script
click-left = /home/gideon/dotfiles/dotfiles/scripts/xmenu-left-monitor.sh
click-right = /home/gideon/dotfiles/dotfiles/scripts/xmenu-left-monitor.sh
exec = /home/gideon/.config/polybar/scripts/xmenu-button.sh
format-foreground = ${colors.color4}
tail = true
interval = 90
I have three almost identical modules, one for each of my monitors. The reason for this is that each monitor calls a different xmenu
script, which tells xmenu
to position
itself below the bar of that display.
The script xmenu-button.sh
is dead simple, and can remain consistent across all modules if you like. It simply echoes out the character you want to click on in polybar
.
You can slap pretty much anything in there, but I like to use FontAwesome icons because that’s what the rest of my bar uses.
My config⌗
Here is the ENTIRE xmenu
script I have at the moment for my bars. Note the invocation of xmenu
.
xmenu -i -p 0x25:1
-i
tellsxmenu
to remove the space for icons-p
tellsxmenu
to use a specific position0x25
the coordinates that place xmenu below my bar (25px down):1
on screen one
Feel free to take inspiration!
Conclusion⌗
Good job for making it this far. If you followed along, you should have a desktop environment agnostic menu utility with infinite potential!