goldwarden/ui/monitors/dbus_autofill_monitor.py

27 lines
797 B
Python
Raw Normal View History

2023-12-23 09:18:30 +03:00
#Python DBUS Test Server
#runs until the Quit() method is called via DBUS
from gi.repository import Gtk
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from threading import Thread
on_autofill = lambda: None
class GoldwardenDBUSService(dbus.service.Object):
def __init__(self):
2023-12-26 22:49:47 +03:00
bus_name = dbus.service.BusName('com.quexten.Goldwarden.autofill', bus=dbus.SessionBus())
dbus.service.Object.__init__(self, bus_name, '/com/quexten/Goldwarden')
2023-12-23 09:18:30 +03:00
2023-12-26 22:49:47 +03:00
@dbus.service.method('com.quexten.Goldwarden.Autofill')
2023-12-23 09:18:30 +03:00
def autofill(self):
on_autofill()
return ""
2023-12-26 18:32:11 +03:00
def run_daemon():
2023-12-26 22:49:47 +03:00
DBusGMainLoop(set_as_default=True)
2023-12-26 18:32:11 +03:00
service = GoldwardenDBUSService()
2023-12-26 22:49:47 +03:00
from gi.repository import GLib, GObject as gobject
gobject.MainLoop().run()