Switch to uwsm
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -12,18 +12,6 @@ in
|
||||
with lib;
|
||||
with types;
|
||||
{
|
||||
initExtraConfig = mkOption {
|
||||
type = lines;
|
||||
default = "";
|
||||
description = "Extra configuration lines to add to exec-once";
|
||||
};
|
||||
|
||||
reloadExtraConfig = mkOption {
|
||||
type = lines;
|
||||
default = "";
|
||||
description = "Extra configuration lines to add to exec";
|
||||
};
|
||||
|
||||
onMonitorChange.services = mkOption {
|
||||
type = listOf str;
|
||||
default = [ ];
|
||||
@@ -31,37 +19,29 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
wayland.windowManager.hyprland.initExtraConfig =
|
||||
lib.mkIf (cfg.onMonitorChange.services != [ ])
|
||||
"${
|
||||
lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "hyprland-monitor-change-services";
|
||||
runtimeInputs = with pkgs; [
|
||||
socat
|
||||
systemd
|
||||
];
|
||||
runtimeEnv.SERVICES = lib.strings.concatStringsSep " " cfg.onMonitorChange.services;
|
||||
text = builtins.readFile ./scripts/monitors.sh;
|
||||
}
|
||||
)
|
||||
} &";
|
||||
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
exec-once = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "init-hyprland";
|
||||
text = cfg.initExtraConfig;
|
||||
}
|
||||
);
|
||||
|
||||
exec = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "reload-hyprland";
|
||||
text = cfg.reloadExtraConfig;
|
||||
}
|
||||
);
|
||||
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" ];
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user