From f87e004153972f1975f584c2c6ed0f0d5863eb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 12 Mar 2026 19:22:33 +0100 Subject: [PATCH] media1: use UWSM for Hyprland session management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Matches the working pattern from gunter — UWSM properly sets up dbus and systemd targets, which is needed for PipeWire and xdg-desktop-portal. Co-Authored-By: Claude Opus 4.6 --- hosts/media1/media-desktop.nix | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) 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;