Subject: Re: Hotkey support via powerd
To: Jared D. McNeill <firstname.lastname@example.org>
From: Sverre Froyen <email@example.com>
Date: 12/22/2007 10:59:33
On Saturday 22 December 2007, Jared D. McNeill wrote:
> Heyas folks --
> The following is a patch I'm using to allow hotkeys to be passed from a
> device driver through to powerd. I'm using it for eg. automatically
> locking my screen when I press Fn+F2, and invoking xrandr to change my
> outputs when I press Fn+F7 on this Thinkpad.
I think this will work great. Looks like a powerd script named hotkey_button
is called, with an argument like display-cycle etc.
In other comments, I have seen concerns about how users can tap into these
events. Here are my thoughts on that:
My initial thought was that users who want to run commands when a button is
pressed could simply create their own hotkey_button, acadaptor, etc. scripts
and the scripts in /etc/powerd/scripts could be modified to call the user
scripts for any logged in user (with a suitable change of userid/groupid, of
course). That would work fine for my situation (a personal laptop).
I can see that hardcoding the user script names could be considered awkward,
however. A slightly more general solution might be a user .powerd
(.powerdrc?) user file that provides the script names. This file could be
read by the powerd scripts. If an even more general solution is needed,
perhaps powerd could be modified so that a user could register a script to be
run when a button is pressed.