diff --git a/.sources/sources.json b/.sources/sources.json index 45f53d4..f7d7a19 100644 --- a/.sources/sources.json +++ b/.sources/sources.json @@ -335,6 +335,18 @@ "url": "https://github.com/catppuccin/sway/archive/5f9da99a43336583c7d5ebddf78d7b615911e5ea.tar.gz", "hash": "0n3fpb9pkmis932jv5b1gz045xyhw9cqybild20hsv45lr3r5f1q" }, + "swaync": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "rose-pine", + "repo": "swaync" + }, + "branch": "main", + "revision": "fc17ee01916a5e4424af5c5b29272383fcdfc4f3", + "url": "https://github.com/rose-pine/swaync/archive/fc17ee01916a5e4424af5c5b29272383fcdfc4f3.tar.gz", + "hash": "13fq0qv009q80pfrwzgnk6ads4b4z82q2g7fala7rmh1nypl5ch4" + }, "tm-theme": { "type": "Git", "repository": { diff --git a/modules/home-manager/all-modules.nix b/modules/home-manager/all-modules.nix index 148d412..ce91c0c 100644 --- a/modules/home-manager/all-modules.nix +++ b/modules/home-manager/all-modules.nix @@ -21,8 +21,9 @@ ./rio.nix ./rofi.nix ./starship.nix - ./swaylock.nix ./sway.nix + ./swaylock.nix + ./swaync.nix ./tmux.nix ./waybar.nix ./zathura.nix diff --git a/modules/home-manager/swaync.nix b/modules/home-manager/swaync.nix new file mode 100644 index 0000000..2139ca9 --- /dev/null +++ b/modules/home-manager/swaync.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + ... +}: let + inherit (config.rose-pine) sources; + + cfg = config.services.swaync.rose-pine; + enable = cfg.enable && config.services.swaync.enable; + + styleFile = "${sources.swaync}/theme/${lib.rp.getKebabTheme cfg.flavor}.css"; +in { + options.services.swaync.rose-pine = + lib.rp.mkRosePineOpt {name = "swaync";} + // { + mode = lib.mkOption { + type = lib.types.enum [ + "prependImport" + "createLink" + ]; + default = "prependImport"; + description = '' + Defines how to include the Rosé Pine theme css file: + + - `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority). + - `createLink`: Creates a symbolic link `~/.config/waybar/rose-pine.css`, which needs to be included in the waybar stylesheet. + ''; + }; + }; + + config = lib.mkIf enable ( + lib.mkMerge [ + (lib.mkIf (cfg.mode == "prependImport") { + services.swaync.style = lib.mkBefore '' + @import "${styleFile}"; + ''; + }) + (lib.mkIf (cfg.mode == "createLink") { + xdg.configFile."swaync/rose-pine.css".source = styleFile; + }) + ] + ); +} diff --git a/tests/home.nix b/tests/home.nix index 8b24d7e..c3a75b0 100644 --- a/tests/home.nix +++ b/tests/home.nix @@ -46,6 +46,7 @@ polybar top & ''; }; + swaync.enable = true; }; wayland.windowManager.sway.enable = true;