diff --git a/home/desktop/hyprland/default.nix b/home/desktop/hyprland/default.nix index a8a2396..78e4f96 100644 --- a/home/desktop/hyprland/default.nix +++ b/home/desktop/hyprland/default.nix @@ -44,6 +44,7 @@ "SUPER,Return,exec,${terminal}" "SUPERSHIFT,q,killactive" # exit program "SUPERSHIFT,e,exit" # exit hyprland + "SUPERSHIFT,r,exec,hyprctl reload" # reload currently running hyprland "SUPER,s,togglesplit" # horizontal split "SUPER,f,fullscreen,1" # borderless window @@ -81,6 +82,18 @@ ++ # move windows (lib.mapAttrsToList (key: direction: "SUPERCONTROL,${key},movewindoworgroup,${direction}") directions); + + monitor = map ( + m: "${m.name},${ + if m.enabled + then "${toString m.width}x${toString m.height}@${toString m.refreshRate},${m.position},1" + else "disable" + }" + ) config.monitors; + + workspace = map (m: "name:${m.workspace},monitor:${m.name}") ( + lib.filter (m: m.enabled && m.workspace != null) config.monitors + ); }; }; } diff --git a/home/yukari.nix b/home/yukari.nix index 14c3359..95dd45d 100644 --- a/home/yukari.nix +++ b/home/yukari.nix @@ -1,8 +1,28 @@ -# yukari is an arch-based (for now) distro running in Windows under WSL -# as such, it does not have or need a graphical shell -{ inputs, lib, pkgs, ... }: { +# yukari my main desktop workstation, running nixos +{ pkgs, ... }: { imports = [ ./global.nix ./desktop/hyprland ]; + + # ---------- ------ + # | HDMI-A-5 | | DP-5 | + # ---------- ------ + config.monitors = [ + { + name = "HDMI-A-5"; + width = 3440; + height = 1440; + workspace = "1"; + primary = true; + position = "0x0"; + } + { + name = "DP-5"; + width = 2560; + height = 1440; + workspace = "2"; + position = "3440x0"; + } + ]; } diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 45aae31..b843d63 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,6 +1,3 @@ -# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). -# These should be stuff you would like to share with others, not your personal configurations. { - # List your module files here - # my-module = import ./my-module.nix; + monitors = import ./monitors.nix; } diff --git a/modules/home-manager/monitors.nix b/modules/home-manager/monitors.nix new file mode 100644 index 0000000..daed4ed --- /dev/null +++ b/modules/home-manager/monitors.nix @@ -0,0 +1,59 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkOption types; +in { + options.monitors = mkOption { + type = types.listOf ( + types.submodule { + options = { + name = mkOption { + type = types.str; + example = "DP-1"; + }; + primary = mkOption { + type = types.bool; + default = false; + }; + width = mkOption { + type = types.int; + example = 1920; + }; + height = mkOption { + type = types.int; + example = 1080; + }; + refreshRate = mkOption { + type = types.int; + default = 60; + }; + position = mkOption { + type = types.str; + default = "auto"; + }; + enabled = mkOption { + type = types.bool; + default = true; + }; + workspace = mkOption { + type = types.nullOr types.str; + default = null; + }; + }; + } + ); + default = []; + }; + config = { + assertions = [ + { + assertion = + ((lib.length config.monitors) != 0) + -> ((lib.length (lib.filter (m: m.primary) config.monitors)) == 1); + message = "Exactly one monitor must be set to primary."; + } + ]; + }; +}