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
|
2023-12-26 16:32:11 +01:00
|
|
|
import gi.repository.GLib
|
2023-12-23 07:18:30 +01:00
|
|
|
|
|
|
|
on_autofill = lambda: None
|
|
|
|
|
|
|
|
class GoldwardenDBUSService(dbus.service.Object):
|
|
|
|
def __init__(self):
|
|
|
|
bus_name = dbus.service.BusName('com.quexten.goldwarden', bus=dbus.SessionBus())
|
|
|
|
dbus.service.Object.__init__(self, bus_name, '/com/quexten/goldwarden')
|
|
|
|
|
|
|
|
@dbus.service.method('com.quexten.goldwarden.Autofill')
|
|
|
|
def autofill(self):
|
|
|
|
on_autofill()
|
|
|
|
return ""
|
|
|
|
|
2023-12-26 16:32:11 +01:00
|
|
|
def run_daemon():
|
|
|
|
mainloop = DBusGMainLoop(set_as_default=True)
|
|
|
|
service = GoldwardenDBUSService()
|
|
|
|
mloop = gi.repository.GLib.MainLoop()
|
|
|
|
mloop.run()
|