diff options
Diffstat (limited to 'dot_config/i3/scripts/executable_vpn')
-rw-r--r-- | dot_config/i3/scripts/executable_vpn | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/dot_config/i3/scripts/executable_vpn b/dot_config/i3/scripts/executable_vpn new file mode 100644 index 0000000..a348f96 --- /dev/null +++ b/dot_config/i3/scripts/executable_vpn | |||
@@ -0,0 +1,25 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # | ||
3 | # Copyright (C) 2021 Andreas Lindlbauer | ||
4 | # Licensed under the terms of EUPLv1.2. | ||
5 | # | ||
6 | # i3blocks blocklet script to monitor the (nord)vpn connection | ||
7 | |||
8 | vpnstatus="📢" | ||
9 | nordvpn_output=$(nordvpn status | cat -v | head -1 | sed -e 's/\^M-^M ^M//g' ) | ||
10 | if [ "${nordvpn_output}" = "Status: Connected" ]; then | ||
11 | vpnstatus="🥸" | ||
12 | elif [ "${nordvpn_output}" = "A new version of NordVPN is available! Please update the application." ]; then | ||
13 | nordvpn_output=$(nordvpn status | cat -v | head -2 | tail -1 | sed -e 's/\^M-^M ^M//g' ) | ||
14 | if [ "${nordvpn_output}" = "Status: Connected" ]; then | ||
15 | vpnstatus="🥴" | ||
16 | elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then | ||
17 | vpnstatus="📢" | ||
18 | fi | ||
19 | elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then | ||
20 | vpnstatus="📢" | ||
21 | elif [[ "$nordvpn_output" == *\/* ]] || [[ "$nordvpn_output" == *\\* ]]; then | ||
22 | vpnstatus="Something's very wrong" | ||
23 | fi | ||
24 | |||
25 | echo "$vpnstatus" | ||