Fix clipboard in flatpak

This commit is contained in:
Bernd Schoolmann 2023-12-26 16:32:11 +01:00
parent 4081d7fac4
commit e675703c35
No known key found for this signature in database
4 changed files with 18 additions and 11 deletions

View file

@ -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

View file

@ -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'))

View file

@ -18,6 +18,7 @@ if not is_hidden:
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)

View file

@ -6,6 +6,7 @@ import dbus
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 @@ class GoldwardenDBUSService(dbus.service.Object):
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()