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

@@ -21,6 +21,7 @@
./modules/hyprland
./modules/waybar
./modules/swaylock
./modules/dunst
./modules/bemenu
./modules/syncthing
./modules/firefox

View File

@@ -10,8 +10,6 @@
home.username = "alex";
home.homeDirectory = "/home/alex";
services.dunst.enable = true;
home.packages = with pkgs; [
gnumake
tig

View File

@@ -0,0 +1,42 @@
{ pkgs, ... }:
{
home-manager.users.alex = {
services.dunst = {
enable = true;
settings = {
global = {
width = 300;
height = 300;
offset = "10x50";
origin = "top-right";
transparency = 10;
frame_color = "#a57b06";
font = "DejaVuSansM Nerd Font Mono 14";
};
urgency_low = {
background = "#222222";
foreground = "#888888";
timeout = 10;
};
urgency_normal = {
background = "#262626";
foreground = "#f9c22b";
timeout = 10;
};
urgency_critical = {
background = "#900000";
foreground = "#ffffff";
frame_color = "#ff0000";
timeout = 10;
};
};
};
home.packages = [ pkgs.libnotify ];
};
}

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;
}
'';