feat(script): Integrate Polkit.sh into System_cmd.sh

This commit is contained in:
sankalp committed 2024-02-10 01:30:31 +05:45
1 parent 015d7da42f
commit ea3ea44d97
3 files changed
+29 -30

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CUR
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# Polkit (Polkit Gnome / KDE)
exec-once = $scriptsDir/Polkit.sh
exec-once = $RunCMD polkit_
# Battery Notification
exec-once = $RunCMD battery_notify
-29
View File
@@ -1,29 +0,0 @@
#!/bin/bash
# This is for polkits, it will start from top and will stop if the top is executed
# Polkit possible paths files to check
polkit=(
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
"/usr/lib/polkit-kde-authentication-agent-1"
"/usr/lib/polkit-gnome-authentication-agent-1"
"/usr/libexec/polkit-gnome-authentication-agent-1"
"/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1"
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
)
executed=false # Flag to track if a file has been executed
# Loop through the list of files
for file in "${polkit[@]}"; do
if [ -e "$file" ]; then
echo "File $file found, executing command..."
exec "$file"
executed=true
break
fi
done
# If none of the files were found, you can add a fallback command here
if [ "$executed" == false ]; then
echo "None of the specified files were found. Install a Polkit"
fi
+28
View File
@@ -375,3 +375,31 @@ while true; do
done
}
polkit_(){
polkit=(
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
"/usr/lib/polkit-kde-authentication-agent-1"
"/usr/lib/polkit-gnome-authentication-agent-1"
"/usr/libexec/polkit-gnome-authentication-agent-1"
"/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1"
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
)
executed=false # Flag to track if a file has been executed
# Loop through the list of files
for file in "${polkit[@]}"; do
if [ -e "$file" ]; then
echo "File $file found, executing command..."
exec "$file"
executed=true
break
fi
done
# If none of the files were found, you can add a fallback command here
if [ "$executed" == false ]; then
echo "None of the specified files were found. Install a Polkit"
fi
}