I have the desire to run a script as the logged in user immediately before a hibernate (suspend to disk) operation, and immediately after a resume with KDE4.
I know that I can put a script in
/etc/pm/sleep.d that will do this, but such a script must be non-interactive, and will run as root.
I need this script to run as a the user logged in to KDE, and the post-resume script would ideally be interactive.
I can see where I can run a script on suspect in KDE, but it's imperfect:
System Settings -> Power Management -> Advanced Settings -> Configure Notifications
This allows me to specify a command to run on resume, however...
- It doesn't appear to distinguish between Suspend to RAM and Suspend to disk (alone, not a deal breaker, but I really only need to run my command on suspend-to-disk)
- It doesn't have any option to run a script on resume, which is actually the most important part I need.
Ultimately, what I'm trying to accomplish is to auto un-mount my Windows partition when I hibernate, so that the filesystem will be consistent whenever I boot into Windows. This is best done as the user, and with interaction, because the partition is encrypted with TrueCrypt, and I prefer entering the passphrase after resuming, rather than having it stored on the filesystem.
I do realize that I can automate much of this if I'm willing to run as root, and non-interactively, so please don't suggest these as alternatives. I may end up doing that, but that's not what this question is about.