Udev: Trigger on all bt events.

This commit is contained in:
Dmitry Voronin 2024-12-27 06:47:48 +03:00
parent abbb23b615
commit 6fa7e64cd4
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -2,13 +2,16 @@
let
waybar_reload = pkgs.writeShellScriptBin "bt-wb-dispatcher" ''
${pkgs.procps}/bin/pkill -RTMIN+7 waybar
'';
waybar_reload_add = pkgs.writeShellScriptBin "bt-add-wb-dispatcher" ''
${pkgs.procps}/bin/pkill -RTMIN+7 waybar
${pkgs.coreutils}/bin/sleep 2
${pkgs.procps}/bin/pkill -RTMIN+7 waybar
'';
in
{
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="${waybar_reload}/bin/bt-wb-dispatcher"
ACTION=="remove", SUBSYSTEM=="bluetooth", RUN+="${waybar_reload}/bin/bt-wb-dispatcher"
SUBSYSTEM=="bluetooth", RUN+="${waybar_reload}/bin/bt-wb-dispatcher"
SUBSYSTEM=="bluetooth", ACTION=="add", RUN+="${waybar_reload_add}/bin/bt-add-wb-dispatcher"
'';
}