From 013c907a9500031d58375fefe9bfd4349aaebbe1 Mon Sep 17 00:00:00 2001 From: alejandro-angulo Date: Fri, 2 Aug 2024 20:01:03 -0700 Subject: [PATCH] Converted swaync to a home module --- homes/x86_64-linux/alejandro/default.nix | 4 ++ modules/home/services/swaync/default.nix | 26 +++++++++++++ .../nixos/desktop/addons/swaync/default.nix | 25 ------------ .../nixos/desktop/addons/waybar/default.nix | 38 +++++++++---------- modules/nixos/desktop/sway/default.nix | 1 - 5 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 modules/home/services/swaync/default.nix delete mode 100644 modules/nixos/desktop/addons/swaync/default.nix diff --git a/homes/x86_64-linux/alejandro/default.nix b/homes/x86_64-linux/alejandro/default.nix index dbb197b..f2c3826 100644 --- a/homes/x86_64-linux/alejandro/default.nix +++ b/homes/x86_64-linux/alejandro/default.nix @@ -26,5 +26,9 @@ git.enable = true; zsh.enable = true; }; + + services = { + swaync.enable = true; + }; }; } diff --git a/modules/home/services/swaync/default.nix b/modules/home/services/swaync/default.nix new file mode 100644 index 0000000..72dc353 --- /dev/null +++ b/modules/home/services/swaync/default.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + pkgs, + namespace, + ... +}: let + inherit (lib) mkEnableOption mkIf; + + cfg = config.${namespace}.services.swaync; +in { + options.${namespace}.services.swaync = { + enable = mkEnableOption "sway notification center"; + }; + + config = mkIf cfg.enable { + home.packages = [pkgs.libnotify]; + + services.swaync = { + enable = true; + settings = { + widgets = ["title" "dnd" "notifications" "mpris"]; + }; + }; + }; +} diff --git a/modules/nixos/desktop/addons/swaync/default.nix b/modules/nixos/desktop/addons/swaync/default.nix deleted file mode 100644 index a47e77d..0000000 --- a/modules/nixos/desktop/addons/swaync/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.aa.desktop.addons.swaync; -in { - options.aa.desktop.addons.swaync = { - enable = lib.mkEnableOption "sway notification center"; - }; - - config = lib.mkIf cfg.enable { - environment.systemPackages = with pkgs; [libnotify]; - - aa.home.extraOptions = { - services.swaync = { - enable = true; - settings = { - widgets = ["title" "dnd" "notifications" "mpris"]; - }; - }; - }; - }; -} diff --git a/modules/nixos/desktop/addons/waybar/default.nix b/modules/nixos/desktop/addons/waybar/default.nix index 234a21e..4202e08 100644 --- a/modules/nixos/desktop/addons/waybar/default.nix +++ b/modules/nixos/desktop/addons/waybar/default.nix @@ -141,25 +141,25 @@ in { tooltip-format = "{essid} {signalStrength}%"; }; - "custom/notification" = mkIf config.aa.desktop.addons.swaync.enable { - 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 = "${pkgs.swaynotificationcenter}/bin/swaync-client -swb"; - on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw"; - on-click-right = "${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw"; - escape = true; - }; + # "custom/notification" = mkIf config.aa.desktop.addons.swaync.enable { + # 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 = "${pkgs.swaynotificationcenter}/bin/swaync-client -swb"; + # on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw"; + # on-click-right = "${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw"; + # escape = true; + # }; tray = { spacing = 10; diff --git a/modules/nixos/desktop/sway/default.nix b/modules/nixos/desktop/sway/default.nix index 024c889..7b6cc90 100644 --- a/modules/nixos/desktop/sway/default.nix +++ b/modules/nixos/desktop/sway/default.nix @@ -42,7 +42,6 @@ in { rofi.enable = true; swayidle.enable = true; swaylock.enable = true; - swaync.enable = true; waybar.enable = true; # TODO