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 = [
|
modules.system.hardware.monitors = {
|
||||||
{
|
eDP-1 = {
|
||||||
name = "Integrated laptop screen";
|
|
||||||
device = "eDP-1";
|
|
||||||
resolution = {
|
resolution = {
|
||||||
x = 1920;
|
x = 1920;
|
||||||
y = 1080;
|
y = 1080;
|
||||||
};
|
};
|
||||||
scale = 1;
|
scale = 1;
|
||||||
refresh_rate = 60;
|
refreshRate = 60;
|
||||||
position = {
|
position = {
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
];
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib) mkOption;
|
inherit (lib) mkOption;
|
||||||
inherit (lib.types) str submodule int ints number listOf;
|
inherit (lib.types) str submodule int ints number attrsOf listOf;
|
||||||
in {
|
in {
|
||||||
options.modules.system.monitors = mkOption {
|
options.modules.system.hardware.monitors = mkOption {
|
||||||
description = "\n List of monitors to use\n ";
|
description = "\n List of monitors to use\n ";
|
||||||
default = [];
|
default = {};
|
||||||
type = listOf (submodule {
|
type = attrsOf (submodule {
|
||||||
options = {
|
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 {
|
resolution = mkOption {
|
||||||
type = submodule {
|
type = submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -38,7 +28,7 @@ in {
|
||||||
description = "monitor scale";
|
description = "monitor scale";
|
||||||
default = 1.0;
|
default = 1.0;
|
||||||
};
|
};
|
||||||
refresh_rate = mkOption {
|
refreshRate = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "monitor refresh rate (in Hz)";
|
description = "monitor refresh rate (in Hz)";
|
||||||
default = 60;
|
default = 60;
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
cfg = config.modules.usrEnv.desktops.hyprland;
|
cfg = config.modules.usrEnv.desktops.hyprland;
|
||||||
inherit (config.modules.other.system) username;
|
inherit (config.modules.other.system) username;
|
||||||
inherit (config.modules.style) cursor;
|
inherit (config.modules.style) cursor;
|
||||||
inherit (config.modules.hardware) monitors;
|
inherit (config.modules.system.hardware) monitors;
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
(inputs'.split-monitor-workspaces.packages)
|
(inputs'.split-monitor-workspaces.packages)
|
||||||
split-monitor-workspaces
|
split-monitor-workspaces
|
||||||
;
|
;
|
||||||
inherit (lib) mkIf mkDefault;
|
inherit (lib) flatten mkIf mkDefault mapAttrsToList;
|
||||||
inherit (builtins) toString;
|
inherit (builtins) toString;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -68,11 +68,22 @@ in {
|
||||||
# "Unknown-1,disable"
|
# "Unknown-1,disable"
|
||||||
# ];
|
# ];
|
||||||
|
|
||||||
|
# Thanks Poz for inspiration, using an attrset is actually much smarter
|
||||||
|
# than using a normal list.
|
||||||
monitor =
|
monitor =
|
||||||
map (
|
mapAttrsToList (
|
||||||
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}"
|
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 config
|
||||||
workspace = [
|
workspace = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue