mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
refactor: split overloaded modules
This commit is contained in:
parent
234ab50a2c
commit
15f5c2552d
15 changed files with 638 additions and 586 deletions
42
modules/desktop/niri/outputs.nix
Normal file
42
modules/desktop/niri/outputs.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
hasMonitors = config.monitors != [];
|
||||
primaryMonitorName =
|
||||
if hasMonitors
|
||||
then (builtins.head config.monitors).name or ""
|
||||
else "";
|
||||
in {
|
||||
config = lib.mkIf config.fireproof.desktop.windowManager.enable {
|
||||
fireproof.home-manager.programs.niri.settings = {
|
||||
workspaces = lib.mkIf (primaryMonitorName != "") {
|
||||
"01".open-on-output = primaryMonitorName;
|
||||
"02".open-on-output = primaryMonitorName;
|
||||
"03".open-on-output = primaryMonitorName;
|
||||
"04".open-on-output = primaryMonitorName;
|
||||
"05".open-on-output = primaryMonitorName;
|
||||
};
|
||||
|
||||
outputs = lib.mkIf (config.monitors != []) (
|
||||
lib.listToAttrs (map (monitor: {
|
||||
inherit (monitor) name;
|
||||
value = {
|
||||
inherit (monitor) position;
|
||||
mode = lib.mkIf (monitor.resolution.width != null && monitor.resolution.height != null) {
|
||||
inherit (monitor.resolution) width height;
|
||||
refresh = monitor.refreshRateNiri;
|
||||
};
|
||||
focus-at-startup = monitor.name == primaryMonitorName;
|
||||
transform.rotation =
|
||||
if (monitor.transform != null)
|
||||
then monitor.transform * 90
|
||||
else 0;
|
||||
};
|
||||
})
|
||||
config.monitors)
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue