dotfiles

commit b6855b856050d6be18a2a3f50089559ed47478cb

Author: Honza Pokorny <me@honza.ca>

Simplify vpn script

 bin/is-vpn-connected | 18 ++----------------


diff --git a/bin/is-vpn-connected b/bin/is-vpn-connected
index 178f3c29a78402dba4bd48ee86de4980b0b1d2c8..4cd5abc296ae5b5865f815f5c7d0b3d25711a461 100755
--- a/bin/is-vpn-connected
+++ b/bin/is-vpn-connected
@@ -1,22 +1,8 @@
-#!/usr/bin/env python
+#!/usr/bin/env bash
 
 # Status code:
 #
 #   0 => Connected
 #   1 => Not connected
 
-import subprocess
-
-cmd = 'nmcli --terse connection show --active'
-
-def main():
-    out = subprocess.check_output(cmd.split(' '))
-    for line in out.splitlines():
-        if 'vpn' in str(line):
-            print('{"text": "VPN: up"}')
-            return
-
-    print('{"text": "VPN: down"}')
-
-
-main()
+nmcli --terse connection show --active | grep vpn