Skip to content

Commit

Permalink
autorandr: configModule.extraConfig
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zackattackz authored Sep 13, 2024
1 parent ef50612 commit 433e686
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 14 additions & 1 deletion modules/programs/autorandr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''
'';
};
};
};

Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion tests/modules/programs/autorandr/basic-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
};
};
};
Expand Down Expand Up @@ -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
''
}
'';
};
Expand Down

0 comments on commit 433e686

Please sign in to comment.