From e05531c16ce7bdd3a35e8c9d4ca03a9e8a552a30 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 18 May 2024 10:25:31 +0530 Subject: [PATCH] add notification indicator on waybar --- home/wm/addon/waybar/default.nix | 27 +++++++++++++++++++++++++-- home/wm/addon/waybar/style.css | 3 ++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/home/wm/addon/waybar/default.nix b/home/wm/addon/waybar/default.nix index 38dc841..f829390 100644 --- a/home/wm/addon/waybar/default.nix +++ b/home/wm/addon/waybar/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs.waybar = { enable = true; package = pkgs.waybar.override { @@ -14,7 +15,10 @@ height = 28; modules-left = [ "hyprland/workspaces" "hyprland/window" "hyprland/submap" ]; modules-center = [ ]; - modules-right = [ "tray" "idle_inhibitor" "network" "bluetooth" "wireplumber" "backlight" "battery" "clock" ]; + modules-right = [ "tray" "idle_inhibitor" "network" "bluetooth" "wireplumber" "backlight" "battery" "clock" "custom/notification" ]; + "hyprland/workspaces" = { + separate-outputs = true; + }; idle_inhibitor = { format = "{icon}"; format-icons = { @@ -73,6 +77,25 @@ tray = { spacing = 4; }; + "custom/notification" = let swaync-client = "${pkgs.swaynotificationcenter}/bin/swaync-client"; in { + tooltip = false; + format = "{icon}"; + format-icons = { + notification = "󱅫"; + none = "󰂚"; + dnd-notification = "󰂠"; + dnd-none = "󰂠"; + inhibited-notification = "󰂛"; + inhibited-none = "󰂛"; + dnd-inhibited-notification = "󰂛"; + dnd-inhibited-none = "󰂛"; + }; + return-type = "json"; + exec = "${swaync-client} -swb"; + on-click = "${swaync-client} -t -sw"; + on-click-right = "${swaync-client} -d -sw"; + escape = true; + }; }; }; }; diff --git a/home/wm/addon/waybar/style.css b/home/wm/addon/waybar/style.css index db3a86d..c49da6b 100644 --- a/home/wm/addon/waybar/style.css +++ b/home/wm/addon/waybar/style.css @@ -74,7 +74,8 @@ window#waybar.solo { #mode, #submap, #idle_inhibitor, -#bluetooth { +#bluetooth, +#custom-notification { padding: 0 10px; color: @foreground; background-color: @background;