~kennylevinsen/switchd

Run stuff when system buttons/switches trigger

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~kennylevinsen/switchd
read/write
git@git.sr.ht:~kennylevinsen/switchd

You can also use your local clone with git send-email.

#switchd

Runs commands when system button/switch states trigger.

#Events

  • power_button
  • restart_button
  • sleep_button
  • suspend_button
  • lid_closed
  • lid_opened
  • dock_attached
  • dock_detached

#How to run

Run as root or user that has sufficient access to inputs and is suitable for running the intended commands:

switchd \
	power_button poweroff \
	lid_closed pm-suspend \
	dock_attached "echo 'wait where did that come from'"

It exits whenever devices disappear, and expects to be restarted when it happens. Dynamic reconfiguration wasn't worth the hassle.

#How to discuss

Go to #kennylevinsen @ irc.libera.chat to discuss, or use ~kennylevinsen/public-inbox@lists.sr.ht.