pinwheel: Extract dunst to module

This commit is contained in:
Alexander Heldt
2023-09-19 22:14:47 +02:00
parent 0847797c0c
commit c241d3bfd3
4 changed files with 63 additions and 4 deletions

View File

@@ -23,6 +23,17 @@ let
fi
'';
notifications-status = pkgs.writeShellScript "notifications-status" ''
if ${pkgs.dunst}/bin/dunstctl is-paused | grep -q "false"; then
echo 󰂚;
else
DISABLED=󰂛
COUNT=$(${pkgs.dunst}/bin/dunstctl count waiting)
[ $COUNT != 0 ] && DISABLED="󰂛 $COUNT"
echo $DISABLED
fi
'';
toggle-bt-power = pkgs.writeShellScript "toggle-bt-power" ''
POWERED_ON=$(bluetoothctl show | grep "Powered: yes")
if [ -z "$POWERED_ON" ]; then
@@ -49,7 +60,7 @@ in
];
modules-left = [ "hyprland/workspaces" ];
modules-right = [ "custom/spotify" "bluetooth" "wireplumber" "network" "battery" "clock" ];
modules-right = [ "custom/spotify" "custom/dunst" "bluetooth" "wireplumber" "network" "battery" "clock" ];
"custom/spotify" = {
exec = spotify-status;
@@ -57,6 +68,13 @@ in
tooltip = false;
};
"custom/dunst" = {
exec = notifications-status;
on-click-right = "${pkgs.dunst}/bin/dunstctl set-paused toggle";
interval = 1;
tooltip = false;
};
bluetooth = {
"format-off" = "󰂲";
"format-on" = "";
@@ -117,7 +135,7 @@ in
background-color: ${background};
}
#custom-spotify, #bluetooth, #wireplumber, #network, #battery, #clock {
#custom-spotify, #custom-dunst, #bluetooth, #wireplumber, #network, #battery, #clock {
margin: 0 12px;
}
'';