Configure monitor per host

This commit is contained in:
Armel van Ravels
2026-06-22 11:06:20 +02:00
parent 0af25f781c
commit 83210c012c
2 changed files with 40 additions and 18 deletions

View File

@@ -67,5 +67,13 @@
};
hardware.bluetooth.enable = true;
services.blueman.enable = true;
home-manager.users.avravels.home.hyprland.monitors = [
{
output = "eDP-1";
mode = "1920x1200";
}
];
system.stateVersion = "25.11"; # Did you read the comment?
}

View File

@@ -9,13 +9,27 @@ let
in
{
options.home.hyprland = {
execOnce = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "waybar" ];
description = "Commands to run once when Hyprland starts (maps to Hyprland `exec-once`).";
};
options.home.hyprland.monitors = lib.mkOption {
type = lib.types.listOf (lib.types.submodule {
options = {
output = lib.mkOption { type = lib.types.str; };
mode = lib.mkOption {
type = lib.types.str;
default = "preferred";
};
position = lib.mkOption {
type = lib.types.str;
default = "auto";
};
scale = lib.mkOption {
type = lib.types.number;
default = 1;
};
};
});
default = [ ];
};
config = {
home.packages = with pkgs; [
bzmenu
@@ -33,6 +47,12 @@ in
mkLuaInline = lib.generators.mkLuaInline;
toLua = lib.generators.toLua;
mkArgs = args: { _args = args; };
defaultMonitor = {
output = "";
mode = "preferred";
position = "auto";
scale = 1;
};
bind =
keys: dispatcher: options:
mkArgs [
@@ -166,18 +186,12 @@ in
(mkLuaInline ''
function()
hl.exec_cmd("waybar")
hl.monitor({
output = "",
mode = "preferred",
position = "auto",
scale = 1,
})
hl.monitor({
output = "eDP-1",
mode = "1920x1200",
position = "auto",
scale = 1,
})
hl.monitor(${lib.generators.toLua {} defaultMonitor})
${lib.concatMapStringsSep "\n"
(m: "hl.monitor(${lib.generators.toLua {} m})")
cfg.monitors}
end'')
];
};