inhibitors=$(dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.GetInhibitors 2>/dev/null | awk '/object path/ {print $3}' | tr -d '\"')
if [[ -z "$inhibitors" ]]; then
    echo "No inhibitors found."
    exit 0
else
    # Loop through each inhibitor and get the application name
    for inhibitor in $inhibitors; do
        app_id=$(dbus-send --print-reply --dest=org.gnome.SessionManager "$inhibitor" org.gnome.SessionManager.Inhibitor.GetAppId 2>/dev/null | awk -F '"' '/string/ {print $2}')
        app_reason=$(dbus-send --print-reply --dest=org.gnome.SessionManager "$inhibitor" org.gnome.SessionManager.Inhibitor.GetReason 2>/dev/null | awk -F '"' '/string/ {print $2}')
        echo "Inhibitor: $inhibitor | App: $app_id | Reason: $app_reason"
    done
fi
