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
Disabling monitoring still swallows trigger hotkey #873
Comments
We're missing something here. If this was a "global" problem, we would probably have had many reports. Can you reproduce this problem in other applications such as your terminal or kate? Although it's legal, it's not a good idea to use unmodified normal characters as triggers because the normal key becomes unavailable for other uses. This can be limited by using a window filter as you appear to have done. Your trace doesn't show AutoKey doing anything special with the key when monitioring is disabled. |
Trying further applications
I've just tried it with the following applications (using
For each of those:
I've also tried the same minimal test using
For each of those (again):
Shouldn't there be more issue reports?
I'm using Trying older versions of autokeyI got curious if older versions have the same behavior. I've focused on git tags and just used
Well, doesn't seem like a regression then. About using single keys as hotkeys
Yes, I'm aware of the implication of using a single key like My actual usecase makes use of regex based window filter and uses About the trace output
Yes, nothing stuck out to me either. Except that it still registers the hotkey being pressed despite monitoring being Anyone else?At this point I'm not sure if: Can anyone else reproduce this on their end? Is the expected behavior of |
Interesting. This is naughty behavior. AutoKey is hanging on for dear life. I can replicate this issue in AutoKey 0.95.10 under Kubuntu 22.04 LTS using Xorg. I didn't even need to use the window filter. My test:
|
I never noticed it before because when I don't want AutoKey to intervene, I shut it down. |
Thanks to both of you for the extensive testing. Looks like the code will have to be examined in detail. I don't think many people do disable AutoKey expansions while AutoKey is running which may explain why it wasn't reported before. Having expansions disabled is "logically" the same as a window filter that doesn't match. Both should pass whatever is typed without any interaction. The only other thing to test might be whether autokey-gtk has the same issue. I suspect it does because this sounds like something in the code common to both versions. @Goli4thus Do you see the expansions being reenabled like @Elliria does? That's also pretty weird and a bug. @Elliria Does this seem like something you can investigate or is this too deep into the code? I can add a help wanted tag if that's the case. |
autokey-gtkI tried the mentioned tests with testcase by ElliriaI used
In my case the checkmark was off, but the behavior was as described. |
I 'm unlikely to figure it out on my own, but I can help. First, I just did the test in AutoKey Qt and that works perfectly for me. I'm able to enable and disable monitoring at will using the AutoKey panel icon's context menu check-box and it works every time and never misbehaves. This is a GTK issue. The moment I do the test in AutoKey GTK, it falls over. What I failed to note earlier (and should have, because I realize it did happen during my first tests), was that the very first time I disabled monitoring in the AutoKey panel icon's context menu, I got a system notification about AutoKey crashing. Here's a screenshot of the notification and the little sad-face icon next to the AutoKey panel icon that opens the crash report: I clicked the sad-face icon and decided not to file the report, but I let it gather the information and then looked that over. This is what it says went wrong:
I did a grep for CheckMenuItem in the AutoKey 0.96.0 code and this was the result: $ grep -r "CheckMenuItem" *
grep: lib/autokey/gtkui/__pycache__/notifier.cpython-310.pyc: binary file matches
lib/autokey/gtkui/notifier.py: enableMenuItem = Gtk.CheckMenuItem(_("Enable Expansions")) If you do a search for CheckMenuItem and actiive in the lib/autokey/gtkui/notifier.py file, there are several results. I'm not seeing what's wrong, but maybe one of you will. |
I thought I'd add these searches on GitHub instead of on my machine:
|
Good catch! This might be an updated library module. It depends on how far back the problem goes. I don't expect anyone to resurrect a lot of older versions though. That would be hard to do because it would require old depenencies too. |
Even if we found a version that didn't do it, there would be a whole lot of commits to look through to see what changed where to figure out what went wrong. Hopefully someone will be able to look at the error message and the links above and see what needs to be adjusted. Obviously the CheckMenuItem needs an active attribute, but where and how is the question. |
These changes have nothing to do with Autokey. Similar problems occur with other apps as well. Most were in upgrade during the past 3-4 years, and they are just being implemented. I am spending hours on every issue, looking for solutions for the changes. Also, there just isn't enough volunteers globally. Perhaps we can get AI to search and correct the code? |
@ineuw Maybe Chat GPT 5. Linux already has lint for C-like languages. IDK if there's anything similar for Python. Something like that with AI added would be quite interesting, but: it would still require a skilled coder to review the changes. It will be a lot longer before I trust AI. And, something AI based would probably replace all of AutoKey. I have some stupid simple actions I do multiple times a day that would take me forever to code in AutoKey, but if an AI could just watch me do them a few times and learn them, it would probably be easy for it to do them for me. Coding is much more primitive than watch and learn would be. |
Our current linting is rather gentle and is done using the
Notes:
|
Thanks, I downloaded the source already and will let you know what happened. |
@Elliria That sounds like a great utility for developers (not me!). I've got way too many hours devoted to this project already and don't need to expand my roles. Is there any way this would be relevant for checking user scripts? If so, it would be a great option to add a button for next to editing panel. Your notes would be great in the wiki somewhere under developers. |
I forgot to mention that the tox package also needs to be installed if you want to run the AutoKey tests, @ineuw. If you just want to run flake8 on any of the AutoKey files or directories (or your own files or directories), then all you need to install is the **flake8) package. I've updated the message above. |
It is a great tool for developers, @josephj11. In fact, ever since I discovered it, I've been trying to make it a habit to test any and all of my own personal (non-AutoKey) code with it. It might or might not be useful for checking users' scripts. There would be two challenges: First, someone who knows how to incorporate a new option into the editor would be needed to make it available. Second, we would either have to make a decision on which options the linter should test for or a menu of options would need to be made available to the user. I adjusted the comments and commands in the code snippet above. Are those better? Note that the tests that AutoKey already runs with tox and flake8 are doing their job and don't need to be changed. Those optional lines of code above are just something I do for the heck of it for brutal linting and wouldn't be a permanent change we would want to make to AutoKey. When cloning AutoKey and making the changes, it's expected that you'd be using the above snippet for informational purposes and would trash the clone afterwards. The flake8 command, however, can stay as a permanent and useful tool for your Python arsenal, though. |
Much thanks for the instructions. Installed tox and flake8 and will post back soon. |
Would this be of any help? AyatanaAppindicators3? I am just fishing. |
IDK. I have seen that referenced in our dependencies before and vaguely recall an issue with it not being available. See #816. |
This issue is also related to the post with GTK-4 and Ayatana... and the whole GTK menu. |
Cool. I hope you enjoy them both. I whiled away a few hours messing around with each of them |
I suspected previously, that our copies are not the same. The deb file, the pip3 installation files are not compiled from the same master. The snippet to be replaced was not in the master.
Before. I was using this, but is no longer valid according @josephj11. Why can't everything be the same? Here are the |
@ineuw I don't remember what I said about that zip file. Can you point me to my comment(s) so I can review them? Theoretically, that should be the version of 0.96.0 that we created and released at the same time as the corresponding debs were created. So they should be the same, but behind anything that's been done in master and develop since then. |
The 0.96.0.zip version needed an additional library file to eliminate unwanted error messages during debugging. The python libraries were updated since that time, and the messages disappeared when installing from the .deb files. I switched to the 0.96.0.deb packages which are better for me, because I only install GTK in Linux Mint, and only Qt in Kubuntu 22.04 to follow user issues. However, two days ago, I noticed that the v0.96.0 .deb, .zip, and the downloaded source package are not exactly the same. It seems that additions to the main branch were not repackaged and placed in the downloads. Of course, this would require a revision number and documentation. |
I'm always working with the develop branch when I try these things out and make changes. Very rarely do I do anything with the master branch, and that's only if there's no choice. To get a copy of the develop branch to mess around with, you can clone it. There are instructions for trying out a clone of AutoKey in the wiki. For step 2, you'd want to follow the Clone a repository branch instructions to get the develop branch. Please don't do these experiments on your installed copy of AutoKey. I realize that if you comment something out and replace it with something else, you'll know what you did and can undo it, but you never know what might go wrong. The above steps were just something I did to get a good look at what's not up to snuff in our code and is not something we would normally use. I think the reason why the files are different is that they were created at different times and possibly by different people. It looks like You might want to try |
This should go into its own issue report. |
AutoKey is a Xorg application and will not function in a Wayland session. Do you use Xorg (X11) or Wayland?
Xorg
Has this issue already been reported?
Is this a question rather than an issue?
What type of issue is this?
Bug
Choose one or more terms that describe this issue:
Other terms that describe this issue if not provided above:
No response
Which Linux distribution did you use?
manjaro
Which AutoKey GUI did you use?
Qt
Which AutoKey version did you use?
0.96.0
How did you install AutoKey?
AUR
Can you briefly describe the issue?
If a script is created, a window title is set and a single key (e.g.
spacebar
,a
) is set as the hotkey, then even if monitoring is disabled (either via resp. global hotkey or via applet checkbox), the script's hotkey is still being swallowed byautokey-qt
and the target application never gets the original key event.Can the issue be reproduced?
Always
What are the steps to reproduce the issue?
window filter
to the editor's window title (or use a regex; it makes no difference)spacebar
ora
What should have happened?
Once monitoring is disabled, the script's trigger hotkey should be passed to target application as if
autokey-qt
wouldn't be running in the first place. So it being completely transparent regarding key events.What actually happened?
The target application doesn't receive the pressed hotkey, as if
autokey-qt
still captures it for some reason, but simply stopped triggering the resp. script.Do you have screenshots?
I can provide some if really needed, but I think in this case the given explanation should be clear enough.
Can you provide the output of the AutoKey command?
Anything else?
No response
The text was updated successfully, but these errors were encountered: