Fix autotype on mac

This commit is contained in:
Bernd Schoolmann 2024-06-02 17:17:15 +02:00
parent 2651a36d3c
commit 5af6771460
No known key found for this signature in database
2 changed files with 9 additions and 7 deletions

View File

@ -1,10 +1,10 @@
import gi import gi
gi.require_version('Gtk', '4.0') gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1') gi.require_version('Adw', '1')
gi.require_version('Notify', '0.7') # gi.require_version('Notify', '0.7')
import gc import gc
import time import time
from gi.repository import Gtk, Adw, GLib, Notify, Gdk from gi.repository import Gtk, Adw, GLib, Gdk
from ..services import goldwarden from ..services import goldwarden
from ..services.autotype import autotype from ..services.autotype import autotype
from threading import Thread from threading import Thread
@ -12,7 +12,6 @@ from .resource_loader import load_template
import sys import sys
import os import os
from ..services import totp from ..services import totp
Notify.init("Goldwarden")
class GoldwardenQuickAccessApp(Adw.Application): class GoldwardenQuickAccessApp(Adw.Application):
def __init__(self, **kwargs): def __init__(self, **kwargs):
@ -115,8 +114,8 @@ class GoldwardenQuickAccessApp(Adw.Application):
def run_autotype(self, text): def run_autotype(self, text):
def perform_autotype(text): def perform_autotype(text):
self.window.hide() GLib.idle_add(self.window.hide)
time.sleep(0.1) time.sleep(2)
autotype.autotype(text) autotype.autotype(text)
time.sleep(0.1) time.sleep(0.1)
os._exit(0) os._exit(0)
@ -148,7 +147,7 @@ class GoldwardenQuickAccessApp(Adw.Application):
self.filtered_logins = self.filtered_logins[0:7] self.filtered_logins = self.filtered_logins[0:7]
def render_list(self): def render_list(self):
if len(self.filtered_logins) > 1: if len(self.filtered_logins) > 0:
self.results_list.set_visible(True) self.results_list.set_visible(True)
while self.results_list.get_first_child() != None: while self.results_list.get_first_child() != None:
self.results_list.remove(self.results_list.get_first_child()) self.results_list.remove(self.results_list.get_first_child())

View File

@ -3,3 +3,6 @@ import pyautogui
def autotype_pyautogui(text): def autotype_pyautogui(text):
print("autotypeing with pyautogui") print("autotypeing with pyautogui")
pyautogui.write(text, interval=0.02) pyautogui.write(text, interval=0.02)
if __name__ == "__main__":
autotype_pyautogui("hello world")