sindresorhus / KeyboardShortcuts

⌨️ Add user-customizable global keyboard shortcuts (hotkeys) to your macOS app in minutes
https://swiftpackageindex.com/sindresorhus/KeyboardShortcuts/documentation/keyboardshortcuts/keyboardshortcuts
MIT License
1.99k stars 184 forks source link

is there any (easy hehe) way to prevent the KeyboardShortcut to respond when the user is on the status item(s) of the app #149

Open godbout opened 1 year ago

godbout commented 1 year ago

just curious. i'm having issues with apps that use AX, when i'm calling the AX on itself (at least on the status item). so i'm trying to find an easy way to prevent the KeyboardShortcut to record a press when the mouse is on the status item (or its menu). i can use even more AX to grab the AXUIElement under the mouse location, then check the subrole and title, but wondering if there's somehow a way on KS itself? does that make sense? thanks.

godbout commented 1 year ago

oh btw, this seems to be the consensus around LSUIElement apps? all the ones i have and that respond to a hotkey, do not when you're on the status items/menus. not sure if that behavior is related to those issues i'm encountering. but i've just noticed.

godbout commented 1 year ago

oh, only seeing this now: https://github.com/sindresorhus/KeyboardShortcuts/issues/1

seems like what i need :D

godbout commented 1 year ago

ok so i've been "studying" the code and i see. i've been checking other apps and for some of them their KS doesn't work when ANY menu is open. some of them it's only when their OWN menu is open. i'm trying to achieve the latter. but also my reason may not be that great. the reason i'm trying to do this is, as explained in the first post i think, i've always had troubles with using the AX on the menu items on my own apps. not sure why but it always ends up crashing.

anyways. thinking out loud. if what i'm saying doesn't make sense here, we can close this issue. thanks.