user-acpid-rs

non-root companion process for linux acpid ( https://sourceforge.net/projects/acpid2/ )
status
why
- we want a way to react to ACPI events and act upon an interactive user session
- this means being able to easily access the current dbus/wayland/pipewire/etc sessions
acpid
is great,
but it executes hooks as root instead of as the current interactive user
- it's quite (intentionally) fiddly for anyone except that user to access user session sockets, buses, etc
- this tool is intended to be executed as a non-root user in the context of their interactive session
use cases
- in combination with
wlr-randr
,
turn on/off a built-in display based on laptop lid status
- turn on/off a built-in USB webcam based on laptop lid status
- in combination with
pw-cli
,
turn on/off a built-in USB microphone based on laptop lid status
dependencies
- requires your system to be running
acpid
with the default --socketfile
behaviour
roadmap
- [x] read events from /var/run/acpid.socket
- [x] identify lid open and lid close ACPI events
- [x] run ~/.config/user-acpid/button-lid-open when opened
- [x] run ~/.config/user-acpid/button-lid-close when closed
- [x] check lid status on startup
- [ ] support alternative paths to
acpid
's socket file
- [ ] handle socket closure and attempt to re-open after a delay
- [ ] close and re-open socket after receiving SIGUSER1 signal
- [ ] explore direct kernel access (independence from
acpid
)