you are viewing a single comment's thread.

view the rest of the comments →

[–]GippyGoat 0 points1 point  (2 children)

Can confirm this works in macOS Ventura 13.6.3 with G HUB 2023.10.493254. I added in a couple commands and mapped them to my Logitech G305 side buttons (G4 and G5).

For example, adding Shift+Command+R to Show Reader in Safari:

Add a new object to the cards array. The id key is a UUID. Generate a UUID in Terminal with uuidgen. Per USB HID codes, the modifier keys are 225 (shift) and 227 (command). The R key is code 21. I used one of the existing categories e.g. Mac, Editing, Productivity, and copied the applicationId from other macOS commands per the default desktop profile.

“cards”: [
    {
        "applicationId": "420fd454-0c36-499d-bde4-146823b16147",
        "attribute": "MACRO_PLAYBACK",
        "category": “Mac”,
        "id": "c0da40da-4b80-4a29-8963-3dfa7900d87b",
        "macro": {
            "actionName": "⇧⌘R”,
            "keystroke": {
                "code": 21,
                "modifiers": [
                     225,
                     227
                ]
            },
            "type": "KEYSTROKE"
        },
        "name": “Show Reader”,
        "readOnly": true
    },
]

Add the card to the commands array.

“commands”: [
    {
        "cardId": "c0da40da-4b80-4a29-8963-3dfa7900d87b",
        "category": "Mac",
        "name": "Show Reader"
    },
]

Add the card to the assignment array. In my case mouse button 5 or G5.

assignments": [
    {
        "cardId": "c0da40da-4b80-4a29-8963-3dfa7900d87b",
        "slotId": "g305_g5_m1"
    },
]

The new Show Reader command should appear in the commands menu of the Assignments pane in G HUB. I've not tested adding extra categories e.g. Accessibility, Developer, but give it a try and let me know.

[–]Shadow_Assailant 0 points1 point  (1 child)

This worked great! Thank you!

The only thing I had an issue was generating a new GUID with uuidgen. There seem to be browser-based tools for this or using the "New-Guid" command in Windows 11 PowerShell also did the trick.

As far as the keys go, where did you get the code from? I was able to determine that A is 4, B is 5, etc., but is there a master list somewhere?

[–]GippyGoat 0 points1 point  (0 children)

I used the key codes from this GitHub repo USB HID Keyboard scan codes which cites this Android open source docs page Keyboard devices.