summaryrefslogtreecommitdiffstats
path: root/toggle-nm
blob: 2f5511954de73c21243e56adb9aec9e1fb342da2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /bin/bash

VPN="$1"

if [[ -z "$VPN" ]]; then
	#echo "usage: ${0##*/} <name>" >&2
    #exit 1
	VPN=$(nmcli --terse --fields NAME connection show | rofi -lines 20 -dmenu -i -p "network")
fi

ACTIVE=$(nmcli con show --active "$VPN")

if [[ -z "$ACTIVE" ]]; then
    nmcli con up id "$VPN"
else
    nmcli con down id "$VPN"
fi

exit 0