diff --git a/com.quexten.Goldwarden.yml b/com.quexten.Goldwarden.yml index 434dbe4..8428318 100644 --- a/com.quexten.Goldwarden.yml +++ b/com.quexten.Goldwarden.yml @@ -22,6 +22,9 @@ modules: - "--share=network" build-commands: - pip3 install --prefix=/app tendo + - git clone https://github.com/bugaevc/wl-clipboard.git + - cd wl-clipboard && meson setup build && cd build && ninja + - install -D wl-clipboard/build/src/wl-copy /app/bin/wl-copy - install -D main.py /app/bin/main.py - install -D com.quexten.Goldwarden.desktop /app/share/applications/com.quexten.Goldwarden.desktop - install -D goldwarden.svg /app/share/icons/hicolor/scalable/apps/com.quexten.Goldwarden.svg diff --git a/ui/clipboard.py b/ui/clipboard.py index 818da99..f193f80 100644 --- a/ui/clipboard.py +++ b/ui/clipboard.py @@ -1,5 +1,9 @@ import subprocess +import os def write(text): - process = subprocess.Popen(["/bin/sh", "-c", "wl-copy"], stdin=subprocess.PIPE) + # set path + env = os.environ.copy() + env["PATH"] = env["PATH"] + ":/app/bin" + process = subprocess.Popen(["/bin/sh", "-c", "wl-copy"], stdin=subprocess.PIPE, env=env) process.communicate(text.encode('utf-8')) \ No newline at end of file diff --git a/ui/main.py b/ui/main.py index a2c6c91..5265b9c 100644 --- a/ui/main.py +++ b/ui/main.py @@ -18,6 +18,7 @@ try: subprocess.Popen(["python3", "/app/bin/settings.py"], start_new_session=True) except: + subprocess.Popen(["python3", "./settings.py"], start_new_session=True) pass try: @@ -32,16 +33,11 @@ def run_daemon(): if not goldwarden.is_daemon_running(): goldwarden.run_daemon() -if not goldwarden.is_daemon_running(): - print("daemon not running.. autostarting") - daemonThread = Thread(target=run_daemon) - daemonThread.start() - -print("starting autofill monitor") - def on_autofill(): subprocess.Popen(["python3", "/app/bin/autofill.py"], start_new_session=True) -monitors.dbus_autofill_monitor.on_autofill = on_autofill + +monitors.dbus_autofill_monitor.on_autofill = lambda: on_autofill() +monitors.dbus_autofill_monitor.run_daemon() while True: time.sleep(60) \ No newline at end of file diff --git a/ui/monitors/dbus_autofill_monitor.py b/ui/monitors/dbus_autofill_monitor.py index b32788f..5737164 100644 --- a/ui/monitors/dbus_autofill_monitor.py +++ b/ui/monitors/dbus_autofill_monitor.py @@ -6,6 +6,7 @@ import dbus.service from dbus.mainloop.glib import DBusGMainLoop from threading import Thread +import gi.repository.GLib on_autofill = lambda: None @@ -19,5 +20,8 @@ def autofill(self): on_autofill() return "" -DBusGMainLoop(set_as_default=True) -service = GoldwardenDBUSService() +def run_daemon(): + mainloop = DBusGMainLoop(set_as_default=True) + service = GoldwardenDBUSService() + mloop = gi.repository.GLib.MainLoop() + mloop.run() \ No newline at end of file