Switch to uwsm

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-06-03 13:00:07 +01:00
parent 1f44a8b6bc
commit b12fa0e811
19 changed files with 153 additions and 190 deletions

View File

@@ -20,13 +20,17 @@
})
];
programs.hyprland.enable = true;
programs.hyprland = {
enable = true;
withUWSM = true;
};
home-manager.users.${user} = {
imports = [ ./options.nix ];
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = false;
settings = {
"$mod" = "Super";
@@ -47,7 +51,7 @@
);
in
[
"$mod, Return, exec, $term"
"$mod, Return, exec, uwsm app -- $term"
"$mod, 1, exec, ${bindHelper} 1"
"$mod, 2, exec, ${bindHelper} 2"
@@ -96,7 +100,7 @@
"$mod, Space, centerwindow"
"$mod, q, killactive"
"Ctrl_Alt, Delete, exit"
"Ctrl_Alt, Delete, exec, uwsm stop"
];
binde = [
@@ -157,8 +161,8 @@
};
programs.zsh.loginExtra = lib.mkAfter ''
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
Hyprland 2> >(systemd-cat -p err -t hyprland) 1> >(systemd-cat -p info -t hyprland)
if uwsm check may-start; then
exec uwsm start hyprland-uwsm.desktop
fi
'';

View File

@@ -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" ];
};
}