Custom hot key programming with acpid

Hooking the Script to acpid

Getting acpid to use your script is really just a matter of editing the /etc/acpi/event/ibm-videobtn file and replacing the action= line with a pointer to your script. On my system, the script is /usr/local/sbin/video-switch, so my ibm-videobtn file looks like this:

event=ibm/hotkey HKEY 00000080 00001007

When you modify the files under /etc/acpi/events, you'll need to restart acpid to get it to pick up the changes.

Additionally, you'll want to get acpid out of debug mode, so hit Ctrl+C in the window in which acpid is currently running then enter /etc/init.d/acpid start as root to fire up the daemon normally. At this point, hitting Fn+F7 on the laptop should cycle it through the three display settings programmed in the script. Because this very simple hack works as advertised, I've gotten tons of "geek cred" at various Linux User Group meetings.


Programming your own hot key hacks is equally simple. First, run acpid in debug mode to figure out exactly which event is triggered by your key presses. Then check the /etc/acpi/event directory to see whether a configuration file related to this event already exists. If not, feel free to create one from scratch – you really only need the event= and action= lines for most simple events. From there, it's just a matter of scripting what you want to happen. In many cases, you might be able to find example scripts on the web to use as a starting point.


  1. Advanced Configuration and Power Interface:
  2. acpid:
  3. ThinkWiki sample script:

The Author

Hal Pomeranz ( is an independent consultant with more than 20 years of experience with Unix. He is a Faculty Fellow of the SANS Institute and the course author and primary instructor for their Linux/Unix Security certification track. Hal is also a recipient of the SAGE Outstanding Achievement award for his teaching and leadership in the field of Systems Administration.

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

comments powered by Disqus

Direct Download

Read full article as PDF: