32 lines
988 B
Nix
32 lines
988 B
Nix
{ lib, config, pkgs, ... }:
|
|
|
|
with lib;
|
|
let
|
|
cfg = config.modules.desktop.monitors;
|
|
in {
|
|
options.modules.desktop.monitors = {
|
|
enable = mkEnableOption "Manually configure monitor settings, use if manual configuration is needed";
|
|
monitors = mkOption {
|
|
type = types.listOf types.attrs;
|
|
description = ''
|
|
a list of monitor configurations. each entry should be an attribute set with the following keys:
|
|
- `name`: The name of the monitor to configure
|
|
- `scale`: The scale factor to apply to the monitor
|
|
note: the first monitor in the list will be considered the "primary" monitor
|
|
'';
|
|
example = [
|
|
{ name = "eDP-1"; scale = 2.0; }
|
|
{ name = "HDMI-1"; scale = 1.0; }
|
|
];
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
hm.programs.niri.settings.outputs = builtins.listToAttrs (builtins.map (monitor: {
|
|
name = monitor.name;
|
|
value = {
|
|
scale = monitor.scale;
|
|
};
|
|
}) cfg.monitors);
|
|
};
|
|
}
|