land.nix: switch monitor map for independent system configs
This commit is contained in:
parent
1abfe4fc8f
commit
727b783f96
3 changed files with 26 additions and 27 deletions
|
@ -1,18 +1,16 @@
|
|||
_: {
|
||||
modules.system.hardware.monitors = [
|
||||
{
|
||||
name = "Integrated laptop screen";
|
||||
device = "eDP-1";
|
||||
modules.system.hardware.monitors = {
|
||||
eDP-1 = {
|
||||
resolution = {
|
||||
x = 1920;
|
||||
y = 1080;
|
||||
};
|
||||
scale = 1;
|
||||
refresh_rate = 60;
|
||||
refreshRate = 60;
|
||||
position = {
|
||||
x = 0;
|
||||
y = 0;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib.types) str submodule int ints number listOf;
|
||||
inherit (lib.types) str submodule int ints number attrsOf listOf;
|
||||
in {
|
||||
options.modules.system.monitors = mkOption {
|
||||
options.modules.system.hardware.monitors = mkOption {
|
||||
description = "\n List of monitors to use\n ";
|
||||
default = [];
|
||||
type = listOf (submodule {
|
||||
default = {};
|
||||
type = attrsOf (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = str;
|
||||
description = "Give your monitor a cute name";
|
||||
default = "";
|
||||
};
|
||||
device = mkOption {
|
||||
type = str;
|
||||
description = "The actual device name of the monitor";
|
||||
default = "eDP-1";
|
||||
};
|
||||
resolution = mkOption {
|
||||
type = submodule {
|
||||
options = {
|
||||
|
@ -38,7 +28,7 @@ in {
|
|||
description = "monitor scale";
|
||||
default = 1.0;
|
||||
};
|
||||
refresh_rate = mkOption {
|
||||
refreshRate = mkOption {
|
||||
type = int;
|
||||
description = "monitor refresh rate (in Hz)";
|
||||
default = 60;
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
cfg = config.modules.usrEnv.desktops.hyprland;
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (config.modules.style) cursor;
|
||||
inherit (config.modules.hardware) monitors;
|
||||
inherit (config.modules.system.hardware) monitors;
|
||||
|
||||
inherit
|
||||
(inputs'.split-monitor-workspaces.packages)
|
||||
split-monitor-workspaces
|
||||
;
|
||||
inherit (lib) mkIf mkDefault;
|
||||
inherit (lib) flatten mkIf mkDefault mapAttrsToList;
|
||||
inherit (builtins) toString;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -68,11 +68,22 @@ in {
|
|||
# "Unknown-1,disable"
|
||||
# ];
|
||||
|
||||
# Thanks Poz for inspiration, using an attrset is actually much smarter
|
||||
# than using a normal list.
|
||||
monitor =
|
||||
map (
|
||||
m: "${m.device},${toString m.resolution.x}x${toString m.resolution.y}@${toString m.refresh_rate},${toString m.position.x}x${toString m.position.y},${toString m.scale},transform,${toString m.transform}"
|
||||
mapAttrsToList (
|
||||
name: m: let
|
||||
w = toString m.resolution.x;
|
||||
h = toString m.resolution.y;
|
||||
refreshRate = toString m.refreshRate;
|
||||
x = toString m.position.x;
|
||||
y = toString m.position.y;
|
||||
scale = toString m.scale;
|
||||
in "${name},${w}x${h}@${refreshRate},${x}x${y},${scale}"
|
||||
)
|
||||
monitors; #TODO: default value
|
||||
monitors;
|
||||
|
||||
workspace = flatten ()
|
||||
|
||||
# Workspace config
|
||||
workspace = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue