Postscript formatted man pages

man and its troff formatting can be asked to produce postscript output. Define a Bash function, e.g. in your .bashrc:

function psman () {
    SLUG=$(echo $@ | tr ' ' '-')
    set -o pipefail
    man -t "$@" | ps2pdf - "$FNAME" && \
      nohup evince "$FNAME" >/dev/null 2>/dev/null
    set +o pipefail

(I tried to do this without tempfiles, using process substitution, but failed. Anyone got better Bash-fu?)

The man -t is the crucial part. It tells man to produce output in postscript format, which ps2pdf can read, and evince displays the PDF. We disconnect the evince process using nohup, so that it lives on even if we kill the terminal. We `set -o pipefail` so that if `man` fails, the exit code is preserved as the exit of `man|ps2pdf`, which causes the `&&` to short-circuit, preventing evince from being run on an empty pdf document. We restore `+o pipefail` again at the end.

Then, from the command line:

$ psman tr


Rhythmbox plugin: "Announce"

I use the Linux music player "Rhythmbox". This morning I wrote a plugin for it, called "Announce":

Every time a new song starts to play, it announces the title using speech synthesis. I like it when I'm listening to some new music I'm not familiar with, but am away from the computer. Then I can still know which track is which.

If the album or artist names are different from the previous track, then it includes those in the announcement, too.