Isto é mais como um hack mas deve funcionar (funciona para mim).
vpn-notify.py:
import gtk
import pynotify
import dbus
from dbus.mainloop.glib import DBusGMainLoop
def vpn_connection_handler(*args, **keywords):
state = args[0].get('State',0)
if state == 2:
n = pynotify.Notification ("VPN", "Connection established")
n.show()
pynotify.init ("icon-summary-body")
dbus_loop = DBusGMainLoop()
system_bus = dbus.SystemBus(mainloop=dbus_loop)
system_bus.add_signal_receiver(vpn_connection_handler,
dbus_interface="org.freedesktop.NetworkManager.VPN.Connection",
signal_name="PropertiesChanged")
gtk.gdk.threads_init()
gtk.main()
Execute com:
python vpn-notify.py
Estabelecer a conexão VPN.