Running scripts on resume, after moving to pm-utils
I had a couple of annoyances with suspend in my laptop, namely that the screen would not lock prior to suspending (this seems to be #407224), and that sound would not work after resume (this seems to be an ALSA driver bug; muting and unmuting Master and PCM solves the issue).
For this latter problem, I just wanted to drop a script somewhere to do the mute/unmute dance on resume automatically, but I was a bit lost as to where to put it. (Or, rather, I thought I’d be a bit lost even if I investigated.)
Anyway, I recently moved to pm-utils from powersaved, since that’s
what my kpowersave recommends first, and not only now my screen gets
locked properly, but there is somewhat clear documentation as to
where to put such scripts: /etc/pm/sleep.d. So I now have there a
script like:
case "$1" in
thaw|resume)
amixer -q sset Master mute
amixer -q sset Master unmute
amixer -q sset PCM mute
amixer -q sset PCM unmute
;;
*)
;;
esac
I only miss one thing: in my old suspend to disk scheme, the computer would change to a console where progress about the operation would be reported. Now it’s just a blank console. Guess it’s time to investigate again. (But overall I’m happy about the move.)