Rectangle icon indicating copy to clipboard operation
Rectangle copied to clipboard

Shortcuts with "option" stop working

Open slifty opened this issue 1 year ago • 14 comments

  • [x] This is a new bug that hasn't been documented in a closed issue or in the Readme.

macOS version: 15.4 Rectangle version: Version 0.87 (93) Logs if applicable (In Rectangle menu, hold option, "View Logging..."):

This started happening after upgrading to MacOS 15 / Sequoia

At some point option-based hotkeys stop making it to Rectangle entirely. I'm not entirely sure what triggers the issue (it may be if I accidentally touch the "option" key while moving a window?). I have the new grid features of MacOS disabled.

While experiencing the bug, if I update the shortcut to not use option the new command will work, but if I switch back to an option-based key command it goes back to it's non-functional state.

Restarting fixes the problem.

slifty avatar Apr 14 '25 19:04 slifty

I see this developer comment from Apple -- https://developer.apple.com/forums/thread/763878?answerId=804374022#804374022

I cannot tell if this is actually the case / if this change was reverted (I see some users saying it got reverted later). If it's real then Rectangle might want to consider alerting users that their option-based-hotkeys aren't going to work (though I don't really understand why it works some of the time!).

Another relevant link: https://www.alfredforum.com/topic/22495-are-option-key-hotkeys-broken-in-alfred/

slifty avatar Apr 14 '25 19:04 slifty

I can't reproduce this, so it could be something else interfering on your Mac? Maybe try quitting apps one by one to see if there are any causing an issue?

rxhanson avatar Apr 15 '25 00:04 rxhanson

@rxhanson yeah -- this is going to be a nasty one to pin down (even for me after restart it can take an arbitrary amount of time for it to crop up)

If / when it happens again I'll do some more debugging and post what I find here!

slifty avatar Apr 15 '25 13:04 slifty

Well that was fast -- happened again. From that Alfred thread it seems like Sequoia added a new feature called "Secure Keyboard Entry" which an application can dynamically enable to disable option-based global hotkeys. In my case it looks like it was Bitwarden that would occasionally enable it. I still haven't figured out the exact trigger, but quitting bitwarden re-enabled the hotkeys so I'm 99% sure it was the problem.

I think you can probably reproduce this by using MacOS Terminal by doing the following:

  1. Create an option-based hotkey in rectangle
  2. Open MacOS Terminal
  3. From the menu, click "Terminal -> Secure Keyboard Entry"
  4. With a terminal window focused, try using your option-based-rectangle hotkey (it shouldn't work)

My understanding is the reason Apple added this secure input mode (which disables option hotkeys globally) is that option-based hotkeys can be used by key loggers to snipe passwords that have option-based special characters (since option + letter is a way to input a special character, and a password might use a special character).

The most-likely-best solution for me personally is to change to using non-option-based hotkeys in Rectangle.

It might make sense for Rectangle to somehow suggest to users that option-based-hotkeys could intermittently face this issue if they have a hotkey set with an option and are using MacOS 15.x

slifty avatar Apr 15 '25 15:04 slifty

Thanks for the follow up; your conclusion makes sense to me. I'll look at communicating this to users in a future release.

rxhanson avatar Apr 17 '25 04:04 rxhanson

See this comment, I believe is the same issue as described here. TL;DR: Add Rectangle to System Settings -> Privacy & Security -> Input Monitoring list.

aitorpazos avatar May 09 '25 10:05 aitorpazos

@aitorpazos oh amazing, thank you!

Meanwhile my local culprit (the bitwarden client) is working to fix their recent change that caused this to regularly happen.

slifty avatar May 09 '25 16:05 slifty

@rxhanson With the above research + the OS level solution by @aitorpazos, I defer to you on whether you think there is anything actionable for the Rectangle code base that would warrant keeping this issue open as it seems to me that there is now a user path to resolve when facing the problem.

I suppose Rectangle could somehow detect if it is in Input Monitoring and provide user guidance to enable that MacOS setting if they are using option-based shortcuts and have not granted the permission?

slifty avatar May 09 '25 16:05 slifty

Thanks @aitorpazos & @slifty. My current inclination is to keep this issue open. From the perspective of Rectangle, this would be a bug within macOS, since the behavior of one 3rd party app can affect the macOS system behavior regarding another 3rd party app in an unexpected way. There isn't really a way for Rectangle to determine that a user is facing the same issue that you've hit, so I'm hesitant to point a user to enable input monitoring as that can add unnecessary complexity. Ideally, the fix would here would be in macOS.

rxhanson avatar May 10 '25 15:05 rxhanson

Just to make sure we are on the same page as this bit makes me think we are not:

since the behavior of one 3rd party app can affect the macOS system behavior regarding another 3rd party app in an unexpected way.

From my experience, once Rectangle gets added to this:

TL;DR: Add Rectangle to System Settings -> Privacy & Security -> Input Monitoring list.

All the issues with the 3rd parties apps impacting Rectangle behavior are gone. If I am wrong here, I apologize for the noise, but if not, KeePassXC implemented the support for adding itself into the list (this is a related issue, couldn't find the implementing PR), so something similar could work.

aitorpazos avatar May 12 '25 10:05 aitorpazos

@aitorpazos Thanks for the follow up. I'll elaborate a bit. In different scenarios on different apps of mine, I've had keyboard related functionality break when both input monitoring and accessibility privileges were enabled, and it took time to figure that out. That could be fixed in current versions of macOS, but it does give me some hesitation to recommend this to users from within the app. To narrow down when to communicate this to users, Rectangle would have to keep track of certain apps installed or running to display this communication. I haven't seen any communication from Apple that enabling Input Monitoring is the recommended path for 3rd parties to work around this issue, on top of it being kind of an opaque (although nicely simple) solution from an end user's perspective. I appreciate that you've provided this solution and might still add it in to Rectangle in some form.

rxhanson avatar May 12 '25 15:05 rxhanson

As a case in point: I did enable the above input monitoring setting and maybe overzealously declared victory -- I experienced the bug again even with the permissions enabled.

slifty avatar May 12 '25 16:05 slifty

This just happened to me out of the blue. I added/allowed Rectangle in Input Monitoring and the shortcuts are no longer greyed out. I'm on 15.5. I'll update if this happens again. Let me know if there's any debugging I can do.

jagibson avatar Jul 21 '25 17:07 jagibson

This just happened to me out of the blue. I added/allowed Rectangle in Input Monitoring and the shortcuts are no longer greyed out. I'm on 15.5. I'll update if this happens again. Let me know if there's any debugging I can do.

I'm confused. It seemed to just be happening in VS Code, even after the Input Monitoring change. I restarted VS Code and all is fine now.

jagibson avatar Jul 21 '25 17:07 jagibson