blob: 74a4e28d7bf5eed47bfbb94d90dabfcd0f331408 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/sh
# Show wifi 📶 and percent strength or 📡 if none.
# Show 🌐 if connected to ethernet or ❎ if none.
# Show 🔒 if a vpn connection is active
printconnection() {
[ "$(cat /sys/class/net/eth0/operstate 2>/dev/null)" = 'up' ] && ethericon="🌐" || ethericon="❎"
[ -n "$(cat /sys/class/net/wg0/operstate 2>/dev/null)" ] && tunicon=" 🔒"
printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon"
}
if [ ! -n "$1" ]; then
printconnection
else
if [ "$1" -eq 1 ]; then
if [ ! -n "$(cat /sys/class/net/wg0/operstate 2>/dev/null)" ];then
doas wg-quick up wg0
notify-send "🔒 Internet module" "Connected to VPN"
else
doas wg-quick down wg0
notify-send "🔒 Internet module" "Disconnected from VPN"
fi
elif [ "$1" -eq 3 ]; then
notify-send "🌐 Internet module" "\- Click to connect
❌: wifi disabled
📡: no wifi connection
📶: wifi connection with quality
❎: no ethernet
🌐: ethernet working
🔒: vpn is active
"
fi
fi
|