summaryrefslogtreecommitdiff
path: root/modules/hyprland/monitor.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/hyprland/monitor.nix')
-rw-r--r--modules/hyprland/monitor.nix153
1 files changed, 73 insertions, 80 deletions
diff --git a/modules/hyprland/monitor.nix b/modules/hyprland/monitor.nix
index ef3f227..f9d951e 100644
--- a/modules/hyprland/monitor.nix
+++ b/modules/hyprland/monitor.nix
@@ -5,88 +5,81 @@ in
{
imports = [ ../waybar ];
- options.hyprland.monitors =
- with lib;
- mkOption {
+ options.hyprland.monitors = with lib; mkOption {
description = "Hyprland Monitor Configuration";
type = types.attrsOf (
types.submodule {
- options = {
- resolution = mkOption {
- description = "Monitor Resolution";
- type = types.strMatching "[:digit:]+x[:digit:]+|preferred";
- default = "preferred";
- };
- position = mkOption {
- description = "Monitor Position";
- type = types.strMatching "-?[:digit:]+x-?[:digit:]+|auto";
- default = "auto";
- };
- scale = mkOption {
- description = "Monitor Scale";
- type = types.numbers.positive;
- default = 1;
- };
- mirror = mkOption {
- description = "Mirror Monitor";
- type = types.submodule {
- options = {
- enable = mkOption {
- description = "Enable Mirroring";
- type = types.bool;
- default = false;
- };
- monitor = mkOption {
- description = "Mirror Monitor Name";
- type = types.str;
- default = "";
- };
- };
- };
- default = { enable = false; };
- };
- transform = mkOption {
- description = "Hyprland Monitor Transform";
- type = types.submodule {
options = {
- flipped = mkOption {
- description = "Hyprland Flip Monitor";
- type = types.bool;
- default = false;
+ resolution = mkOption {
+ description = "Monitor Resolution";
+ type = types.strMatching "[0-9]+x[0-9]+|preferred";
+ default = "preferred";
};
- rotation = mkOption {
- description = "Hyprland Monitor Rotation";
- type = types.enum [
- 0
- 90
- 180
- 270
- ];
- default = 0;
+ position = mkOption {
+ description = "Monitor Position";
+ type = types.strMatching "-?[0-9]+x-?[0-9]+|auto";
+ default = "auto";
};
- };
- };
- default = {
- flipped = false;
- rotation = 0;
- };
- };
- bar = mkOption {
- description = "Waybar Settings";
- type = types.submodule {
- options = {
- enable = mkOption {
- description = "Enable Waybar for this Monitor";
- type = types.bool;
- default = false;
+ scale = mkOption {
+ description = "Monitor Scale";
+ type = types.numbers.positive;
+ default = 1;
+ };
+ mirror = mkOption {
+ description = "Mirror Monitor";
+ type = types.submodule {
+ options = {
+ enable = mkOption {
+ description = "Enable Mirroring";
+ type = types.bool;
+ default = false;
+ };
+ monitor = mkOption {
+ description = "Mirror Monitor Name";
+ type = types.str;
+ default = "";
+ };
+ };
+ };
+ default = { enable = false; };
+ };
+ transform = mkOption {
+ description = "Hyprland Monitor Transform";
+ type = types.submodule {
+ options = {
+ flipped = mkOption {
+ description = "Hyprland Flip Monitor";
+ type = types.bool;
+ default = false;
+ };
+ rotation = mkOption {
+ description = "Hyprland Monitor Rotation";
+ type = types.enum [ 0 90 180 270 ];
+ default = 0;
+ };
+ };
+ };
+ default = {
+ flipped = false;
+ rotation = 0;
+ };
+ };
+ bar = mkOption {
+ description = "Waybar Settings";
+ type = types.submodule {
+ options = {
+ enable = mkOption {
+ description = "Enable Waybar for this Monitor";
+ type = types.bool;
+ default = false;
+ };
+ };
+ };
+ default = {
+ enable = false;
};
};
};
- default = {
- enable = false;
- };
- };
- };
}
);
default = {
@@ -98,13 +91,13 @@ in
home-manager.users.n8.wayland.windowManager.hyprland.settings.monitor =
lib.attrsets.mapAttrsToList
(
- name: value:
- "${if name == "default" then "" else name},${value.resolution},"
- + "${value.position},"
- + "${toString value.scale},"
- + "transform,"
- + "${toString ((value.transform.rotation / 90) + (if value.transform.flipped then 4 else 0))}"
- + (if value.mirror.enable then ",mirror," + value.mirror.monitor else "")
+ name: value: {
+ output = (if name == "default" then "" else name);
+ mode = value.resolution;
+ scale = value.scale;
+ transform = ((value.transform.rotation / 90) + (if value.transform.flipped then 4 else 0));
+ position = value.position;
+ }
)
cfg;