Avoid polkit prompts from shell network status

This commit is contained in:
Ryan Hughes
2026-06-10 13:10:03 -04:00
parent cd0b78cd0f
commit 4b2a15b6ea
2 changed files with 34 additions and 2 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ print_status() {
nm=$(nmcli -t -f GENERAL.STATE,GENERAL.CONNECTION dev show "$device" 2>/dev/null)
state=$(awk -F: '$1 == "GENERAL.STATE" { print $2; exit }' <<<"$nm")
ssid=$(awk -F: '$1 == "GENERAL.CONNECTION" { print $2; exit }' <<<"$nm")
signal=$(nmcli -t -f IN-USE,SIGNAL dev wifi list ifname "$device" 2>/dev/null | awk -F: '$1 == "*" { print $2; exit }')
signal=$(nmcli -t -f IN-USE,SIGNAL dev wifi list ifname "$device" --rescan no 2>/dev/null | awk -F: '$1 == "*" { print $2; exit }')
freq=$(iw dev "$device" link 2>/dev/null | awk '/freq:/ { print $2; exit }')
if [[ $state != 100* ]]; then
+33 -1
View File
@@ -114,6 +114,38 @@ hyprland_session_locked() {
[[ $monitors == *"session lock"* ]]
}
shell_quote() {
printf "'"
printf "%s" "$1" | sed "s/'/'\\\\''/g"
printf "'"
}
lua_quote() {
local value=$1
value=${value//\\/\\\\}
value=${value//\"/\\\"}
value=${value//$'\n'/\\n}
printf '"%s"' "$value"
}
launch_shell() {
local launch_command
launch_command="env OMARCHY_PATH=$(shell_quote "$omarchy_root") PATH=$(shell_quote "$PATH") quickshell -n -p $(shell_quote "$CONFIG_DIR")"
if [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]] && omarchy-cmd-present hyprctl; then
if hyprctl dispatch "hl.dsp.exec_cmd($(lua_quote "$launch_command"))" >/dev/null 2>&1; then
return 0
fi
if hyprctl dispatch exec "$launch_command" >/dev/null 2>&1; then
return 0
fi
fi
setsid quickshell -n -p "$CONFIG_DIR" >/dev/null 2>&1 &
}
restore_hyprland_session_lock() {
local attempt
@@ -141,7 +173,7 @@ fi
pkill -x quickshell 2>/dev/null || true
sleep 0.2
setsid quickshell -n -p "$CONFIG_DIR" >/dev/null 2>&1 &
launch_shell
if (( hyprland_was_session_locked )); then
restore_hyprland_session_lock