From 4f944b2f9c65b22dd68812385b599f20ffe142d0 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Mon, 18 Nov 2024 12:07:10 +0100 Subject: [PATCH] treewide: move swaync to a separate file --- .../{ironbar/default.nix => ironbar.nix} | 79 +++++-------------- home/programs/swaync.nix | 64 +++++++++++++++ hosts/vamos/default.nix | 2 +- 3 files changed, 85 insertions(+), 60 deletions(-) rename home/programs/{ironbar/default.nix => ironbar.nix} (54%) create mode 100644 home/programs/swaync.nix diff --git a/home/programs/ironbar/default.nix b/home/programs/ironbar.nix similarity index 54% rename from home/programs/ironbar/default.nix rename to home/programs/ironbar.nix index 980311e..b1db281 100644 --- a/home/programs/ironbar/default.nix +++ b/home/programs/ironbar.nix @@ -1,46 +1,16 @@ { + config, lib, inputs, - pkgs, ... }: let - inherit (lib) mkForce; + inherit (lib) mkIf; icon_size = 28; - swayncStyle = pkgs.fetchurl { - url = "https://github.com/catppuccin/swaync/releases/download/v0.2.3/macchiato.css"; - sha256 = "sha256-LMm6nWn1JPPgj5YpppwFG3lXTtXem5atlIvqrDxd0bM="; - }; in { - imports = [inputs.ironbar.homeManagerModules.default]; - home.packages = [pkgs.procps]; - services.swaync = { - enable = true; - style = swayncStyle; - settings = { - positionX = "right"; - positionY = "top"; - layer = "overlay"; - control-center-layer = "top"; - layer-shell = true; - cssPriority = "application"; - control-center-margin-top = 0; - control-center-margin-bottom = 0; - control-center-margin-right = 0; - control-center-margin-left = 0; - notification-2fa-action = true; - notification-inline-replies = false; - notification-icon-size = 64; - notification-body-image-height = 100; - notification-body-image-width = 200; - }; - }; - - systemd.user.services.swaync = { - Install.WantedBy = mkForce ["graphical-session.target"]; - Unit.ConditionEnvironment = mkForce ""; - Unit.PartOf = lib.mkForce ["graphical-session.target"]; - }; - + imports = [ + ./swaync.nix + inputs.ironbar.homeManagerModules.default + ]; programs.ironbar = { enable = true; systemd = true; @@ -111,34 +81,25 @@ in { type = "upower"; format = "{percentage}%"; } - { - type = "volume"; - format = "{icon} {percentage}%"; - max_volume = 100; - icons = { - volume_high = "󰕾"; - volume_medium = "󰖀"; - volume_low = "󰕿"; - muted = "󰝟"; - }; - } {type = "clock";} { type = "tray"; inherit icon_size; } - { - type = "notifications"; - "show_count" = true; - icons = { - "closed_none" = "󰍥"; - "closed_some" = "󱥂"; - "closed_dnd" = "󱅯"; - "open_none" = "󰍡"; - "open_some" = "󱥁"; - "open_dnd" = "󱅮"; - }; - } + (mkIf + config.services.swaync.enable + { + type = "notifications"; + "show_count" = true; + icons = { + "closed_none" = "󰍥"; + "closed_some" = "󱥂"; + "closed_dnd" = "󱅯"; + "open_none" = "󰍡"; + "open_some" = "󱥁"; + "open_dnd" = "󱅮"; + }; + }) ]; }; style = '' diff --git a/home/programs/swaync.nix b/home/programs/swaync.nix new file mode 100644 index 0000000..f5fa924 --- /dev/null +++ b/home/programs/swaync.nix @@ -0,0 +1,64 @@ +{ + pkgs, + lib, + ... +}: let + inherit (lib) mkForce; + swayncStyle = pkgs.fetchurl { + url = "https://github.com/catppuccin/swaync/releases/download/v0.2.3/macchiato.css"; + sha256 = "sha256-LMm6nWn1JPPgj5YpppwFG3lXTtXem5atlIvqrDxd0bM="; + }; +in { + home.packages = [pkgs.procps]; + services.swaync = { + enable = true; + style = swayncStyle; + settings = { + positionX = "right"; + positionY = "top"; + layer = "overlay"; + control-center-layer = "top"; + layer-shell = true; + cssPriority = "application"; + control-center-margin-top = 0; + control-center-margin-bottom = 0; + control-center-margin-right = 0; + control-center-margin-left = 0; + notification-2fa-action = true; + notification-inline-replies = false; + notification-icon-size = 64; + notification-body-image-height = 100; + notification-body-image-width = 200; + widgets = [ + "title" + "dnd" + "mpris" + "notifications" + "volume" + ]; + widget-config = { + title = { + text = "Notifications"; + clear-all-button = true; + button-text = "󰩹"; + }; + dnd = { + text = "Do Not Disturb"; + }; + mpris = { + blur = true; + }; + volume = { + label = "󰓃"; + show-per-app = false; + }; + }; + }; + }; + + systemd.user.services.swaync = { + Install.WantedBy = mkForce ["graphical-session.target"]; + Unit.ConditionEnvironment = mkForce ""; + Unit.PartOf = lib.mkForce ["graphical-session.target"]; + }; +} diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index 135a692..5e5dc0c 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -34,7 +34,7 @@ in { "${home}/services/udiskie.nix" "${home}/programs/niri" - "${home}/programs/ironbar" + "${home}/programs/ironbar.nix" "${home}/programs/fuzzel.nix" "${home}/programs/swaybg.nix" "${home}/programs/swaylock.nix"