Skip to content

Commit cca7e23

Browse files
committed
fixed bug with backspace key
1 parent 0313883 commit cca7e23

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

autotyper.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ def remove_onetime_cooldown():
9191
onetime_cooldown = not onetime_cooldown
9292

9393

94+
def press_backspace():
95+
global controller
96+
controller.press(Key.backspace)
97+
controller.release(Key.backspace)
98+
99+
94100
def on_key_press(key):
95101
if hasattr(key, "char"):
96102
key = str(key.char)
@@ -103,15 +109,15 @@ def on_key_press(key):
103109
global started
104110
global exited
105111
if key == settings["hotkey"]:
106-
controller.press(Key.backspace)
112+
press_backspace()
107113
started = not started
108114
if started:
109115
print("Started.")
110116
init_typer()
111117
else:
112118
print("Stopped.")
113119
if key == settings["exitkey"]:
114-
controller.press(Key.backspace)
120+
press_backspace()
115121
print("Exited.")
116122
started = False
117123
exited = True
@@ -120,7 +126,7 @@ def on_key_press(key):
120126
global onetime_cooldown
121127
global onetime_queue
122128
if key == settings["onetime"]["hotkey"]:
123-
controller.press(Key.backspace)
129+
press_backspace()
124130
print("Started onetime cmds.")
125131
cmds = settings["onetime"]["commands"]
126132
for i in cmds:

0 commit comments

Comments
 (0)