aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/Polkit-NixOS.sh
blob: c1e6e0a26e99489e2e252051818528789f52afec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# ==================================================
#  KoolDots (2026)
#  Project URL: https://github.com/LinuxBeginnings
#  License: GNU GPLv3
#  SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# For NixOS starting of polkit agents. Prefer xfce4-polkit, fallback to polkit-gnome.

# Find all xfce4-polkit executables in the Nix store
xfce_polkit_paths=$(find /nix/store -name 'xfce4-polkit' -type f 2>/dev/null)

for xfce_polkit_path in $xfce_polkit_paths; do
  # Extract the directory containing the executable
  xfce_polkit_dir=$(dirname "$xfce_polkit_path")

  # Check if the executable is valid and exists
  if [ -x "$xfce_polkit_dir/xfce4-polkit" ]; then
    # Start the xfce4-polkit Authentication Agent
    "$xfce_polkit_dir/xfce4-polkit" &
    exit 0
  fi
done

# Find all polkit-gnome executables in the Nix store
polkit_gnome_paths=$(find /nix/store -name 'polkit-gnome-authentication-agent-1' -type f 2>/dev/null)

for polkit_gnome_path in $polkit_gnome_paths; do
  # Extract the directory containing the executable
  polkit_gnome_dir=$(dirname "$polkit_gnome_path")

  # Check if the executable is valid and exists
  if [ -x "$polkit_gnome_dir/polkit-gnome-authentication-agent-1" ]; then
    # Start the Polkit-GNOME Authentication Agent
    "$polkit_gnome_dir/polkit-gnome-authentication-agent-1" &
    exit 0
  fi
done

# If no valid executable is found, report an error
echo "No valid polkit authentication agent executable found."
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage