yqrashawn / GokuRakuJoudo

config karabiner with ease
GNU General Public License v3.0
1.14k stars 121 forks source link

Support more than 5 buttons in ":pkey" #46

Closed ctechols closed 4 years ago

ctechols commented 4 years ago

I have a mouse with 7 buttons. According to the Karabiner Event Viewer, the seventh button sends a combination of (tab, left_control, left_alt). I wanted to use Goko to translate this into 'button7' instead.

I tried a rule like this:

{:des "enable extra mouse btn" :rules [[:!TOtab {:pkey :button7}]]}

When I run goku I get this result:

ERROR: invalid pointing key code :button7
Failed!

I'm not a clojure guy, but keys-info.clj makes it look like the pkey keyword will only support up to :button5. I think (from playing with the 'Simple modifications' tab) Karabiner-Elements supports up to button32. Can goku be extended with support for more buttons?

Thanks.

yqrashawn commented 4 years ago

There's no button7 in karabiner. That's why there's no button7 in keys-info.clj file.

You can't define your own key. If your button7 gives you :!TOtab, you can remap it to other shortcuts. But you can't define a :button7 and use it in other place.

In goku you can define keys in :froms and use them later in rules.

{:profiles
 {:Default {:default true
            :sim     50
            :delay   500
            :alone   500
            :held    500}}
 :froms {:button7 {:key :!TOtab}}
 :main  [{:des "button7 to a"
          :rules
          [[:button7 :a]]}]}
ctechols commented 4 years ago

There's no button7 in karabiner. That's why there's no button7 in keys-info.clj file.

I'm not sure what you mean by this. In my copy of Karabiner (12.8.0), when I look under 'Simple Modifications -> To Key', the 'Mouse buttons' section of that drop-down lists button1 through button32. I was assuming the button entries in keys-info.clj were the equivalent of what I see in this drop-down.

My goal was to make it so Better Touch Tool would perform an action when I click this button. Here's a raw karabiner rule that seems to accomplish that:

        {
            "description": "Turn ctrl-alt-tab into button7",
            "manipulators": [
                {
                    "type": "basic",
                    "from": {
                        "key_code": "tab",
                        "modifiers": {
                            "mandatory": [
                                "left_control",
                                "left_alt"
                            ]
                        }
                    },
                    "to": {
                        "pointing_button": "button7"
                    }
                }
            ]
        }

With this rule active, Karabiner's event viewer now shows button_down, button_up events for this button, and BTT detects a click of the button when adding an action under the 'Normal Mouse' section of preferences.

yqrashawn commented 4 years ago

goku.zip

Don't know that karabiner support button keys up to 32. Sorry for that.
This is a temp version for testing if it works to just add more button keys to keys_info. Please tell me if it works and I'll release a version with that new keys_info file. @ctechols

ctechols commented 4 years ago

This rule works now:

{:des "Send button7" :rules [[:!TOtab :button7]]}

Thanks for looking into this!

yqrashawn commented 4 years ago

Release 0.2.8 fixed this. You can use brew upgrade goku to upgrade to the new version. https://github.com/yqrashawn/GokuRakuJoudo/releases/tag/v0.2.8