kakaroto / Beyond20

D&D Beyond Character Sheet Integration in Roll20
GNU General Public License v3.0
497 stars 145 forks source link

Add mac-specific default hotkeys when running on a Mac #924

Closed gedankenexperimenter closed 2 years ago

gedankenexperimenter commented 2 years ago

When holding shift and clicking to roll with advantage, everything works fine, but on macOS, holding control causes the trackpad to send a right-click instead of a left-click, so using it for disadvantage doesn't work. There doesn't seem to be any way to turn off this behaviour of the trackpad in macOS, so control+left click simply isn't possible without an external mouse (or other pointing device).

A solution would be to use alt instead of (or in addition to) control for disadvantage, rather than using it for a normal roll, or at least let the user configure it that way.

Aeristoka commented 2 years ago

This is specifically why you can use the Hotkey Manager to set your own hotkeys. Pictured below are the defaults, but you can customize to your heart's content: image

kakaroto commented 2 years ago

As far as I know, the control should work. Unless you customized it and removed that binding. If you can do the custom hostkey and change the hotkey, see what the name of your key is, it should show ControlLeft, if it shows something else, let us know.

gedankenexperimenter commented 2 years ago

I had not successfully found the hidden options; thank you. control+left click would work, but macOS changes it to just right click if you use the trackpad (for accessibility for people who have difficulty doing a two-finger gesture), and there's no way to turn that off. Sticky hot keys also solves the problem, incidentally. All that said, I maintain that a better default would be to use alt rather than control for disadvantage. This is especially true for users who want to make use of "super disadvantage", since there's no right control key on a lot of Apple keyboards, but there is a right option (i.e. alt) key.

Aeristoka commented 2 years ago

I don't think defaults need to change when you can set whatever you like in the Hotkey Manager, its entire job is to make things convenient for you.

kakaroto commented 2 years ago

Alt is seldom used and I chose alt for "normal" because I expect "normal roll" to be seldom used. The issue with Alt is that it's also the native hotkey for all windows to open the menu, so if the user presses Alt and doesn't click, then things stops working because the focus is now on the menubar of the window. I don't know if it's a Windows thing only but that's the reason Alt was chosen for the rarely used 'normal rolls'. Either way, defaults will never change at this point because that would break half a million users who might already have their muscle memory and a change in behavior is a very bad thing to do at this point.

The issue with control+click becoming a right click as an accessibility on Mac is an interesting problem, one I hadn't heard before I think, and I think having a different set of hotkeys for Mac OS X users only might be a possible solution we can look at. I don't know though if all macs have the same weird mac-only keyboard layout, if there is always a option key or not.. also, we could probably make use of the Command key which is at least standard on mac. Unfortunately without a Mac, I can't test for the various keys and see what works best. If you could do that for us, that'd be great, show us a screenshot of your hotkeys window which shows the name of the keys, along with which key they represent on a mac keyboard. I'm re-opening this issue but renaming it appropriately. Thanks.

gedankenexperimenter commented 2 years ago

Apple uses the same keyboard modifier keys as Windows (and Linux, and everything else that uses the USB HID spec), just with different names for half of them. So on macOS, alt is called option, and gui (the "Windows" key on Windows, which you have labelled as MetaLeft (and MetaRight) in the Beyond20 Hotkey Manager) is called command. Most of the physical keyboards made by Apple for the past few years have omitted the right control key, because it's the least used modifier in their software, and they want to make space in the bottom right for arrow keys.

Since it's very common for command to be used on macOS where control would be used on Windows and Linux, it would be reasonable to simply add default hotkeys for MetaLeft and MetaRight for disadvantage & "super disadvantage", respectively. If that causes problems on Windows, making it OS-specific for macOS makes sense.

gedankenexperimenter commented 2 years ago

On a side note, it's rather unconventional to label modifier keys the way you have. It's nearly universal to use the names as they are presented in the USB HID spec, with the "left" or "right" first (e.g. LeftControl rather than ControlLeft). In one case, the argument for using the standard order is particularly strong: AltRight sounds unfortunately political, at least in the United States.

kakaroto commented 2 years ago

Ok thanks, I'll add MetaLeft and MetaRight on Mac as a replacement for the Control options. For the alt buttons, they are named "Option" in Mac but they still appear as AltLeft and AltRight, is that correct (should be) ?

As for the names, it's not unconventional, and it's not our choice, it's what the browser gives us, check it out here : https://www.w3.org/TR/uievents-code/#key-alphanumeric-functional Or try them out here : https://keycode.info/ If we don't use the right name as defined by the standard, it won't work :P (or more specifically, we're just displaying the event keycode the browser gives us)

gedankenexperimenter commented 2 years ago

For the alt buttons, they are named "Option" in Mac but they still appear as AltLeft and AltRight, is that correct (should be) ?

Yes, that's how they appear, and that's correct. I think it's pretty common for macOS users to know that alt and option are the same thing. They'll be less familiar with meta, but it doesn't matter too much. If you want to go all out, you could display different things based on the OS, rather than using the JavaScript code identifiers (I've never written JS code, so I wasn't familiar with their identifiers, thanks).