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; hardware.bluetooth.enable = true;
services.blueman.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? system.stateVersion = "25.11"; # Did you read the comment?
} }

View File

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