-
-
Notifications
You must be signed in to change notification settings - Fork 458
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
⌘1 sometimes stops working in other apps #317
Comments
@glyph can you define sometimes here? Does it happen all the time or in any specific case like when you switch to other apps using ⌘Tab? |
@zulipbot claim |
Hey @glyph, I'm going to be trying to fix this issue. In addition to defining what sometimes means, is there a specific application (when you CmdTab) you're using that you see this issue happen with or is it multiple applications? I'm attempting to reproduce and haven't been able to so far. Thanks! |
@cedricium it seems likely the other application is irrelevant, and that the problem is that we're in some circumstance failing to unregister the hotkey from the OS... |
@timabbott that makes sense. I'm having trouble reproducing, am I understanding the issue correctly:
There's some sort of timing in between switching applications and using Cmd1 which causes the issue, but is the right way to go about it? |
I'm guessing this is what @glyph experiencing -
I can't reproduce the last step. I'm not sure if we have to unregister |
I still haven't been able to reproduce this issue, and looking at the code where the keyboard shortcuts for switching between servers gets set, I don't see anything that explicitly stands out which would cause this issue 😕 |
@glyph can you help us reproducing this issue. We've both tried to reproduce and read the code, and don't see how we can investigate further without more info 😕 |
@vbNETonIce can you reproduce this issue on Windows? |
no, never ran into this but I also don't really add new servers anymore (if that is relevant to the issues - just skimmed over this) |
Hmm, thanks.
Yeah, it's irrelevant. It could happen when you have only one server as well (since CTRL+1/⌘1 gets assigned). |
I am also noticing this with ⌘R now, and it seems to happen almost every day now, which means part of my web-dev workflow is to quit zulip 3 or 4 times per day. Anything I can do to make this more reproducible? |
My OS is now
so not fixed by Apple :) |
I am not sure what the exact race condition is here, but https://www.npmjs.com/package/electron-localshortcut looks like a horrible hack that seems like a magnet for exactly this kind of bug. It is not appropriate for a mac app to register global hotkeys just to avoid populating the menu bar. Please just put the stuff into a menu like the human interface guidelines recommend, and this global registration race won't even be possible. |
Hey @glyph, can verify the steps taken to reproduce this? Or if it's not always reproducible, just outline what happens when you use ⌘1 / ⌘R. I didn't understand your original comment about when you opened this issue. Would love to help get this fixed! |
@akashnimare what do you think about replacing that library? I am partial to @glyph's argument here. |
@cedricium I just launch Zulip and wait for it to steal my hotkeys ;). What happens when I press ⌘1 with Zulip in the background is that it does exactly what ⌘1 does with Zulip in the foreground, whatever that would be. |
I know |
Yes, I'm using 1.5.0. |
Only on your computer, apparently ;-). The way electron-localshortcut works is fundamentally a bad idea. Calling APIs like this for no reason is the sort of thing that gets you banned from the mac app store, flagged as malware, etc. Global hotkeys should only be mapped if you are clearly calling this out to the user as global. To help track this down, in case it's an interaction with something else, a list of applications I routinely run are:
There's nothing I can think of that I do with Zulip, or with any other app, that causes it to start grabbing the keyboard focus in the background; it just runs for a while and then I notice my command keys aren't doing what I expect. |
I see this pretty consistently with iTerm in particular. Switching to Zulip (or quitting it) releases the cmd-1 key back to the system. I can consistently get this to happen when I switch spaces. |
Okay, so we need to remove |
I have pushed a fix in remove-electron-localshortcut. I have removed |
electron-debug hijacks the CMD/CTRL+R and reloads the whole app, whereas we only need to reload the current server. Removed those commands from electronLocalShortcuts as well as they are already registered in menu items.
The problem with localshortcut is that it uses globalShortcut. If anything this would be worse. |
@glyph I have completely removed |
Just released 1.6.0-beta. @glyph, @olbrich please update app (via selecting |
@akashnimare Fantastic. Thank you so much for the fix - and for fixing it the Right Way! I got the auto-update notification and installed it, and despite using it for longer than the average time where this would trigger, with all my usual apps running, I have not had my hot keys get grabbed. Seems to be working great! It's hard to be totally sure since I don't know what I did that would reliably trigger it, but at this point I'd be confident closing this bug if I were you. (Hopefully @olbrich can confirm.) |
seems good so far, I can switch spaces without issue. |
Please include:
Operating System
:Clear steps to reproduce the issue
:Run the application for a while. Eventually, the ⌘1 hotkey starts getting captured regardless of where my keyboard focus is until I restart the application.
I am only logged in to one Zulip, but if I select settings, ⌘Tab away, and then hit ⌘1 in another app when in this state, I can see it switch back to that Zulip rather than the Settings window, so I assume that for those with multiple Zulips it would globally capture ⌘2, etc.
The text was updated successfully, but these errors were encountered: