Small Tools

dmenu_wifi

dmenu is super cool. I'm pretty comfortable saying it's my favorite piece of software. It takes a list of lines from stdin, creates a menu out of them, and writes the user's selection to stdout. You can use it to do basically anything.

In this case, I was looking for a simple way to connect to wi-fi networks without NetworkManager, which, for whatever reason, simply did not work on my machine when I was setting it up. This script is really just a list of the commands I would run to connect manually with wpa_supplicant.

I've tried to keep it as narrowly POSIX as possible, given the obvious constraint that it has to use commands specific to wi-fi hardware, and, of course, dmenu (which requires the password patch to work properly with this script). The packages it requires are pretty common and usually ship standard (although I don't think iw comes standard on Arch).

Probably my biggest issue with it is that a lot of the wi-fi commands have to be run as root. If there's a clean fix for this using a udev rule or something like that, I haven't found it, so I just carve out a password exception for it in /etc/sudoers so I can bind it to a key.