[modules/vpn] Add experimental wireguard support

fixes #595
This commit is contained in:
tobi-wan-kenobi 2020-04-10 16:45:45 +02:00
parent 3a376a4ad2
commit d57bbc28fe

View file

@ -38,7 +38,7 @@ class Module(bumblebee.engine.Module):
for line in lines: for line in lines:
info = line.split(':') info = line.split(':')
try: try:
if info[1] == "vpn": if self._isvpn(info[1]):
self._vpn_profiles.append(info[0]) self._vpn_profiles.append(info[0])
except: except:
pass pass
@ -46,6 +46,9 @@ class Module(bumblebee.engine.Module):
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd=self.popup) cmd=self.popup)
def _isvpn(self, connection_type):
return connection_type in ["vpn", "wireguard"]
def update(self, widgets): def update(self, widgets):
try: try:
res = bumblebee.util.execute("nmcli -g NAME,TYPE,DEVICE con") res = bumblebee.util.execute("nmcli -g NAME,TYPE,DEVICE con")
@ -53,7 +56,7 @@ class Module(bumblebee.engine.Module):
self._connected_vpn_profile = None self._connected_vpn_profile = None
for line in lines: for line in lines:
info = line.split(':') info = line.split(':')
if info[1] == "vpn" and info[2] != "": if self._isvpn(info[1]) and info[2] != "":
self._connected_vpn_profile = info[0] self._connected_vpn_profile = info[0]
except Exception as e: except Exception as e: