diff --git a/hosts/media1/media-desktop.nix b/hosts/media1/media-desktop.nix index 9a7b46e..2c7a500 100644 --- a/hosts/media1/media-desktop.nix +++ b/hosts/media1/media-desktop.nix @@ -11,7 +11,7 @@ let p.inputstream-adaptive ]); - hyprlandConfig = pkgs.writeText "hyprland.conf" '' + hyprlandConfig = '' # Monitor — auto-detect, native resolution monitor = , preferred, auto, 1 @@ -54,31 +54,37 @@ let disable_splash_rendering = true } ''; - - launchHyprland = pkgs.writeShellApplication { - name = "launch-hyprland"; - runtimeInputs = [ pkgs.hyprland ]; - text = '' - export XDG_SESSION_TYPE=wayland - exec Hyprland --config ${hyprlandConfig} - ''; - }; in { - # Hyprland compositor - programs.hyprland.enable = true; + # Hyprland compositor with UWSM for proper dbus/systemd session management + programs.hyprland = { + enable = true; + withUWSM = true; + portalPackage = pkgs.xdg-desktop-portal-hyprland; + }; - # greetd for auto-login into Hyprland + # greetd for auto-login — UWSM starts Hyprland as a systemd session services.greetd = { enable = true; settings = { default_session = { - command = lib.getExe launchHyprland; + command = "uwsm start hyprland-uwsm.desktop"; user = "kodi"; }; }; }; + # Deploy Hyprland config to kodi user's XDG config dir + systemd.tmpfiles.rules = [ + "d /home/kodi/.config/hypr 0755 kodi kodi -" + ]; + environment.etc."skel/hypr/hyprland.conf".text = hyprlandConfig; + system.activationScripts.hyprlandConfig = lib.stringAfter [ "users" ] '' + install -D -o kodi -g kodi -m 0644 /dev/stdin /home/kodi/.config/hypr/hyprland.conf <<'HYPRCONF' + ${hyprlandConfig} + HYPRCONF + ''; + # Kodi user users.users.kodi = { isNormalUser = true;