The Gregory Jay Blog



5 Uses for Dmenu

Dmenu is a menu produced by Suckless. It can be used as an application launcher, as a search bar, as a menu, a list or as a place for user input. It first came to my attention a few years ago when I started using i3. I used it as the application launcher. As I realised the power that can come from scripting with dmenu, I started changing my scripts to use dmenu. Where before I would have to open a terminal to run a script that required user input now dmenu handled that. I could call these commonly used scripts with a keybinding instead.

In this post I'm going to show 5 of my most commonly used scripts using dmenu, it might give someone some ideas of something they could implement.

1. Password Manager

I have long since done away with using a password manager in preference to using my own. It is completely customised to what I need and if I do need a new function, I can't create it easily.

I use a sqlite database locked in a veracrypt (updated only recently from truecrypt lol) container. I have a usb with a keypass file so that whenever the usb is plugged in I can access my passwords (though the container remains locked, it only gets decrypted for the split second it takes to query the database.)

Now Dmenu takes care of all the user input for me, no need for opening a terminal, no need fo positional perameters. Dmenu shows me the sites I have saved and I can search for the one I want. I can select the username I need the password for and it coppies it to my clipboard (with xclip.) Within 3 seconds I can decrypt, select and paste my password with minimal interuption to my work flow. And when I pull out the USB drive everything is safe as houses!

2. MPD

One of the quick ways I like to select a song or album to play is using dmenu as an input for the 'mpc find' command. The results get piped back into dmenu and I can choose a song which is piped back into mpc add or mpc insert; mpc play.

This is the best option I have found to find a song quickly, again it takes only a few seconds and as the results are also searchable you can find songs even if you can't remeber the exact name.

3. Bookmarks

Bookmarks was always something I wanted to improve. Changing browsers and computers so often, it was always difficult to have everything synced. And organising my bookmarks so that they weren't a huge hassle to find a site was also an ongoing problem. I wanted something simple, where I could see all my bookmarks and not have to break my workflow everytime I wanted to find a bookmarked site.

I wanted all my bookmarks available to me everytime I opened a new tab. This was the quickest, most accessible and most efficient use of my bookmarks I could think of.



I use dmenu to add or delete bookmarks. All of them are then saved into a SQLite database for quick retrival. This way I can add extra information such as notes and categories with my bookmarks and query the database filtering the selection with category etc if needed.

4. GTD

I have used GTD for nearly a decade and a half now and have used many different systems. Paper and pen, online platforms offline solutions, phone apps etc etc. Though I have used some of these systems happily for years they never suited exactly what I wanted from a GTD app. So I made my own. Based on the todo.txt protocol I created a dmenu script that fulfills everything I could want from a GTD system. It's there on all my machines including my phone and helps me drive my day's productively while also allowing me to be reflective when needed.

5. Keybindings

Keybinding are a necessity for me. But I do tend to forget exactly which keybinding does what if I havent used it for a while. For example I rarely take screenshots so whenever I do need to take a screenshot I have forgotten the keybinding and end up having to search through my config files.

And so I created a keybinding reminder sheet accessible at all times with dmenu. This is just a text file piped into dmenu. How do I remember the keybinding for the reminder sheet? It's mod F1 (F1 was always the help button in windows.)

I Hope these may give someone some inspiration. All my code is availble on my Github.

Greg is a true Sinophile, fluent in Chinese and proficient in Tibetan he is a homeschooling Dad that also consults on the side. You'll often find him cigar in mouth, book in hand, waiting for someone to finish their work or for the coffee to brew.