2023-12-23 07:18:30 +01: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 20:49:47 +01: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 07:18:30 +01:00
|
|
|
|
2023-12-26 20:49:47 +01:00
|
|
|
@dbus.service.method('com.quexten.Goldwarden.Autofill')
|
2023-12-23 07:18:30 +01:00
|
|
|
def autofill(self):
|
|
|
|
on_autofill()
|
|
|
|
return ""
|
|
|
|
|
2023-12-26 16:32:11 +01:00
|
|
|
def run_daemon():
|
2023-12-26 20:49:47 +01:00
|
|
|
DBusGMainLoop(set_as_default=True)
|
2023-12-26 16:32:11 +01:00
|
|
|
service = GoldwardenDBUSService()
|
2023-12-26 20:49:47 +01:00
|
|
|
from gi.repository import GLib, GObject as gobject
|
|
|
|
gobject.MainLoop().run()
|