Files
nix/hosts/common/configs/user/gui/hyprland/options.nix
Nikolaos Karaolidis b12fa0e811 Switch to uwsm
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-06-03 13:00:07 +01:00

48 lines
1.1 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.wayland.windowManager.hyprland;
in
{
options.wayland.windowManager.hyprland =
with lib;
with types;
{
onMonitorChange.services = mkOption {
type = listOf str;
default = [ ];
description = "Services to restart when a monitor is connected or disconnected";
};
};
config.systemd.user.services.hyprland-monitor-watcher = {
Unit = {
Description = "Restarts services on monitor change";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "hyprland-monitor-watcher";
runtimeInputs = with pkgs; [
socat
systemd
];
runtimeEnv.SERVICES = lib.strings.concatStringsSep " " cfg.onMonitorChange.services;
text = builtins.readFile ./scripts/monitors.sh;
}
);
Restart = "on-failure";
};
Install.WantedBy = [ "graphical-session.target" ];
};
}