feat: remove st

This commit is contained in:
ange 2025-06-29 09:30:03 +00:00
parent 40b8304dce
commit 17b03778ac
Signed by: ange
GPG key ID: 9E0C4157BB7BEB1D
31 changed files with 54 additions and 7057 deletions

View file

@ -7,20 +7,26 @@ if tty -s; then
SUDO=sudo
fi
if [ "$EUID" != 0 ]; then
exec "$SUDO" env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" \
XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" "$BASH" -- "${BASH_SOURCE[0]}" "$@"
fi
d="$(mktemp -d)"
# shellcheck disable=SC2064
trap "rm -rf '$d'" EXIT
touch "$d/"{1..2}
CMD=()
while read -r i; do
CMD+=("wg-quick down '$i'")
done < <(ip -br link show type wireguard | awk '{print $1}')
if [ "$1" != off ]; then
set -- "$(basename -s.conf "/etc/wireguard/$1"*.conf | "$DMENU")"
if ! wg | grep -q "$1"; then
wg-quick up "$1"
fi
CMD=(
"basename -s.conf '/etc/wireguard/$1'*.conf > '$d/1'"
"inotifywait -e close_write '$d/2'"
"${CMD[@]}"
"wg-quick up \"\$(cat '$d/2')\""
)
fi
while read -r i; do
wg-quick down "$i"
done < <(ip -br link show type wireguard | awk "\$1 != \"$1\"{print \$1}")
(inotifywait -e close_write "$d/1"; "$DMENU" < "$d/1" > "$d/2") &
"$SUDO" bash -c "${CMD[*]/%/;}"
touch "$XDG_RUNTIME_DIR/sbar/vpn"