The Fugue Counterpoint by Hans Fugal

6Jun/121

Code Reading on a Kindle

First, add this to your ~/.enscriptrc file:

Media: kindle 498 612 0 0 498 612

Now, here's a script (I call it kindlecode) to generate a pdf on stdout:

#!/bin/bash
enscript -Mkindle -E -p- "$@" | ps2pdf - -

Usage is something like this:

$ kindlecode *.{c,h} > /Volumes/Kindle/documents/foo.pdf

kindlecode in real life

12Oct/080

DPMS Triggers

I'm sitting here having a really hard time figuring out whether I most dislike mosquitos or GNOME's screensaver and power management.

All I want is:

  1. Standard screensaver/power management stuff: you know, pretty pictures and/or turn off the monitor after a certain amount of time.
  2. Allow me (user and/or script) to easily disable it, so that e.g. the screensaver doesn't come on in the middle of a video.
  3. Allow me (user and/or script) to easily enable the screensaver and/or power management instantly.
  4. Don't frickin' lock the screen!!!1!!

Having found GNOME screensaver and power management completely incapable of doing the latter 3, even after installing and configuring Brightside, and digging through gconf-edit for the lock settings (hint: they're there but don't seem to work), I decided to resort to disabling them and using trusty old xset.

Now, Brightside will try to use GNOME's power management and/or screensaver, so if you want to avoid locking as I do you have to bypass that by using custom actions. The custom action for instant DPMS standby is xset dpms force standby. The custom action for DPMS disable is xset -dpms and then when leaving that corner do xset dpms 600 1800 3600. xset, or some GNOME monster, has a bug where xset +dpms doesn't work. It appears to work, i.e. xset q reports that DPMS was enabled, but it doesn't actually come on unless you explicitly set them (or force standby mode).

Now, you'll also want to run that same command at the beginning of your session, so what you probably want to do is script that (so you only have to change the timeouts in one place) and call that script from Brightside as well as put it in your session startup.

Being paranoid as I am, I took gnome power management out of my session (couldn't find gnome-screensaver in the session—maybe it's launched by the power manager?). But just telling them to never come on, and bypassing them in Brightside, should be sufficient.