Use gtk clipboard instead of wl clipboard

This commit is contained in:
Bernd Schoolmann 2024-02-17 13:32:58 +01:00
parent 13bd29dbf9
commit 6ee67d6569
No known key found for this signature in database
3 changed files with 14 additions and 32 deletions

View File

@ -29,14 +29,6 @@ finish-args:
- --system-talk-name=org.freedesktop.PolicyKit1
modules:
- ./gui/python3-requirements.json
- name: wl-clipboard
buildsystem: meson
config-opts:
- -Dfishcompletiondir=no
sources:
- type: git
url: https://github.com/bugaevc/wl-clipboard.git
tag: v2.2.1
- name: goldwarden-python-ui
buildsystem: simple
build-commands:

View File

@ -6,34 +6,33 @@ import gc
import time
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
from ..services import goldwarden
from ..linux import clipboard
from threading import Thread
import sys
import os
from ..services import totp
Notify.init("Goldwarden")
token = sys.stdin.readline()
token = "Test"
goldwarden.create_authenticated_connection(token)
def autotype(text):
time.sleep(0.5)
time.sleep(2)
print("Autotyping")
goldwarden.autotype(text)
print("Autotyped")
time.sleep(5)
os._exit(0)
def set_clipboard(text):
print("Setting clipboard")
try:
clipboard.write(text)
except Exception as e:
print(e)
pass
display = Gdk.Display.get_default()
clipboard = Gdk.Display.get_clipboard(display)
clipboard.set(text)
print("Clipboard set", text)
time.sleep(0.5)
os._exit(0)
Gdk.Display.get_clipboard(Gdk.Display.get_default()).set_content(
Gdk.ContentProvider.new_for_value(text)
)
def kill():
time.sleep(0.5)
os._exit(0)
thread = Thread(target=kill)
thread.start()
class MyApp(Adw.Application):
def __init__(self, **kwargs):

View File

@ -1,9 +0,0 @@
import subprocess
import os
def write(text):
# 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'))