obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

MacBook M1 hotkey issues - not working when not in focus and erratically when in focus.

Open verstaerker-583 opened this issue 4 years ago • 46 comments

Platform

Operating system and version: macOS Big Sur 11 - MacBook Pro (13", M1, 2020) OBS Studio version: 26.1.2

Expected Behavior

Hotkeys should work as expected/ defined, both with OBS in and out focus.

Current Behavior

Hotkeys do not work when OBS is not in focus. And when in focus, after about 5-10 keypresses, my scene collection reacts as OBS would receive multiple additional keypresses - Resetting security & privacy settings and also adding OBS manually did not help.

Restarting OBS "fixes" the erratic behavior for about 5-10 keypresses, it does not help with keypresses while OBS in not in focus.

I am not using modifier keys in my configurations.

Hammerspoon running in parallel is reacting to hotkeys as expected.

Exactly the same configuration (scene collection, profile, global.ini and Hammerspoon running in parallel) ist just working fine on Intel Macs I have access to: MacBook Air (2017), MacBook Pro (2019) and MacPro (2019).

On the same M1 MacBook hotkeys still worked as expected with OBS Studio 26.0.2 moved to it from an Intel MacBook by the Apple Migration Assistant - even without touching security & privacy settings. For Hammerspoon to work on the new MacBook, it was necessary to remove its keyboard access from the security & privacy settings first.

Please find the scene collection here: https://github.com/verstaerker-583/obs/blob/master/var/ss.json

Deleting TCC databases did not help: rm "~/Library/Application Support/com.apple.TCC/TCC.db"; sudo rm "/Library/Application Support/com.apple.TCC/TCC.db"

This did not help either: HotkeyFocusType=DisableHotkeysOutOfFocus

Steps to Reproduce

Start OBS, check hotkeys with obs in and out focus.

Additional information

hotkeys not working when not in focus on M1 macs seems to be reported often, additional erratic function is seen less often https://obsproject.com/forum/threads/big-sur-hotkey-issues.136859 https://obsproject.com/forum/threads/hot-key-issues.134837 https://obsproject.com/forum/threads/hotkeys-not-working-big-sur-m1-mini.135118 https://obsproject.com/forum/threads/hotkeys-only-work-if-obs-is-the-focused-app.134913 https://obsproject.com/forum/threads/hotkeys-stopped-working-with-an-update-of-obs.115164

verstaerker-583 avatar Jan 24 '21 00:01 verstaerker-583

Adding information on modifiers:

None of the F1-F12 keys trigger the Hotkey action (I'm only switching scenes) if there was ANY modifier included in the configuration (Shift, Alt, Command), such as ^F1.

The Control and Shift modifier key seems to be completely ignored. If I configure a hotkey to F1, it triggers regardless if I keep the Control (or Shift, Alt, Command) key pressed or not.

The above behaviour is observed only when OBS application is in focus (tested main window and windowed preview).

I'm using a USB connected Apple keyboard, and I get the same results if I'm using the laptop's keyboard (I've set pressing the F1 button to NOT dim light, but to work as a Fn button).

(I've not observed the erratic behaviour.) OBS 26.1.2 MacBook Air M1, 2020 (16GB RAM) Mac OS Big Sur 11.1

FredrikWendt avatar Jan 27 '21 09:01 FredrikWendt

FWIW the entire hotkey implementation in macOS is waiting for a revamp anyway (using OS-based events when not in focus).

PatTheMav avatar Feb 25 '21 13:02 PatTheMav

So this seems to be a known issue, has anybody figured out a workaround for this problem?

meneguzzi avatar Mar 17 '21 17:03 meneguzzi

There is no known workaround except the one that Jim already implemented - work on a reimplementation of the hotkey handling was started a few months ago but requires some deeper (read: non-trivial) changes and we didn't have the bandwidth to get back to it yet: https://github.com/obsproject/obs-studio/pull/3914

PatTheMav avatar Mar 17 '21 17:03 PatTheMav

@meneguzzi my workaround: kill and restart as quick as you can ... In general, I find that the second launch of OBS in the day, usually doesn't cause any issues - it's just the first launch after the computer's been in hibernation / lid closed over night.

FredrikWendt avatar Mar 17 '21 23:03 FredrikWendt

@FredrikWendt I'm afraid that does not work.

meneguzzi avatar Mar 26 '21 17:03 meneguzzi

Just adding to this as it's a very frustrating issue. I can reproduce breaking behaviour 100% based on the comment at https://obsproject.com/forum/threads/hotkeys-stopped-working-with-an-update-of-obs.115164/page-2#post-504151:

  • Start OBS
  • Switch to any application requesting secure input (ie. a password field in safari, or Terminal with secure input turned on)

Hotkeys should now be broken until next restart of OBS.

peppy avatar Jul 26 '21 04:07 peppy

have the same issue. Hotkeys works when OBS window is focus. If not it doesn't work on a Mac mini M1

skalero01 avatar Aug 04 '21 03:08 skalero01

same here on macbook air m1. hotkeys only work when obs is in focus. no combination with alt or cmd is working either, also not when obs is in focus.

AlexisParra avatar Oct 09 '21 17:10 AlexisParra

I have also the same issue. Hotkeys works when OBS window is in focus. If not in focus - the hotkeys don't work on a Mac Book Pro macOS Big Sur 11.6. Looks like related to https://github.com/obsproject/obs-studio/pull/3914

abrilevskiy avatar Oct 14 '21 10:10 abrilevskiy

I am having the same issues also on macbook air m1 Big Sur.

samipshah100 avatar Nov 30 '21 07:11 samipshah100

For some reason it now works for me. No need for OBS to be in focus to use hotkeys. No specific changes made.

AlexisParra avatar Nov 30 '21 08:11 AlexisParra

Can u use ctrl ans shift keys also for the hotkeys?

Which version of obs?

On Tue, 30 Nov, 2021, 1:36 pm Alexis Pryds Parra, @.***> wrote:

For some reason it now works for me. No need for OBS to be in focus to use hotkeys. No specific changes made.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/obsproject/obs-studio/issues/4126#issuecomment-982379374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMJ3FQHDYC426YFJR6CQPWDUOSAWRANCNFSM4WQCO7RA .

samipshah100 avatar Nov 30 '21 08:11 samipshah100

Definitely still an issue. I ended up buying a stream deck to get past this. Hopefully there's an arduino/pico type project out there that can replicate that same functionality on the cheap (and not just pass through keyboard presses).

BeauNouvelle avatar Apr 18 '22 11:04 BeauNouvelle

Hi, I bought a stream deck and still having the same issue. Also I'm using a MacBook Pro 2019. Hotkeys do not work when out of focus and there is a delay in the scene switcher once the window comes back into fucus.

siddicky avatar May 12 '22 09:05 siddicky

I have tried everything I can think or find online for the past two months to no avail. I've tried multiple wired / wireless keyboards, macro apps, midi apps, Loupedeck, etc with and without modifiers, virtual keyboard apps, standing on my head and spinning in my chair but still cannot get this thing to consistently pickup hotkey presses. It appears to be the exact same issue in both the Rosetta/Intel version as the Mac/M1 version.

joshkemp avatar Jun 20 '22 04:06 joshkemp

I have tried everything I can think or find online for the past two months to no avail. I've tried multiple wired / wireless keyboards, macro apps, midi apps, Loupedeck, etc with and without modifiers, virtual keyboard apps, standing on my head and spinning in my chair but still cannot get this thing to consistently pickup hotkey presses. It appears to be the exact same issue in both the Rosetta/Intel version as the Mac/M1 version.

I found that for the standing-on-the-head-and-spinning-on-the-chair trick to work it’s important that you spin counterclockwise. Perhaps you spun clockwise? 🙃

In all seriousness, though, I’m running OBS on a M1 Mac with Rosetta and global keyboard shortcuts work as they should most of the time. When they don’t, restarting OBS fixes it. My keyboard shortcuts are always control+option+command+KEY. 🤷‍♂️

leafac avatar Jun 20 '22 08:06 leafac

For what it’s worth:

I updated to OBS 28.0.2 and the issue got worse: Now my favorite kind of keyboard shortcut (control+option+command+KEY) doesn’t work at all 🤷

Other kinds of keyboard shortcut, for example, control+KEY work. I don’t know if they’d stop working after a while…

Note that https://github.com/obsproject/obs-studio/pull/3914 has been merged, so I assume that the reimplementation has happened, right?

leafac avatar Sep 24 '22 11:09 leafac

Multiple hotkey fixes went into OBS Studio 28/28.0.2. For hotkeys to work when OBS is not in-focus, you must enable the Accessibility permission for OBS.

For the described "erratic" nature of hotkeys when OBS is in-focus, please provide one example hotkey combination and specific steps to reproduce that we can test. Please test on OBS Studio 28.0.2 or newer, and preferably on macOS 12 (or latest stable).

RytoEX avatar Sep 24 '22 21:09 RytoEX

Issue was fixed for me in the latest update (28). Great work team!

siddicky avatar Sep 25 '22 10:09 siddicky

@RytoEX

Thanks for the answer!

For hotkeys to work when OBS is not in-focus, you must enable the Accessibility permission for OBS.

Yes, I did that. By the way, the OBS team did a great job with the whole “Review App Permissions” workflow. It’s awesome! 👍

For the described "erratic" nature of hotkeys when OBS is in-focus, please provide one example hotkey combination

Control+Option+Command+A. (But really, as I mentioned, Control+Option+Command+ANY-KEY doesn’t work, I’m saying Control+Option+Command+A because you asked for one specific example 😬)

and specific steps to reproduce that we can test.

The usual workflow, really: Open OBS, create a scene, go to Settings > Hotkeys > SCENE > Switch to scene, assign a keyboard shortcut, “Apply”, press the keyboard shortcut, and OBS doesn’t switch to the scene as it should.

I can record a short video if you think that may help uncover something odd that I’m doing and not noticing.

I tried other keyboard shortcuts like Control+KEY and they work, so it seems to be related to the Control+Option+Command combination.

I thought that perhaps the key combinations I tried were clashing with another application, but I don’t think that’s the case for two reasons: 1. After having tried OBS, I bound the same key combination in Hammespoon and it worked; and 2. I tried a bunch of key combinations, and none of them worked in OBS: Control+Option+Command+{A,R,T,Y,F,G,H,J,K,V,B,N,M}.

Please test on OBS Studio 28.0.2 or newer, and preferably on macOS 12 (or latest stable).

I’m running OBS Studio 28.0.2 and macOS Monterey 12.6 (the latest stable).

leafac avatar Sep 25 '22 16:09 leafac

Can confirm that Cmd, Ctl, and Alt seem to be mutually exclusive when in-focus. Out-of-focus, I couldn't find combinations that didn't work.

gxalpha avatar Sep 25 '22 17:09 gxalpha

@gxalpha: Oh, yeah! You’re right!

The issue only occurs when the OBS window is in focus. When another window is in focus, the Control+Option+Command+ANY-KEY hotkeys do work! That’s even stranger to me… 🤷

I also played around with different options of Advanced > Hotkeys > Hotkey Focus Behavior, but that doesn’t seem to affect anything.

leafac avatar Sep 26 '22 12:09 leafac

Yeah, things seem to be working now. Should we close the issue then?

meneguzzi avatar Sep 26 '22 12:09 meneguzzi

@meneguzzi:

Yeah, things seem to be working now. Should we close the issue then?

🤔 I don’t think so.

I think that keyboard shortcuts of the form Control+Option+Command+ANY-KEY should work when the OBS window is in focus. Or if there’s a reason why they shouldn’t work, I think that there should be some kind of warning on the interface to mention that and avoid confusion. (I’m thinking of a warning similar to what you see when you try to bind the same key combination to multiple actions. A little ⚠️ icon.)

leafac avatar Sep 26 '22 12:09 leafac

It could be that we need to disable InputMethods the same way we had to disable them for the shortcut configuration screen, as the default InputMethod will "eat" keystrokes that don't result in actual character output.

PatTheMav avatar Sep 26 '22 13:09 PatTheMav

Multiple hotkey fixes went into OBS Studio 28/28.0.2. For hotkeys to work when OBS is not in-focus, you must enable the Accessibility permission for OBS.

For the described "erratic" nature of hotkeys when OBS is in-focus, please provide one example hotkey combination and specific steps to reproduce that we can test. Please test on OBS Studio 28.0.2 or newer, and preferably on macOS 12 (or latest stable).

I have right arrow and numpad 5 set to ‘transition’ in studio mode, both will work maybe once, then stop working completely.

Running 28.1.2, macOS 12, M1 Pro

Have messed with permissions, and hotkey settings, no change in this behaviour. Works briefly again if I restart OBS, but can’t do that mid-event.

eadnams22 avatar Nov 11 '22 18:11 eadnams22

It's also a problem with SHIFT+CTRL+CMD and SHIFT+OPT+CMD when in focus.

SHIFT+CTRL+OPT does seem to work both in and out of focus per my testing.

Wish we could activate stuff directly through a CLI on M1-MAC, but as far as I know the CLI addon is only available for Windows/Linux - unless someone knows of another alternative?

proactivematter avatar Nov 19 '22 16:11 proactivematter

Alas I cannot reproduce either issue - I just tried using hotkey combinations of both <SHIFT+CTRL+CMD> as well as <SHIFT+OPT+CMD> and was able to switch scenes with OBS in focus as well as with Safari in focus.

PatTheMav avatar Nov 22 '22 22:11 PatTheMav

I have also experienced hotkeys stop working after having OBS open for a while. Once they stop working the only fix I have found is to relaunch the application. Mac OS 13.0.1, OBS Studio 28.0.3.

thinksamwp avatar Nov 28 '22 23:11 thinksamwp