nonplus .me

Launching chromium from xmonad prompt shortcuts

For some unknown reason chromium seems only to accept UTF-8 encoded urls for its cli arguments. This conflicts with xmonad which pipes ISO-8859 text when it spawns processes via shortcuts (e.g. the XMonad.Actions.Search module). To get around this you can point the default browser (xmonad uses the $BROWSER env variable in bash) to a script which uses the unix iconv program to sanitize xmonad’s text for chromium input and then launches chromium with the purified url. It also logs all the xmonad-spawned searches to a file for my future amusement.

In .bashrc:

export BROWSER="${HOME}/.chromium_opener.sh"

And .chromium_opener.sh…

Voila!