fix timer setting

This commit is contained in:
Christian Kauer 2026-03-23 16:06:40 +01:00
parent 9a0d080fb8
commit e06d7a555d
4 changed files with 20 additions and 2 deletions

View File

@ -67,7 +67,9 @@
"Bash(/run/media/chk/Ventoy/projects/chrka/whisper-dictation/.venv-linux/bin/pip install:*)",
"Bash(.venv-linux/bin/python build.py)",
"Bash(.venv-linux/bin/pip list:*)",
"Bash(.venv-linux/bin/python -c \":*)"
"Bash(.venv-linux/bin/python -c \":*)",
"Bash(.venv-linux/bin/pyinstaller whisper-dictation.spec --clean)",
"Bash(.venv-linux/bin/pyinstaller whisper-dictation.spec --clean -y)"
]
}
}

View File

@ -36,6 +36,7 @@ DEFAULT_CONFIG = {
"vocab_path": "",
"model_dir": "",
"grammar_check": True,
"paste_delay_ms": 300,
}
MODELS = ["tiny", "base", "small", "medium", "large-v2", "large-v3"]

View File

@ -167,6 +167,17 @@ def _open_main(root: tk.Tk, on_reload) -> None:
activeforeground=FG, font=FONT_UI,
highlightthickness=0, bd=0).pack(side="left")
paste_delay_var = tk.IntVar(value=cfg.config.get("paste_delay_ms", 300))
f_pd = row("Paste-Verzögerung", hint="ms — höher bei langsamen Apps (z.B. Teams)")
paste_delay_lbl = tk.Label(f_pd, text=f"{paste_delay_var.get()} ms", font=FONT,
bg=BG, fg=FG, width=7, anchor="w")
tk.Scale(f_pd, variable=paste_delay_var, from_=50, to=2000, orient="horizontal",
length=200, bg=BG, fg=FG, troughcolor=BG3, highlightthickness=0,
showvalue=False, bd=0, sliderrelief="flat",
command=lambda v: paste_delay_lbl.config(text=f"{int(float(v))} ms")
).pack(side="left")
paste_delay_lbl.pack(side="left", padx=(8, 0))
# ── LEISTUNG ──
section("LEISTUNG")
device_var = tk.StringVar(value=cfg.config["device"])
@ -242,6 +253,7 @@ def _open_main(root: tk.Tk, on_reload) -> None:
cfg.config["vocab_path"] = vocab_path_var.get()
cfg.config["model_dir"] = model_dir_var.get()
cfg.config["grammar_check"] = grammar_var.get()
cfg.config["paste_delay_ms"] = paste_delay_var.get()
cfg.save_config()
win.destroy()
threading.Thread(target=on_reload, daemon=True).start()

View File

@ -3,6 +3,8 @@ import shutil
import subprocess
import time
from whisper_app import config
def _pynput_type(text):
from pynput.keyboard import Controller as KeyboardController
@ -41,11 +43,12 @@ def type_text(text):
return
session = os.environ.get("XDG_SESSION_TYPE", "")
if session == "wayland" and shutil.which("wl-copy"):
delay = config.config.get("paste_delay_ms", 300) / 1000.0
old_clipboard = _wl_paste()
subprocess.run(["wl-copy", "--", text], check=False)
time.sleep(0.05)
subprocess.run(["xdotool", "key", "ctrl+v"], check=False)
time.sleep(0.05)
time.sleep(delay)
if old_clipboard is not None:
_wl_copy_bytes(old_clipboard)
elif shutil.which("xdotool"):