From 433e686675ba24176fe3383916a4bd1c9799c676 Mon Sep 17 00:00:00 2001 From: Zachary H <39349995+zackattackz@users.noreply.github.com> Date: Fri, 13 Sep 2024 03:58:00 -0400 Subject: [PATCH] autorandr: configModule.extraConfig Add an option to programs.autorandr's configModule to allow arbitrary extra config lines. No option exists for adding arbitrary key/values to generated autorandr profile config, as is common in other nix modules. This commit adds one. --- modules/programs/autorandr.nix | 15 ++++++++++++++- .../programs/autorandr/basic-configuration.nix | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/programs/autorandr.nix b/modules/programs/autorandr.nix index edbe83de6..ab59d8d9d 100644 --- a/modules/programs/autorandr.nix +++ b/modules/programs/autorandr.nix @@ -177,6 +177,18 @@ let default = null; example = "nearest"; }; + + extraConfig = mkOption { + type = types.lines; + description = "Extra lines to append to this profile's config."; + default = ""; + example = literalExpression '' + ''' + x-prop-non_desktop 0 + some-key some-value + ''' + ''; + }; }; }; @@ -267,7 +279,8 @@ let + concatMapStringsSep "," toString (flatten config.transform)) ++ optional (config.scale != null) ((if config.scale.method == "factor" then "scale" else "scale-from") - + " ${toString config.scale.x}x${toString config.scale.y}")) + + " ${toString config.scale.x}x${toString config.scale.y}") + ++ optional (config.extraConfig != "") config.extraConfig) else '' output ${name} off diff --git a/tests/modules/programs/autorandr/basic-configuration.nix b/tests/modules/programs/autorandr/basic-configuration.nix index e650f6005..d0f14ec86 100644 --- a/tests/modules/programs/autorandr/basic-configuration.nix +++ b/tests/modules/programs/autorandr/basic-configuration.nix @@ -23,6 +23,10 @@ [ 0.0 0.6 0.0 ] # d e f [ 0.0 0.0 1.0 ] # g h i ]; + extraConfig = '' + key1 value1 + key2 value2 + ''; }; }; }; @@ -52,7 +56,10 @@ primary mode 1920x1080 filter nearest - transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000'' + transform 0.600000,0.000000,0.000000,0.000000,0.600000,0.000000,0.000000,0.000000,1.000000 + key1 value1 + key2 value2 + '' } ''; };