From e04ec4c706473b0e92a1df4905525e54b10be0f0 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 18 Jun 2024 02:29:39 +0000 Subject: [PATCH] nwg-panel: fix the "lock" button to use the correct screen locker --- hosts/common/programs/nwg-panel/config.nix | 4 ++-- hosts/common/programs/nwg-panel/default.nix | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hosts/common/programs/nwg-panel/config.nix b/hosts/common/programs/nwg-panel/config.nix index 2c8bf485..cc0aa10d 100644 --- a/hosts/common/programs/nwg-panel/config.nix +++ b/hosts/common/programs/nwg-panel/config.nix @@ -8,6 +8,7 @@ { components, height, + locker, playerctlChars, windowIcon, windowTitle, @@ -90,9 +91,8 @@ menu.icon = "system-shutdown-symbolic"; menu.items = [ { - # TODO: plumb through the configured locker instead of assuming `swaylock` name = "Lock"; - cmd = "swaylock -f -c 000000"; + cmd = "s6-rc start ${locker}"; } { name = "Logout"; diff --git a/hosts/common/programs/nwg-panel/default.nix b/hosts/common/programs/nwg-panel/default.nix index 103b75a4..50f74eea 100644 --- a/hosts/common/programs/nwg-panel/default.nix +++ b/hosts/common/programs/nwg-panel/default.nix @@ -37,6 +37,13 @@ in height of the top bar in px. ''; }; + locker = mkOption { + type = types.str; + default = config.sane.programs.swayidle.config.actions.lock.service; + description = '' + s6 service to start which can lock the screen + ''; + }; battery = mkEnableOption' true "display battery status"; brightness = mkEnableOption' true "display backlight level and slider"; mediaTitle = mkEnableOption' true "display title of current song/media"; @@ -104,7 +111,7 @@ in inherit (cfg.config) fontSize clockFontSize; }; fs.".config/nwg-panel/config".symlink.target = pkgs.writers.writeJSON "config" (import ./config.nix { - inherit (cfg.config) height windowIcon windowTitle workspaceHideEmpty workspaceNumbers; + inherit (cfg.config) locker height windowIcon windowTitle workspaceHideEmpty workspaceNumbers; # component order matters, mostly for the drop-down. # default for most tools (e.g. swaync) is brightness control above volume. components =