refactor: update hm module (#55)

This commit is contained in:
Michał
2023-07-04 18:38:41 +02:00
committed by GitHub
parent 129dbdee3e
commit f9219bffac

View File

@@ -66,19 +66,40 @@ in {
''; '';
}; };
width = mkNumericOption { x = mkNumericOption {
default.absolute = 800; default.relative = 0.5;
description = mdDoc '' description = mdDoc ''
How wide the input box and results are. The horizontal position, adjusted so that { relative = 0.5; } always centers the runner.
${numericInfo} ${numericInfo}
''; '';
}; };
position = mkOption { y = mkNumericOption {
type = with types; enum ["top" "center"]; default.absolute = 0;
default = "top"; description = mdDoc ''
description = "Where Anyrun is located on the screen (top or center)"; The vertical position, works the same as x.
${numericInfo}
'';
};
width = mkNumericOption {
default.absolute = 800;
description = mdDoc ''
The width of the runner.
${numericInfo}
'';
};
height = mkNumericOption {
default.absolute = 0;
description = mdDoc ''
The minimum height of the runner, the runner will expand to fit all the entries.
${numericInfo}
'';
}; };
verticalOffset = mkNumericOption { verticalOffset = mkNumericOption {
@@ -183,7 +204,7 @@ in {
else entry) else entry)
cfg.config.plugins; cfg.config.plugins;
in { in {
assertions = [(assertNumeric cfg.config.width) (assertNumeric cfg.config.verticalOffset)]; assertions = [(assertNumeric cfg.config.width) (assertNumeric cfg.config.height) (assertNumeric cfg.config.x) (assertNumeric cfg.config.y)];
warnings = warnings =
if cfg.config.plugins == null if cfg.config.plugins == null
@@ -205,9 +226,10 @@ in {
{ {
"anyrun/config.ron".text = '' "anyrun/config.ron".text = ''
Config( Config(
x: ${stringifyNumeric cfg.config.x},
y: ${stringifyNumeric cfg.config.y},
width: ${stringifyNumeric cfg.config.width}, width: ${stringifyNumeric cfg.config.width},
position: ${capitalize cfg.config.position}, height: ${stringifyNumeric cfg.config.height},
vertical_offset: ${stringifyNumeric cfg.config.verticalOffset},
hide_icons: ${lib.boolToString cfg.config.hideIcons}, hide_icons: ${lib.boolToString cfg.config.hideIcons},
ignore_exclusive_zones: ${lib.boolToString cfg.config.ignoreExclusiveZones}, ignore_exclusive_zones: ${lib.boolToString cfg.config.ignoreExclusiveZones},
layer: ${capitalize cfg.config.layer}, layer: ${capitalize cfg.config.layer},