From 6a9941771a70e6d631647ab3b88aafa57072e2e6 Mon Sep 17 00:00:00 2001 From: Pathfinder Date: Tue, 27 Oct 2026 14:37:41 +0100 Subject: [PATCH] polkit-kde agent never starts in niri: strip OnlyShowIn=KDE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VM error persisted with polkit-kde installed: the package's autostart .desktop carries OnlyShowIn=KDE;, so XDG autostart (which niri honors via xdg-desktop-autostart.target) skips the agent in a niri session. Package present, agent never running — exactly the observed behavior. install_session_prereqs now rewrites the .desktop without the OnlyShowIn line in place (idempotent: only rewrites when the line is present). --- lib/session.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/session.sh b/lib/session.sh index d6f4cde..0ed7a7e 100644 --- a/lib/session.sh +++ b/lib/session.sh @@ -82,9 +82,11 @@ write_x11_session() { # Common login-time plumbing every Wayland compositor wants on a bare install. install_session_prereqs() { - # polkit-kde ships the agent AND its /etc/xdg/autostart .desktop itself — - # no manual wiring needed. (polkit-gnome is orphaned, EPEL-only: not on F44, - # which is why the first attempt failed with "No match for argument".) + # polkit-kde ships the agent (polkit-gnome is orphaned, EPEL-only). + # BUT its autostart file has OnlyShowIn=KDE; — XDG autostart SKIPS it in a + # niri/Hyprland/MangoWC session (VM-proven: package installed, error + # persisted). Copy the .desktop without the OnlyShowIn line so the agent + # starts in every session; the copy shadows the original by name. install_packages \ xdg-desktop-portal \ polkit \ @@ -92,4 +94,14 @@ install_session_prereqs() { pipewire \ pipewire-pulseaudio \ wireplumber + + local src="${POLKIT_AGENT_DESKTOP:-/etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop}" + local dst="${XDG_AUTOSTART_DIR:-/etc/xdg/autostart}/polkit-kde-authentication-agent-1.desktop" + # src and dst are the same file in production — the condition to rewrite + # is "the file still contains OnlyShowIn", not "dst lacks it". + if [[ -f "$src" ]] && grep -q "^OnlyShowIn=" "$src" 2>/dev/null; then + info "Making polkit agent session-agnostic (stripping OnlyShowIn=KDE)..." + sudo mkdir -p "$(dirname "$dst")" + grep -v '^OnlyShowIn=' "$src" | sudo tee "$dst" >/dev/null + fi }