nwg-panel: fix the "lock" button to use the correct screen locker

This commit is contained in:
Colin 2024-06-18 02:29:39 +00:00
parent b0f9733ac8
commit e04ec4c706
2 changed files with 10 additions and 3 deletions

View File

@ -8,6 +8,7 @@
{ {
components, components,
height, height,
locker,
playerctlChars, playerctlChars,
windowIcon, windowIcon,
windowTitle, windowTitle,
@ -90,9 +91,8 @@
menu.icon = "system-shutdown-symbolic"; menu.icon = "system-shutdown-symbolic";
menu.items = [ menu.items = [
{ {
# TODO: plumb through the configured locker instead of assuming `swaylock`
name = "Lock"; name = "Lock";
cmd = "swaylock -f -c 000000"; cmd = "s6-rc start ${locker}";
} }
{ {
name = "Logout"; name = "Logout";

View File

@ -37,6 +37,13 @@ in
height of the top bar in px. 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"; battery = mkEnableOption' true "display battery status";
brightness = mkEnableOption' true "display backlight level and slider"; brightness = mkEnableOption' true "display backlight level and slider";
mediaTitle = mkEnableOption' true "display title of current song/media"; mediaTitle = mkEnableOption' true "display title of current song/media";
@ -104,7 +111,7 @@ in
inherit (cfg.config) fontSize clockFontSize; inherit (cfg.config) fontSize clockFontSize;
}; };
fs.".config/nwg-panel/config".symlink.target = pkgs.writers.writeJSON "config" (import ./config.nix { 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. # component order matters, mostly for the drop-down.
# default for most tools (e.g. swaync) is brightness control above volume. # default for most tools (e.g. swaync) is brightness control above volume.
components = components =