treewide: add swaync for waybar

This commit is contained in:
Anthony Rodriguez 2024-11-24 23:38:41 +01:00
parent 6c9feb58a6
commit 74cb29526e
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
4 changed files with 155 additions and 123 deletions

View file

@ -1,17 +1,19 @@
{
osConfig,
pkgs,
lib,
osConfig,
config,
...
}: let
inherit (lib) getExe;
inherit (lib) getExe mkMerge mkIf;
in {
imports = [./style.nix];
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
mainBar = mkMerge [
{
layer = "top";
position = "top";
height = 30;
@ -23,7 +25,9 @@ in {
modules-left = ["niri/workspaces" "niri/window"];
modules-center = ["group/clock"];
modules-right = ["tray" "group/status" "group/power"];
modules-right =
["tray" "group/status" "group/power"]
++ lib.optional config.services.swaync.enable "custom/notification";
battery = {
interval = 10;
@ -44,10 +48,6 @@ in {
max-length = 25;
};
"niri/window" = {
icon = true;
};
"pulseaudio" = {
format = "{icon} {volume}%";
format-bluetooth = "{icon} {volume}%";
@ -146,7 +146,28 @@ in {
"󰤨"
];
};
}
(mkIf osConfig.programs.niri.enable {
"niri/window" = {
icon = true;
};
})
(mkIf config.services.swaync.enable {
"custom/notification" = {
tooltip = false;
format = "{icon}";
format-icons = {
notification = "󱅫";
none = "󰂚";
dnd-notification = "󱏧";
dnd-none = "󱏧";
};
return-type = "json";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
};
})
];
};
};

View file

@ -88,7 +88,8 @@ in {
#network,
#pulseaudio,
#tray,
#power-profiles-daemon {
#power-profiles-daemon
{
padding: 0 0.5em;
}
@ -102,5 +103,9 @@ in {
padding: 0 1.2em;
color: @base08;
}
#custom-notification {
padding: 0 1.2em;
}
'';
}

5
home/services/swaync.nix Normal file
View file

@ -0,0 +1,5 @@
_: {
services.swaync = {
enable = true;
};
}

View file

@ -35,6 +35,7 @@ in {
"${home}/programs/niri"
"${home}/programs/waybar"
"${home}/services/swaync.nix"
"${home}/programs/fuzzel.nix"
"${home}/programs/swaybg.nix"
"${home}/programs/swaylock.nix"