From 297e2ed1bb1314f4433e6df82f1b89c36f0e1754 Mon Sep 17 00:00:00 2001 From: Anomalocaridid <29845794+Anomalocaridid@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:36:19 -0500 Subject: [PATCH] feat(home-manager): add support for wlogout --- modules/home-manager/all-modules.nix | 1 + modules/home-manager/wlogout.nix | 65 ++++++++++++++++++++++++++++ modules/tests/darwin.nix | 1 + modules/tests/home.nix | 1 + pkgs/sources.json | 4 ++ pkgs/wlogout/package.nix | 10 +++++ 6 files changed, 82 insertions(+) create mode 100644 modules/home-manager/wlogout.nix create mode 100644 pkgs/wlogout/package.nix diff --git a/modules/home-manager/all-modules.nix b/modules/home-manager/all-modules.nix index a7cf5e4b..03832842 100644 --- a/modules/home-manager/all-modules.nix +++ b/modules/home-manager/all-modules.nix @@ -43,6 +43,7 @@ ./tofi.nix ./obs.nix ./waybar.nix + ./wlogout.nix ./yazi.nix ./zathura.nix ./zed-editor.nix diff --git a/modules/home-manager/wlogout.nix b/modules/home-manager/wlogout.nix new file mode 100644 index 00000000..52e666aa --- /dev/null +++ b/modules/home-manager/wlogout.nix @@ -0,0 +1,65 @@ +{ catppuccinLib }: +{ config, lib, ... }: + +let + inherit (config.catppuccin) sources; + + cfg = config.catppuccin.wlogout; +in + +{ + options.catppuccin.wlogout = + catppuccinLib.mkCatppuccinOption { + name = "wlogout"; + accentSupport = true; + } + // { + iconStyle = lib.mkOption { + type = lib.types.enum [ + "wlogout" + "wleave" + ]; + description = "Icon style to set in ~/.config/wlogout/style.css"; + default = "wlogout"; + example = lib.literalExpression "wleave"; + }; + extraStyle = lib.mkOption { + type = lib.types.lines; + description = "Additional CSS to put in ~/.config/wlogout/style.css"; + default = ""; + example = lib.literalExpression '' + button { + border-radius: 2px; + } + + #lock { + background-image: url("''${config.gtk.iconTheme.package}/share/icons/''${config.gtk.iconTheme.name}/apps/scalable/system-lock-screen.svg"); + } + ''; + }; + }; + + config = lib.mkIf cfg.enable { + programs.wlogout.style = lib.concatStrings [ + '' + @import url("${sources.wlogout}/themes/${cfg.flavor}/${cfg.accent}.css"); + '' + (lib.concatMapStrings + (icon: '' + #${icon} { + background-image: url("${sources.wlogout}/icons/${cfg.iconStyle}/${cfg.flavor}/${cfg.accent}/${icon}.svg"); + } + '') + [ + "hibernate" + "lock" + "logout" + "reboot" + "shutdown" + "suspend" + ] + ) + cfg.extraStyle + ]; + }; +} diff --git a/modules/tests/darwin.nix b/modules/tests/darwin.nix index f40d8d5f..1a3c612a 100644 --- a/modules/tests/darwin.nix +++ b/modules/tests/darwin.nix @@ -34,6 +34,7 @@ swaylock.enable = lib.mkVMOverride false; tofi.enable = lib.mkVMOverride false; waybar.enable = lib.mkVMOverride false; + wlogout.enable = lib.mkVMOverride false; }; qt.enable = lib.mkVMOverride false; # NOTE: same as cava diff --git a/modules/tests/home.nix b/modules/tests/home.nix index ee2100ac..3c7e8415 100644 --- a/modules/tests/home.nix +++ b/modules/tests/home.nix @@ -58,6 +58,7 @@ tofi.enable = true; obs-studio.enable = true; waybar.enable = true; + wlogout.enable = true; yazi.enable = true; zathura.enable = true; zed-editor.enable = true; diff --git a/pkgs/sources.json b/pkgs/sources.json index 307cb878..be5c738a 100644 --- a/pkgs/sources.json +++ b/pkgs/sources.json @@ -167,6 +167,10 @@ "hash": "sha256-za0y6hcN2rvN6Xjf31xLRe4PP0YyHu2i454ZPjr+lWA=", "rev": "ee8ed32b4f63e9c417249c109818dcc05a2e25da" }, + "wlogout": { + "hash": "sha256-QUSDx5M+BG7YqI4MBsOKFPxvZHQtCa8ibT0Ln4FPQ7I=", + "rev": "b690cee13b944890e43a5fb629ccdff86cffbbb3" + }, "yazi": { "hash": "sha256-UVcPdQFwgBxR6n3/1zRd9ZEkYADkB5nkuom5SxzPTzk=", "rev": "5d3a1eecc304524e995fe5b936b8e25f014953e8" diff --git a/pkgs/wlogout/package.nix b/pkgs/wlogout/package.nix new file mode 100644 index 00000000..ff78365e --- /dev/null +++ b/pkgs/wlogout/package.nix @@ -0,0 +1,10 @@ +{ buildCatppuccinPort }: + +buildCatppuccinPort { + pname = "wlogout"; + + installTargets = [ + "themes" + "icons" + ]; +}