App specific shortcuts suddenly stop working and only start working again by refocusing the applicaiton

Describe the bug

  1. I have an app specific shortcut configured that makes the mouse move and click on something
  2. I open the app and use the shortcut
  3. After a while I realize that the shortcut does not work anymore (I just hear a sound from MacOS indicating that no action is assigned to this key)
  4. I unfocus and refocus the app
  5. Shortcut works again

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
MacBook Keyboard

Device information:

  • Type of Mac: MacBook Pro (13-inch, 2019, Four Thunderbolt 3 ports)
  • macOS version: BigSur 11.1
  • BetterTouchTool version: 3.540

I would highly appreciate your help and any recommendations on how I should configure BTT to avoid this behavior.

Thank you for the great work!

Is this happening in some specific app? What's the shortcut you are using?

I noticed it in OneNote and am using CMD + Shift + b as the shortcut.

I also just noticed that if I use "CMD + Shift + b" multiple times it stop working and in addition to that all other shortcuts configured via BTT stop working too.

To me it looks as if BTT would not see anymore that OneNote is still the active application and therefore moving the focus away and back to OneNote solves it.

Hi, I have the same problem.
MacMini 2012, High Sierra, because of reasons :-), all BTT versions since a few months.
Other similar utilities are also running: Karabiner Elements, macOS's Mouse Keys, ControllerMate, Spark, Unshaky.
Also, many things are changed in the system, some of apple's launchagents/daemons disabled, etc.

BTT's Process Priority Helper Tool is active (when I manually check it).

I mostly notice it in BBEdit/free, because I have some shortcuts that insert some text fragments that suddenly start doing what the original app defines, not the BTT "override". It just happens after some time, I'm unable to pinpoint anything that triggers it.

Only switching the current app to some other random one and switching back solves it – or restarting BTT.

I'll try leaving the BTT/Preferences/Scripting BTT panel visible and Cmd-click its Refresh button from BBEdit to see if BTTActiveAppBundleIdentifier changes. I also made a global hotkey to insert the current BTTActiveAppBundleIdentifier.

And also, thanks again for this lifesaver app. :slight_smile:
— — —
Edit: now the bug appeared again, pressed the hotkey, but the bug is elsewhere, because it still properly reports that BTTActiveAppBundleIdentifier = com.barebones.bbedit.

I also have the same problem.
MBP 13" 2018. Internal & external keyboards.

I assign ⌘⌥→ and ⌘⌥← to simulate ⌃⇥ and ⌃⇧⇥ (next/previous tab). I also assign ⌘Q to AppleScript to prevent quit (from DaringFireball.net's post).

The app specific shortcuts often don't work after I do some things, for example open new tab, or type on the address bar, or refocusing on Safari.

@ybbond, I use these Terminal commands to change the Cmd-Q shortcuts to Cmd-Ctrl-Q:

defaults write org.mozilla.firefox NSUserKeyEquivalents -dict-add "Quit Firefox" "@^Q"
defaults write com.apple.Safari NSUserKeyEquivalents -dict-add "Quit Safari" "@^Q"
defaults write com.apple.finder NSUserKeyEquivalents -dict-add "Quit Finder" "@^Q"

then

killall cfprefsd

to quit/restart the cfprefsd process which caches the preferences.

1 Like

nice tips, thank you :slight_smile:

my original goal with the AppleScript shortcut is to prevent accidental Safari quit (⌘Q) when I intend to close a tab (⌘W). The script I am using is here:

The AppleScript for Safari accidental quit
tell application "Safari"
  set _window_count to count windows
  set _tab_count to 0
  
  repeat with _w in every window
    set _tab_count to _tab_count + (count tabs of _w)
  end repeat
  
  -- Make a string like "1 window containing 3 tabs."
  if _window_count is 1 then
    set _msg to _window_count & " window containing " as string
  else
    set _msg to _window_count & " windows containing " as string
  end if
  if _tab_count is 1 then
    set _msg to _msg & _tab_count & " tab." as string
  else
    set _msg to _msg & _tab_count & " tabs." as string
  end if
  
  display alert ¬
    "Are you sure you want to quit Safari?" message _msg ¬
    buttons {"Cancel", "Quit"} ¬
    giving up after 60
  if button returned of result is "Quit" then quit
end tell

A problem occurs when the trigger key is pressed quickly in succession.