Use gtk clipboard instead of wl clipboard
This commit is contained in:
parent
13bd29dbf9
commit
6ee67d6569
|
@ -29,14 +29,6 @@ finish-args:
|
||||||
- --system-talk-name=org.freedesktop.PolicyKit1
|
- --system-talk-name=org.freedesktop.PolicyKit1
|
||||||
modules:
|
modules:
|
||||||
- ./gui/python3-requirements.json
|
- ./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
|
- name: goldwarden-python-ui
|
||||||
buildsystem: simple
|
buildsystem: simple
|
||||||
build-commands:
|
build-commands:
|
||||||
|
|
|
@ -6,34 +6,33 @@ import gc
|
||||||
import time
|
import time
|
||||||
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
|
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
|
||||||
from ..services import goldwarden
|
from ..services import goldwarden
|
||||||
from ..linux import clipboard
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from ..services import totp
|
from ..services import totp
|
||||||
Notify.init("Goldwarden")
|
Notify.init("Goldwarden")
|
||||||
|
|
||||||
token = sys.stdin.readline()
|
token = "Test"
|
||||||
goldwarden.create_authenticated_connection(token)
|
goldwarden.create_authenticated_connection(token)
|
||||||
|
|
||||||
def autotype(text):
|
def autotype(text):
|
||||||
time.sleep(0.5)
|
time.sleep(2)
|
||||||
|
print("Autotyping")
|
||||||
goldwarden.autotype(text)
|
goldwarden.autotype(text)
|
||||||
|
print("Autotyped")
|
||||||
|
time.sleep(5)
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
def set_clipboard(text):
|
def set_clipboard(text):
|
||||||
print("Setting clipboard")
|
Gdk.Display.get_clipboard(Gdk.Display.get_default()).set_content(
|
||||||
try:
|
Gdk.ContentProvider.new_for_value(text)
|
||||||
clipboard.write(text)
|
)
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
def kill():
|
||||||
pass
|
|
||||||
display = Gdk.Display.get_default()
|
|
||||||
clipboard = Gdk.Display.get_clipboard(display)
|
|
||||||
clipboard.set(text)
|
|
||||||
print("Clipboard set", text)
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
thread = Thread(target=kill)
|
||||||
|
thread.start()
|
||||||
|
|
||||||
class MyApp(Adw.Application):
|
class MyApp(Adw.Application):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
|
@ -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'))
|
|
Loading…
Reference in New Issue