From 3d0dc78e80031731240c979d87eed8e090d35439 Mon Sep 17 00:00:00 2001 From: Anton Tetov Date: Tue, 23 Jan 2024 08:21:17 +0100 Subject: [PATCH] bemenu: allow floats in settings For example, the CLI option --width-factor controls the width of the launcher and is set to a value between 0-1. --- modules/programs/bemenu.nix | 3 ++- tests/modules/programs/bemenu/basic-configuration.nix | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/programs/bemenu.nix b/modules/programs/bemenu.nix index 3cfd0002..58d24dcc 100644 --- a/modules/programs/bemenu.nix +++ b/modules/programs/bemenu.nix @@ -15,7 +15,7 @@ in { package = mkPackageOption pkgs "bemenu" { }; settings = mkOption { - type = with types; attrsOf (oneOf [ str int bool ]); + type = with types; attrsOf (oneOf [ str number bool ]); default = { }; example = literalExpression '' { @@ -32,6 +32,7 @@ in { hf = "#f9e2af"; af = "#cdd6f4"; ab = "#1e1e2e"; + width-factor = 0.3; } ''; description = diff --git a/tests/modules/programs/bemenu/basic-configuration.nix b/tests/modules/programs/bemenu/basic-configuration.nix index 3284975c..0615ae3c 100644 --- a/tests/modules/programs/bemenu/basic-configuration.nix +++ b/tests/modules/programs/bemenu/basic-configuration.nix @@ -15,12 +15,13 @@ hf = "#f9e2af"; af = "#cdd6f4"; ab = "#1e1e2e"; + width-factor = 0.3; }; }; nmt.script = '' assertFileExists home-path/etc/profile.d/hm-session-vars.sh assertFileContains home-path/etc/profile.d/hm-session-vars.sh \ - "export BEMENU_OPTS=\"'--ab' '#1e1e2e' '--af' '#cdd6f4' '--fb' '#1e1e2e' '--ff' '#cdd6f4' '--hb' '#1e1e2e' '--hf' '#f9e2af' '--ignorecase' '--line-height' '28' '--nb' '#1e1e2e' '--nf' '#cdd6f4' '--prompt' 'open' '--tb' '#1e1e2e' '--tf' '#f38ba8'\"" + "export BEMENU_OPTS=\"'--ab' '#1e1e2e' '--af' '#cdd6f4' '--fb' '#1e1e2e' '--ff' '#cdd6f4' '--hb' '#1e1e2e' '--hf' '#f9e2af' '--ignorecase' '--line-height' '28' '--nb' '#1e1e2e' '--nf' '#cdd6f4' '--prompt' 'open' '--tb' '#1e1e2e' '--tf' '#f38ba8' '--width-factor' '0.300000'\"" ''; }