From b51d8f3ca20b558a3f72bc4dac3e29da2cf1ce0d Mon Sep 17 00:00:00 2001 From: Lyndon Sanche Date: Tue, 13 Sep 2022 22:38:20 -0600 Subject: [PATCH 1/2] Allow disabling image on swaylock --- modules/swaylock.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/swaylock.nix b/modules/swaylock.nix index eed4146e..6ccd0b07 100644 --- a/modules/swaylock.nix +++ b/modules/swaylock.nix @@ -4,14 +4,17 @@ with config.lib.stylix.colors; let inside = base01-hex; + outside = base01-hex; ring = base05-hex; text = base05-hex; positive = base0B-hex; negative = base08-hex; in { - options.stylix.targets.swaylock.enable = - config.lib.stylix.mkEnableTarget "Swaylock" true; + options.stylix.targets.swaylock = { + enable = config.lib.stylix.mkEnableTarget "Swaylock" true; + useBackground = lib.mkOption { type = lib.types.bool; default = true; }; + }; config = lib.mkIf config.stylix.targets.swaylock.enable { home-manager.sharedModules = [( @@ -19,8 +22,8 @@ in { { # See https://github.com/danth/stylix/issues/8#issuecomment-1194484544 # This check can be removed when programs.swaylock is in a stable release - programs.swaylock.settings = lib.mkIf (options.programs ? swaylock) { - image = "${config.stylix.image}"; + programs.swaylock.settings = lib.mkIf (options.programs ? swaylock) ({ + color = outside; scaling = "fill"; inside-color = inside; inside-clear-color = inside; @@ -43,7 +46,9 @@ in { text-caps-lock-color = text; text-ver-color = text; text-wrong-color = text; - }; + } // (if config.stylix.targets.swaylock.useBackground then { + image = "${config.stylix.image}"; + } else {} )); } )]; }; From 939904e071b0af7d68c37f1a5f2faac62613595c Mon Sep 17 00:00:00 2001 From: Daniel Thwaites Date: Sat, 17 Sep 2022 12:47:37 +0000 Subject: [PATCH 2/2] Rename `useBackground` to `useImage` :speech_balloon: --- modules/swaylock.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/swaylock.nix b/modules/swaylock.nix index 6ccd0b07..b87f104f 100644 --- a/modules/swaylock.nix +++ b/modules/swaylock.nix @@ -13,7 +13,14 @@ let in { options.stylix.targets.swaylock = { enable = config.lib.stylix.mkEnableTarget "Swaylock" true; - useBackground = lib.mkOption { type = lib.types.bool; default = true; }; + useImage = lib.mkOption { + description = '' + Whether to use your wallpaper image for the Swaylock background. + If this is disabled, a plain color will be used instead. + ''; + type = lib.types.bool; + default = true; + }; }; config = lib.mkIf config.stylix.targets.swaylock.enable { @@ -46,7 +53,7 @@ in { text-caps-lock-color = text; text-ver-color = text; text-wrong-color = text; - } // (if config.stylix.targets.swaylock.useBackground then { + } // (if config.stylix.targets.swaylock.useImage then { image = "${config.stylix.image}"; } else {} )); }