fbd-alert-slider: Small service to track alert sliders
This tracks the alert slider on OnePlus 6/6T devices and adjusts the profile level accordingly emitting a bit of haptic feedback when that happens.
This is heavily based on a script by @isyourbrainFOSS in the Phosh matrix channel and is basically the bits posted there translated to compiled language so we can leverage poll/select and gudev for device selection.
The main differences are
- No need to use polling as we can use a
GIoChannel
that only triggers when new input is available (thus improving battery life) - Probe for the device via udev/gudev so we can exit early on systems that don't have a slider (but install the service by default)
- Use
important
hint on the notification so we can trigger haptic even when in silent mode - Use a systemd unit for activation (should work on pmOS as AFAIK elogind supports this, otherwise we can add an autostart desktop file)
I've put the whole thing into a separate service as the alert-slider DT bits for the OnePlus 6/6T aren't upstream yet and this way distros have some leeway on whether they want to ship it or not.
@isyourbrainFOSS does that make sense?