Sublime Forum

Macos full screen strangeness with keyboard shortcuts

#1

This is a weird one, and something I’ve been trying to figure out for months. I’m on the dev build, so 4147 as of now, using an M1 Air on latest macOS, 13.1.

I first thought it was an issue with Alfred, as it kept occurring when I’d press the keyboard shortcut for Clipboard History (cmd-alt-v which I use a ton while coding), but noticed it also occurred when hitting ctrl-space just to open Alfred’s normal search. There was a 1-2 second pause before the Alfred window would show up. It wasn’t 100% consistent, but happened enough over the last few months to get me writing Alfred support, and now this post once I realized it also happens if I switch to Raycast (w/ the same key bindings, ctrl-space and cmd-alt-v).

If I arrow around a bit first, then hit ctrl-space, I get a long pause, sometimes indefinite until I mouse around or hit another key (!!!). The behavior doesn’t occur if there’s something showing from notification center, or if ST is not in fullscreen. I’ve been seeing this behavior often because I spend all day coding in Sublime, using keyboard for navigation, and always fullscreen (for the last … 12 years? holy smokes).

It only happens when using Sublime Text. It’s not reproducible in Nova or vscode or any other app I tried. And only when fullscreen, and after arrowing-around first. I tried opening console and sublime.log_input(True) but the keypresses do not show up in console, which makes me think something else is eating the keystrokes. I tried using an app, Shortcut Detective to see if that helped, but when it’s running, the issue doesn’t reproduce, and Alfred opens the Clipboard History immediately.

Pretty maddening, since coding fullscreen in ST is 95% of what I do on my computer, and I use the clipboard manager constantly.

Any suggestions of things to try to diagnose would be much appreciated! Such a weird problem.

(Just to prove I’m not crazy (because after months of trying to debug this, it’s feeling possible), I made a video with my iPhone—the behavior goes away if I try using licecap or quicktime for a screencap: https://share.natebeaty.com/IMG_2935/)

0 Likes

#2

A few other things I’ve noticed:

  • It also happens for Spotlight. I hit cmd-space, and there’s a good 1-2 second pause before it appears (if I’m in fullscreen and had arrowed around at least once before hitting the shortcut)

  • If I repeat the shortcut again before Alfred or Raycast or Spotlight appear, ST regains focus and nothing happens at all

  • I have Fantastical and Cardhop set to ctrl-alt-space and ctrl-alt-d, and those keyboard shortcuts work fine — both apps open immediately and do not exhibit the pause

I’m using Karabiner but have tried quitting it and the behavior is unaffected. The whole thing is so bizarre.

0 Likes

#3

Does it happen in [safe mode] (https://www.sublimetext.com/docs/safe_mode.html)?

0 Likes

#4

Just tested in safe mode and it has the same behavior.

I hadn’t heard of safe mode being added to ST4, but had basically done the same thing by renaming ~/Library/Application Support/Sublime Text 3 to something else and firing up Sublime (where I had to enter my license again, which safe mode nicely avoids). It had the same behavior as subl --safe-mode: open any file, go full screen with cmd+ctrl+f, arrow around a bit, then hit ctrl+space and there’s 1-2 second pause before Alfred (or Raycast) appears. (One positive after that test: it made me realize I can now drop the “3” and just have ~/Library/Application Support/Sublime Text.)

Another discovery: I just noticed pressing esc also works the same as pressing ctrl+space again (or cmd+space or cmd+alt+v, depending on the original keypress) in returning focus to ST.

I tried various methods to see if I can see what is getting focus directly after hitting ctrl+space when there is a 1-2 second pause and ST loses focus, e.g. https://apple.stackexchange.com/questions/123730/is-there-a-way-to-detect-what-program-is-stealing-focus-on-my-mac, but haven’t had any luck. I got that python script to work, but it doesn’t report any app when it’s in the limbo state.

0 Likes

#5

My guess is the built-in shortcut for showing auto-complete is interfering with your global shortcut, and it’s taking 2 seconds to time out and pass that shortcut back to the OS. If that’s the case making a custom key binding with the "noop" command should make it work.

0 Likes

#6

Thanks for the suggestions.

I did try adding { "keys": ["ctrl+space"], "command": "noop" }, to key bindings, which had no effect on the behavior. But this happens for Spotlight cmd+space and opening Alfred’s Clipboard History, which I have set to cmd+alt+v … which is honestly the real issue, as I use this constantly when coding.

I set up a new user and installed the stable build of ST4, and the issue is not present. I created a file, set it to fullscreen, arrowed around, and then ctrl+space opens the autocomplete as expected, and cmd+space opens Spotlight immediately. I then tried switching to the stable build of ST4 on my normal user, but the behavior remains.

So it must be some obscure process causing issues, buried somewhere in the bowels of my aging install of Ventura. As a dev, I install all sorts of crap, so I’m sure it’s something weird and nearly impossible to narrow down.

I guess I was just hoping something in here would trigger recognition of some obscure clue. The fact that it only happens with ST4 and only in fullscreen seems telling, but at this point I think I need to just work around it, avoid fullscreen and ignore the 54px of distractions across the top of the screen, and hope various OS + app updates eventually squash the issue. ¯\_(ツ)_/¯

0 Likes