mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-11 19:06:11 +00:00
Stop the KDE shortcut and the built-in listener from doubling a press
The listener reads /dev/input and reacts the instant a key goes down. The KDE shortcut answers the same press by launching a whole Python process, which then talks over IPC, so its toggle lands a few hundred milliseconds later. The 400 ms guard caught that echo only when the machine happened to be quick, and otherwise the recording was started and stopped by one press: "No speech detected". Route the two apart. A toggle arriving from outside the process right behind a listener trigger is that echo, and its lateness also proves the KDE shortcut is live, which leaves the listener with nothing to do but double every press. So retire it, remember that in the config, and say so in the tray rather than changing behaviour silently.
This commit is contained in:
@@ -122,7 +122,9 @@ class EvdevHotkey(QObject):
|
||||
held = set()
|
||||
try:
|
||||
while not self._stop.is_set():
|
||||
ready, _, _ = select.select(fds, [], [], 0.4)
|
||||
# Short enough that stop() does not stall its caller waiting for
|
||||
# the read to come back around.
|
||||
ready, _, _ = select.select(fds, [], [], 0.15)
|
||||
for fd in ready:
|
||||
try:
|
||||
data = os.read(fd, self.EVENT_SIZE * 64)
|
||||
|
||||
Reference in New Issue
Block a user