Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left SHIFT key on Mac #38

Open
TobyLobster opened this issue May 31, 2022 · 8 comments
Open

Left SHIFT key on Mac #38

TobyLobster opened this issue May 31, 2022 · 8 comments

Comments

@TobyLobster
Copy link

TobyLobster commented May 31, 2022

Running the tagged version v0.9.7, I notice that the left SHIFT key on the Mac doesn't act as shift. The right SHIFT key does work, but not the left.

I realise you know about this already, but it does seem like a bug nonetheless! Is it possible to map BBC caps lock to a different Mac key somewhere out of the way - I tend not to use it that much, unless playing Zalaga :-) I use left SHIFT all the time in comparison.

@scarybeasts
Copy link
Owner

For now, this is unfortunately working as planned.

The Mac left shift key maps to the beeb's Caps Lock key. This is because modern macOS does not seem to treat caps lock like other keys and I've been unable to get it working correctly. So given that the beeb Caps Lock is so important for games, I used the Mac left shift for now.

@TobyLobster
Copy link
Author

TobyLobster commented May 31, 2022

Yes. I looked into the problem a little but didn't find an ideal solution: I see "flagsChanged:" doesn't fire on a key up for Caps Lock, only on key down. A solution using IOHIDDevice should work but will give the user an off-putting warning message on a first run. B2 had this issue too tom-seddon/b2#167 and went with the IOHIDDevice solution anyway.

One simpler possibility would be to move the Beeb '@' key from the Mac's "`~" to the "±§" key, then put the Beeb's CAPS LOCK onto "`~" on the Mac.

@scarybeasts
Copy link
Owner

I looked at the IOHIDDevice solution and unfortunately I think it got locked down in more modern macOS, such that the user has to authorize the app to use that API. I wanted to steer away from any password dialogs popping up.

Where is the "±§" key? I'm not sure my MacBook Air has one. It seems to have a general lack of keys, which is a real headache :)

@TobyLobster
Copy link
Author

I don't believe it's a password dialog, but is a "request permission" dialog which is worded scarily for an unsuspecting user.

On further investigation the "±§" key appears to be on UK keyboards but not US keyboards. So that's not a great solution either.

@tom-seddon
Copy link
Collaborator

tom-seddon commented May 31, 2022

Did the IOHIDDevice ever work for you? I noticed that because b2 isn't notarized, every b2 build is considered different, meaning b2 needs to be manually removed from the control panel after every build: tom-seddon/b2#197 (can't remember which macOS that was with? Probably Big Sur)

People downloading it have an easier time and need only do this after upgrading.

I had some warnings when running the CI builds of the BeebLink server, also not notarized, "fixed" with some xattr stuff that strips off the quarantine flag: https://github.com/tom-seddon/beeblink#macos - haven't experimented to see whether this could make a difference too.

--Tom

@scarybeasts
Copy link
Owner

I confess I didn't try IOHIDDevice myself. I read about it, didn't like the sounds of it, and failed to try it.

@TobyLobster
Copy link
Author

For completeness, I notice that CGEventTapCreate is another possible way to detect Caps Lock. But it only works if you are a root user or have an accessibility setting enabled. So that doesn't seem like a great solution either. See the discussion section of https://developer.apple.com/documentation/coregraphics/1454426-cgeventtapcreate

@TobyLobster
Copy link
Author

For further completeness, here is the dialog that appears on first run with the IOHIDDevice solution:
Screenshot 2022-06-08 at 07 47 17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants