Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add methods for removing hotkeys and hotstrings #215

Merged
merged 5 commits into from
Jul 9, 2023
Merged

add methods for removing hotkeys and hotstrings #215

merged 5 commits into from
Jul 9, 2023

Conversation

spyoungtech
Copy link
Owner

@spyoungtech spyoungtech commented Jul 8, 2023

Resolves #213

Adds new methods for removing hotstrings/hotkeys:

  • remove_hotkey to remove a hotkey by keyname
  • clear_hotkeys to remove all hotkeys
  • remove_hotstring to remove a hotstring by trigger sequence
  • clear_hotstrings to clear all hotstrings

Like adding hotkeys or hotstrings, using these methods while the hotkey process is already running causes a restart of the hotkey process.


During testing, a bug was discovered in which a race condition existed if you tried to stop hotkeys too soon after starting them. The dispatcher thread is responsible for creating the subprocess, but because this happens asynchronously it's not guaranteed that the subprocess has started by the time stop is called.

As a temporary fix for this bug, the stop process will wait up to 1 second for the process to exist.

@coveralls
Copy link

coveralls commented Jul 8, 2023

Coverage Status

coverage: 75.079% (+0.4%) from 74.724% when pulling be53d46 on gh-213 into bf83a24 on main.

docs/README.md Outdated Show resolved Hide resolved
@spyoungtech spyoungtech marked this pull request as ready for review July 8, 2023 07:11
ahk/_hotkey.py Outdated Show resolved Hide resolved
@nnako
Copy link

nnako commented Jul 9, 2023

Hi @spyoungtech . Seems to work fine. I tried remove_hotkey() and clear_hotkeys(). the only thing is that an error is thrown when I try to remove a hotkey which I have not previously added. Would it be possible to rather ignore this? rather than throwing an error? ignoring it could result in a bit more usability, as the developer does not have to keep track of the hotkeys created by add_hotkey().

@spyoungtech spyoungtech merged commit 9c3386c into main Jul 9, 2023
8 checks passed
@spyoungtech spyoungtech deleted the gh-213 branch July 9, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to remove all hotkey definitions
3 participants