From b2e206884ba695ed3b37fa031912091978231c48 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 3 Jan 2024 19:18:40 +0000 Subject: [PATCH] Add swaync widget to waybar --- home/hyprland/config.nix | 6 +++--- home/hyprland/waybar/default.nix | 21 +++++++++++++++++++++ home/hyprland/waybar/style.css | 7 ++++++- system/hyprland.nix | 1 + 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/home/hyprland/config.nix b/home/hyprland/config.nix index d8c56ea5..b5de0a71 100644 --- a/home/hyprland/config.nix +++ b/home/hyprland/config.nix @@ -90,8 +90,8 @@ in '' bind = SUPER, P, exec, pkill rofi || rofi-pass bind = SUPER SHIFT, P, exec, pkill rofi || rofi-pass --last-used bind = SUPER ALT, P, exec, pkill rofi || rofi-pass --insert - bind = SUPER, Z, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t - bind = SUPER SHIFT, Z, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -d + bind = SUPER, Z, exec, swaync-client -t -sw + bind = SUPER SHIFT, Z, exec, swaync-client -d -sw # Common program shortcuts bind = SUPER, Space, exec, rofi -replace -show combi @@ -246,7 +246,7 @@ in '' bindm = SUPER, mouse:272, movewindow bindm = SUPER, mouse:273, resizewindow - exec-once = ${pkgs.swaynotificationcenter}/bin/swaync + exec-once = swaync exec-once = ${pkgs.hyprpaper}/bin/hyprpaper exec-once = ${pkgs.dex}/bin/dex --autostart '' diff --git a/home/hyprland/waybar/default.nix b/home/hyprland/waybar/default.nix index 3fc58823..8cd78f98 100644 --- a/home/hyprland/waybar/default.nix +++ b/home/hyprland/waybar/default.nix @@ -23,6 +23,7 @@ "cpu" "memory" "clock" + "custom/notification" "custom/separator" "tray" ]; @@ -158,6 +159,26 @@ tooltip-format = "{time}"; format-icons = [ "󱃍" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; }; + "custom/notification" = { + "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-if" = "which swaync-client"; + "exec" = "swaync-client -swb"; + "on-click" = "swaync-client -t -sw"; + "on-click-right" = "swaync-client -d -sw"; + "escape" = true; + }; tray = { icon-size = 16; show-passive-items = true; diff --git a/home/hyprland/waybar/style.css b/home/hyprland/waybar/style.css index 4502c7ff..f10fe901 100644 --- a/home/hyprland/waybar/style.css +++ b/home/hyprland/waybar/style.css @@ -84,6 +84,7 @@ tooltip { #memory, #temperature, #clock, +#custom-notification, #tray { margin: 0px; padding: 1px 5px; @@ -92,7 +93,8 @@ tooltip { #workspaces, #window, #mpris, -#tray { +#tray, +#custom-separator { color: @text; } @@ -130,3 +132,6 @@ tooltip { #clock { color: @mauve; } +#custom-notification { + color: @lavender; +} diff --git a/system/hyprland.nix b/system/hyprland.nix index 93333ba6..dda91b05 100644 --- a/system/hyprland.nix +++ b/system/hyprland.nix @@ -14,6 +14,7 @@ systemPackages = with pkgs; [ libsForQt5.polkit-kde-agent swaylock + swaynotificationcenter xdg-utils hyprpaper pipewire