summaryrefslogtreecommitdiff
path: root/modules/hyprland
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-04-10 14:51:56 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2025-04-10 14:51:56 +0200
commitb127625d59d1cbf7a8962c1c937846b5297877c6 (patch)
treec99130393f3c04fa313a8e33997e953645627249 /modules/hyprland
parent2eb7439ab9b7f83fc81eb4d2299d2c764722008d (diff)
flake: update
Diffstat (limited to 'modules/hyprland')
-rw-r--r--modules/hyprland/monitor.nix205
1 files changed, 112 insertions, 93 deletions
diff --git a/modules/hyprland/monitor.nix b/modules/hyprland/monitor.nix
index 7aafb7f..ef3f227 100644
--- a/modules/hyprland/monitor.nix
+++ b/modules/hyprland/monitor.nix
@@ -1,101 +1,120 @@
{ config, lib, ... }:
let
- cfg = config.hyprland.monitors;
+cfg = config.hyprland.monitors;
in
{
- imports = [ ../waybar ];
+ imports = [ ../waybar ];
- 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;
- };
- 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 = {
- default = { };
- };
- };
+ 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;
+ };
+ 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 = {
+ default = { };
+ };
+ };
- config = {
- 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))}"
- )
- cfg;
+ config = {
+ 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 "")
+ )
+ cfg;
- bar = builtins.map (m: m.name) (
- builtins.filter (m: m.enable) (
- lib.attrsets.mapAttrsToList (name: value: {
- name = name;
- enable = value.bar.enable;
- }) cfg
- )
- );
- };
+ bar = builtins.map (m: m.name) (
+ builtins.filter (m: m.enable) (
+ lib.attrsets.mapAttrsToList (name: value: {
+ name = name;
+ enable = value.bar.enable;
+ }) cfg
+ )
+ );
+ };
}