pqrs-org/Karabiner-Elements

Mouse movement affecting tab application switch modification

Rajveer86 opened this issue Β· 26 comments

I have swapped left_command and left_option in simple modifications, and as a complex modification am swapping option+tab and command+tab so that I can maintain the original keyboard button combination for application switching. My complex command is as follows:

{ "description": "CUSTOM BINDINGS - Swap Option+Tab and Command+Tab", "manipulators": [ { "from": { "key_code": "tab", "modifiers": { "mandatory": [ "option" ] } }, "to": [ { "key_code": "tab", "modifiers": [ "command" ] } ], "type": "basic" }, { "from": { "key_code": "tab", "modifiers": { "mandatory": [ "command" ] } }, "to": [ { "key_code": "tab", "modifiers": [ "option" ] } ], "type": "basic" } ] }

This works, however if I move the mouse whilst holding the application switcher open it cancels the command. Is there any way to do what I want and ignore mouse movement input?

kzsh commented

I am also able to produce this issue using a similar but distinct configuration (added at the bottom of this comment for reference).

What's odd is that I have the same configuration on two laptops, one of which has this issue and one of which does not.

The issue can be reproduced on:
MacBook Pro (Retina, 13-inch, Early 2015), OS 10.12.6
running Karabiner Elements 11.0.0, where the Internal keyboard product id is: 627

The issue does not appear on:
MacBook Pro (Retina, 15-inch, Mid 2014), OS 10.12.6
running Karabiner Elements 0.91.16, where the Internal keyboard product id is: 610

The json configuration is identical on both machines. As I understand it, there shouldn't be a difference between KE 11.0.0 and 0.91.16, so maybe we can rule that out.

I'm happy to try changing other system settings if there are any that might be relevant, like mouse focus, but I'm not aware of any in particular.

{
      "description": "Use right_command+;/' to cycle through running applications (like command+tab).",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "right_command"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "left_command"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "semicolon",
            "modifiers": {
              "mandatory": [
                "right_command"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "left_command",
                "left_shift"
              ]
            }
          ]
        }
      ]
    }
kzsh commented

Not exactly a fix, but I was able to work around this for my setup by mapping right_command + semicolon to right_command + tab instead of trying to switch right_command to left_command (e.g. right_command + semicolon -> left_command + tab.

I am also having this problem with latest Karabiner 11.3.0 and OSX 10.12.6

I am also having this problem with Karabiner 11.4.0 and OSX 10.13.2

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue still exists on 11.6.0 and should be reopened.

Please, if anybody solve this problem, let us know

Still having this issue on 11.6.0 and OSX 10.13.3

I also have this problem! I mapped tab+ q and w to switch applications, and If I tap on the trackpad it would cancel the switcher. Version 12.0.0 on a os x 10.13.2

I installed LiteSwitch X so I solved a problem for now

Why is this closed? Would be great if the solution (if there is any) was posted here since it was the top from google with one of my google searches for this problem.

Is there a ignore_trackpad option i might have missed?

I checked the karabiner event viewer and whenever i slightly touch the trackpad on my macbook pro key_up events are performed. I have these rules:

                "rules": [
                    {
                        "description": "Settings since i use Witch app and want to use cmd tab as a short cut",
                        "manipulators": [
                            {
                                "description": "WITCH Cycle Apps FORWARD with cmd+tab ",
                                "from": {
                                    "key_code": "tab",
                                    "modifiers": {
                                        "mandatory": [
                                            "left_command"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "tab",
                                        "modifiers": [
                                            "option"
                                        ]
                                    }
                                ],
                                "type": "basic"
                            },
                            {
                                "description": "WITCH Cycle Apps BACKWARD with cmd+shift+tab ",
                                "from": {
                                    "key_code": "tab",
                                    "modifiers": {
                                        "mandatory": [
                                            "left_command",
                                            "shift"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "tab",
                                        "modifiers": [
                                            "option",
                                            "shift"
                                        ]
                                    }
                                ],
                                "type": "basic"
                            },
                            {
                                "description": "WITCH Cycle Apps with Instances FORWARD with cmd+down_arrow",
                                "from": {
                                    "key_code": "down_arrow",
                                    "modifiers": {
                                        "mandatory": [
                                            "left_command"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "down_arrow",
                                        "modifiers": [
                                            "option"
                                        ]
                                    }
                                ],
                                "type": "basic"
                            },
                            {
                                "description": "WITCH: BACKWARD Cycle Apps with Instances BACKWARD with cmd+shift+down_arrow",
                                "from": {
                                    "key_code": "down_arrow",
                                    "modifiers": {
                                        "mandatory": [
                                            "left_command",
                                            "shift"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "down_arrow",
                                        "modifiers": [
                                            "option",
                                            "shift"
                                        ]
                                    }
                                ],
                                "type": "basic"
                            },
                            {
                                "description": "APPLE: FORWARD - Use option+tab for regular app switch",
                                "from": {
                                    "key_code": "tab",
                                    "modifiers": {
                                        "mandatory": [
                                            "option"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "tab",
                                        "modifiers": [
                                            "left_command"
                                        ]
                                    }
                                ],
                                "type": "basic"
                            },
                            {
                                "description": "APPLE: BACKWARD - Use option+down_arrow+down for regular app switch backwards",
                                "from": {
                                    "key_code": "tab",
                                    "modifiers": {
                                        "mandatory": [
                                            "option",
                                            "shift"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "tab",
                                        "modifiers": [
                                            "left_command",
                                            "shift"
                                        ]
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    }
                ]
            },

Okey, i solved or might i say hacked a solution by adding

                                "to_after_key_up": [
                                    {
                                        "key_code": "left_option",
                                        "modifiers": [
                                            "left_command"
                                        ]
                                    }
                                ]

to my WITCH manipulators. Probably not that great for performance but works like expected at least. Although this didnt work for my APPLE: FORWARD manipulators, so i removed them completely, i will just access apples Application Switcher with right_command + tab. So now i use left_command + tab for WITCH Application switcher and right_command + tab for Apples Application switcher.

I couldn't make oskarleonard's solution work.

Still having the issue.

This has actually been a problem since the release of the software. It’s just that maintenance personnel have been ignoring this issue. I have also mentioned similar drops #1554 .

In the end, I can only use a Japanese developer to create open source software to solve the problem.

https://github.com/iMasanari/cmd-eikana

BTW: Combination buttons can be solved with this software.

+1 for this enhancement.
I re-mapped the application switch bindings and it's kinda annoying that the switch panel disappear if you move your mouse, or use your trackpad at the same time 😒

+1 for this enhancement.
I re-mapped the application switch bindings and it's kinda annoying that the switch panel disappear if you move your mouse, or use your trackpad at the same time 😒

You can use LiteSwitch X as a workaround for now as @Shavcat suggested.

I installed it too and it works fine.

My bad, I didn't see the message above about LiteSwitch X.
Thank you @enesaltinkaya for sharing this again!

I wish that i didnt need to use liteswitch x and that this was just supported in karabiner, karabiner has been perfect for every other keyboard modification ive made on OSX otherwise and i expect they can tackle this too.

does anyone know a repo member that would reopen this issue to get it out there and eventually resolved? that would be great thank u.

Please reopen. Producing literally any input whatsoever while in the application switcher causes this issue: Moving the mouse, pressing escape, pressing shift, pressing anything -> application switcher choses its selection. I'd love a fix.

umbum commented

This issue still exists on 12.8.0

The issue can be reproduced on:
MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports), OS 10.15.1
running Karabiner Elements 12.8.0, where the Internal keyboard product id is: 635

The issue does not appear on:
MacBook Pro (15-inch, 2017), OS 10.14.6
running Karabiner Elements 12.8.0, where the Internal keyboard product id is: 632

The json configuration is identical on both.

this issue still exists. it's sending both left gui and left alt when my mouse moves

type:key_down        code:226        name:left_alt        misc:flags: left_alt 
type:key_up          code:226        name:left_alt        misc:
type:key_down        code:227        name:left_gui        misc:flags: left_gui 
type:key_down        code:43         name:tab             misc:flags: left_gui 
type:key_up          code:43         name:tab             misc:flags: left_gui 
**type:key_down        code:226        name:left_alt        misc:flags: left_alt,left_gui** 
type:key_up          code:227        name:left_gui        misc:flags: left_alt 
type:key_up          code:226        name:left_alt        misc:

I don't think Lightswitch X works on Catalina, at least I can't get the switcher to show up at all except for the Preferences pane.

So this problem still exists, unnecessary mouse events prevent making this work.

Up: The issue was closed, but the problem still exists. No fixes or workarounds?

Okey, i solved or might i say hacked a solution by adding

                                "to_after_key_up": [
                                    {
                                        "key_code": "left_option",
                                        "modifiers": [
                                            "left_command"
                                        ]
                                    }
                                ]

I figure out what @oskarleonard means here. After testing with several combinations, I realized that the modifier key would be held if you add it to the modifiers of to_after_key_up.

I use AltTab for Windows-like window control on macOS, make its shortcut to left_command + quote ('), then map left_command + tab to left_command + quote in Karabiner. AltTab and the rule in Karabiner should use the same modifier (the conclusion of my testing, or this hack will fail), so I choose left_command here. the full rule is:

{
    "description": "AltTab: Left_Command + Tab => Left_Command + quote(')",
    "manipulators": [
        {
            "type": "basic",
            "from": {
                "modifiers": {
                    "mandatory": [
                        "left_command"
                    ]
                },
                "key_code": "tab"
            },
            "to": [
                {
                    "repeat": true,
                    "key_code": "quote",
                    "modifiers": [
                        "left_command"
                    ]
                }
            ],
            "to_after_key_up": [
                {
                    "key_code": "left_control",
                    "modifiers": [
                        "left_command"
                    ]
                }
            ]
        }
    ]
}

The magic here is, after we add left_command to the modifiers list in to_after_key_up and press left_command + tab, it would be held until we release it, even if we move the mouse or trackpad. The key_code in to_after_key_up isn't important, so I choose harmless left_control for myself.


AltTab:
211230_202230_963

The "to_after_key_up" hack doesn't work for me when I map Ctrl+Tab to Alt+Y using this configuration with the described hack:

// in rules.manipulators

 "from": {
  "key_code": "tab",
  "modifiers": {
    "mandatory": [
      "left_control"
    ],
    "optional": [
      "left_shift"
    ]
  }
},
"to": [
  {
    "key_code": "y",
    "modifiers": [
      "left_option"
    ]
  }
],
"to_after_key_up": [
  {
    "key_code": "lang9",
    "modifiers": [
      "left_option"
    ]
  }

When I press Ctrl+Tab and move mouse it dispatches Alt UP event and this means that I released the key and the tab switcher closes its popup and moves me to the selected tab, but I just barely touched my trackpad.
Here is the key event sequence that is produced:

// I press Ctrl+Tab
type:down            HID usage: 7,224     name:{"key_code":"left_control"}                             misc:flags left_control
type:up              HID usage: 7,224     name:{"key_code":"left_control"}                             misc:
type:down            HID usage: 7,226     name:{"key_code":"left_option"}                              misc:flags left_option
type:down            HID usage: 7,28      name:{"key_code":"y"}                                        misc:flags left_option
type:up              HID usage: 7,28      name:{"key_code":"y"}                                        misc:flags left_option
type:down            HID usage: 7,152     name:{"key_code":"lang9"}                                    misc:flags left_option
type:up              HID usage: 7,152     name:{"key_code":"lang9"}                                    misc:flags left_option
// I move mouse
type:down            HID usage: 7,224     name:{"key_code":"left_control"}                             misc:flags left_control,left_option
type:up              HID usage: 7,226     name:{"key_code":"left_option"}                              misc:flags left_control
// I release Ctrl key
type:up              HID usage: 7,224     name:{"key_code":"left_control"}                             misc:

And here is the event sequence without the hack:

// I press Ctrl+Tab
type:down            HID usage: 7,224     name:{"key_code":"left_control"}                             misc:flags left_control
type:up              HID usage: 7,224     name:{"key_code":"left_control"}                             misc:
type:down            HID usage: 7,226     name:{"key_code":"left_option"}                              misc:flags left_option
type:down            HID usage: 7,28      name:{"key_code":"y"}                                        misc:flags left_option
type:up              HID usage: 7,28      name:{"key_code":"y"}                                        misc:flags left_option
// I move mouse
type:down            HID usage: 7,224     name:{"key_code":"left_control"}                             misc:flags left_control,left_option
type:up              HID usage: 7,226     name:{"key_code":"left_option"}                              misc:flags left_control
// I release Ctrl
type:up              HID usage: 7,224     name:{"key_code":"left_control"}                             misc:

Using AltTab, I just unbound option+tab in karabiner and set the keybind instead the AltTab settings, and that works fine.