WRITELOOP

DMENU AS UI FOR SHELL SCRIPTS ON I3

2019 January 8

I have installed and configured i3 with the rofi launcher, instead of dmenu. Although rofi can emulate dmenu, it does quite a bit too much. In fact I have decided to have both installed, since dmenu is more adherent to the UNIX philosophy (do one thing and do it well). dmenu opens a lot of possibilities on scripting. I myself have thought on many small scripts using it here. It can read the options from STDIN (e.g. a printf command) or from a file, and in both cases a new line character is what delimiters options. To install on arch linux: $ sudo pacman -S dmenu –noconfirm Create a script, bind it to an i3 shortcut and have fun!

CHEATSHEET

  • Open the menu vertically, with a label: $ printf "anime\nsérie\ncomic" | dmenu -p 'Select an option, optionally type a filter here: ' -l 3
  • Open the menu horizontally, with a label: $ printf "anime \n série \n comic" | dmenu -p 'Select an option, optionally type a filter here: '
  • Open the menu horizontally, without any label: $ printf "anime \n série \n comic" | dmenu