From ea3ea44d976deb53e3d5ff0e7df11b9ad908ac9a Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sat, 10 Feb 2024 01:30:31 +0545 Subject: [PATCH] feat(script): Integrate Polkit.sh into System_cmd.sh --- config/hypr/UserConfigs/Startup_Apps.conf | 2 +- config/hypr/scripts/Polkit.sh | 29 ----------------------- config/hypr/scripts/System_cmd.sh | 28 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 30 deletions(-) delete mode 100755 config/hypr/scripts/Polkit.sh diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf index 69d958af..6d48a012 100644 --- a/config/hypr/UserConfigs/Startup_Apps.conf +++ b/config/hypr/UserConfigs/Startup_Apps.conf @@ -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 diff --git a/config/hypr/scripts/Polkit.sh b/config/hypr/scripts/Polkit.sh deleted file mode 100755 index 64b5ff12..00000000 --- a/config/hypr/scripts/Polkit.sh +++ /dev/null @@ -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 diff --git a/config/hypr/scripts/System_cmd.sh b/config/hypr/scripts/System_cmd.sh index cfa28236..9fc876b2 100755 --- a/config/hypr/scripts/System_cmd.sh +++ b/config/hypr/scripts/System_cmd.sh @@ -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 +}