I've run into an annoyance on Lubuntu 11.10, described here:
I came up with a workaround, described here:
My workaround involves putting a script in /etc/pm/sleep.d to run on resume.
However, the workaround only seems to work when I suspend using pm-suspend. When I suspend by closing my laptop's lid, my workaround fails. How can I get a script to run when I resume from sleep, and that sleep was triggered by closing the lid?
I suspect this failure might be because scripts in /etc/pm/sleep.d are not getting executed when I suspend by closing the lid. Suspending with pm-suspend, then resuming by closing/opening the lid works fine. I believe Lubuntu uses xfce4-power-manager to handle suspension due to lid closing, perhaps this is important? I prefer to suspend by closing my laptop's lid, rather than typing a terminal command.
By inspecting /var/log/pm-suspend.log as suggested by andrewsomething, we can see that the reset_panel script runs on every resume, it just fails on resumes that follow lid-triggered suspends. I followed his further suggestion that I add an export statement to my script, and things are working now. The script triggers too early in the wakeup process, but that's not hard to fix. The current version of the script:
#!/bin/bash case "$1" in suspend|hibernate) #do nothing ;; resume|thaw) export DISPLAY=:0 #What does this do? Are there side effects? sleep 5 && lxpanelctl restart & #Delayed so the battery icon can finish wrecking shop. ;; *) exit 1 ;; esac exit 0
andrewsomething, if you want to post an answer, I'll accept. Thanks for the help!