From 5fb19f10389b70ee2389755106092a9ef6c64598 Mon Sep 17 00:00:00 2001 From: David Moc Date: Sun, 24 May 2026 11:48:07 +0200 Subject: Go --- polybar/scripts/polkit-agent.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 polybar/scripts/polkit-agent.sh (limited to 'polybar/scripts/polkit-agent.sh') diff --git a/polybar/scripts/polkit-agent.sh b/polybar/scripts/polkit-agent.sh new file mode 100755 index 0000000..ed86a5f --- /dev/null +++ b/polybar/scripts/polkit-agent.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +export DISPLAY="${DISPLAY:-:0}" +if [ -z "${XAUTHORITY:-}" ] && [ -r "$HOME/.Xauthority" ]; then + export XAUTHORITY="$HOME/.Xauthority" +fi + +if pgrep -u "$UID" -f 'polkit-gnome-authentication-agent-1|polkit-kde-authentication-agent-1|lxqt-policykit-agent|polkit-mate-authentication-agent-1|xfce-polkit' >/dev/null 2>&1; then + exit 0 +fi + +agents=( + /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 + /usr/lib/polkit-kde-authentication-agent-1 + /usr/lib/lxqt-policykit/lxqt-policykit-agent + /usr/bin/lxqt-policykit-agent + /usr/lib/mate-polkit/polkit-mate-authentication-agent-1 + /usr/lib/xfce-polkit/xfce-polkit +) + +for agent in "${agents[@]}"; do + if [ -x "$agent" ]; then + exec "$agent" + fi +done + +echo "No supported polkit authentication agent found" >&2 +exit 1 -- cgit v1.2.3