From 2c5692e76b2903433263c5f692ab73bca259c4a1 Mon Sep 17 00:00:00 2001 From: KoenDR06 Date: Tue, 15 Jul 2025 19:57:00 +0200 Subject: [PATCH] monitors added to hypr config --- machines/luna/modules.nix | 10 ++++++++++ machines/terra/modules.nix | 16 ++++++++++++++++ modules/wm/hyprland/default.nix | 4 ++++ modules/wm/hyprland/options.nix | 25 ++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/machines/luna/modules.nix b/machines/luna/modules.nix index 401a3b3..8b017e4 100644 --- a/machines/luna/modules.nix +++ b/machines/luna/modules.nix @@ -26,6 +26,16 @@ wm = { hyprland.enable = true; + + config = { + monitors.displays = [ + { + output = "eDP-1"; + x = 0; + y = 0; + } + ]; + }; }; hardware = { diff --git a/machines/terra/modules.nix b/machines/terra/modules.nix index c892856..2b9fe00 100644 --- a/machines/terra/modules.nix +++ b/machines/terra/modules.nix @@ -26,6 +26,22 @@ wm.hyprland = { enable = true; + + config.monitors = { + displays = [ + { + output = "DP-2"; + x = 0; + y = 0; + } + { + output = "DP-3"; + x = -1440; + y = 0; + transform = 1; + } + ]; + }; }; hardware = { diff --git a/modules/wm/hyprland/default.nix b/modules/wm/hyprland/default.nix index e2cda6a..e92eae9 100644 --- a/modules/wm/hyprland/default.nix +++ b/modules/wm/hyprland/default.nix @@ -126,6 +126,10 @@ in { workspace_swipe = ${trivial.boolToString cfg.config.gestures.workspaceSwipe} } + ${builtins.concatStringsSep "\n" (map (mon: "monitor = ${mon.output}, ${mon.resolution}@${mon.refreshRate}, ${toString mon.x}x${toString mon.y}, ${strings.floatToString mon.scale}, transform, ${toString mon.transform}") cfg.config.monitors.displays)} + + ${if cfg.config.monitors.defaultMonitor then "monitor = ,preferred, auto, auto" else ""} + ${builtins.concatStringsSep "\n" (map (ws: "workspace = " + ws) cfg.config.workspaces)} ${builtins.concatStringsSep "\n" (map (wr: "windowrule = " + replaceStrings ["%"] ["%%"] wr) cfg.config.windowrules)} diff --git a/modules/wm/hyprland/options.nix b/modules/wm/hyprland/options.nix index 0b1fda5..86cff92 100644 --- a/modules/wm/hyprland/options.nix +++ b/modules/wm/hyprland/options.nix @@ -398,7 +398,30 @@ in { }; }; - + monitors = { + defaultMonitor = mkOption { + type = types.bool; + default = true; + }; + + displays = mkOption { + type = types.listOf (types.submodule { + options = { + output = mkOption { type = types.str; }; + resolution = mkOption { type = types.str; default = "highres"; }; + refreshRate = mkOption { type = types.str; default = "highrr"; }; + x = mkOption { type = types.int; }; + y = mkOption { type = types.int; }; + scale = mkOption { type = types.number; default = 1; }; + transform = mkOption { type = types.enum [ 0 1 2 3 4 5 6 7 ]; default = 0; }; + }; + }); + }; + }; + + keybindings = { + + }; }; }; };