improve notifications for mozvpn

This commit is contained in:
2025-06-20 21:43:34 +02:00
parent 807b2f52a5
commit b6f2026113

View File

@ -1,14 +1,22 @@
#!/bin/bash #!/bin/bash
STATE=$(mozillavpn status | grep "VPN state" | awk '{print $3}') STATE=$(mozillavpn status | grep "VPN state" | awk '{print $3}')
LOCATION=$(mozillavpn status | grep "Server city" | awk '{print $3}')
if [ "$STATE" == "off" ]; then if [ "$STATE" == "off" ]; then
mozillavpn activate FEEDBACK=$(mozillavpn activate)
notify-send -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "VPN Activated" if [[ $FEEDBACK == *"The VPN tunnel is now active"* ]]; then
notify-send -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "VPN Activated: $LOCATION"
else
notify-send --urgency=critical -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "Error"
fi
fi fi
if [ "$STATE" == "on" ]; then if [ "$STATE" == "on" ]; then
mozillavpn deactivate FEEDBACK=$(mozillavpn deactivate)
if [[ $FEEDBACK == *"The VPN tunnel is now inactive"* ]]; then
notify-send -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "VPN Deactivated" notify-send -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "VPN Deactivated"
else
notify-send --urgency=critical -i /usr/share/icons/hicolor/32x32/apps/mozillavpn.png "Mozilla VPN" "Error"
fi
fi fi