XMenu



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.

Xmenu is also quite gifted with alien technology, building spacecraft's out of Earthly materials, making genetic clones of old creatures, and conversion devices that turn people into members of. XMenu is an unobtrusive status bar utility designed to provide quick access to your Applications directory: the app adds an icon to the right side of the status bar, allowing you to launch any utility in no time. In addition, you can also choose to include other locations in order to further optimize your workflow.

Xmenu Download

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 themouse 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.

Since I run arch, I was able to grab the xmenu program off of the AUR with

Otherwise you can clone the repository, enter it, and

I choose to build from source because it allows me to theme on the fly.

The beauty of xmenu is that it works like dmenu or rofi, and takes its options from STDIN.

Xmenu App

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 linefollowed by nothing.

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 thefly.

Look at these colors!!

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:

I have three almost identical modules, one for each of my monitors. The reason for this is that each monitor calls a differentxmenu script, which tells xmenu to positionitself below the bar of that display.

XMenu

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.

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 tells xmenu to remove the space for icons
  • -p tells xmenu to use a specific position
  • 0x25 the coordinates that place xmenu below my bar (25px down)
  • :1 on screen one

Feel free to take inspiration!

Good job for making it this far. If you followed along, you should have a desktop environment agnostic menu utility with infinite potential!