yabai icon indicating copy to clipboard operation
yabai copied to clipboard

Bug: Holding down modifier key prevents default click behavior

Open Subjective opened this issue 1 year ago • 3 comments

I use option as my modifier key, which works fine for the most part. However, when I need to hold down option to click on an item in a context menu (e.g. the finder app's right click menu), the click fails to register. Since the only use case for the modifier keys is holding down click to drag while resizing/moving windows, would it be possible to differentiate clicks from dragging? Thanks.

Screen Recording 2023-07-12 at 2 47 06 AM

Subjective avatar Jul 12 '23 09:07 Subjective

👍 to this. I have ALT-click+drag to move windows in yadr, and this inhibits ALT-click on, say, menubar items (to show extended menus). It would be awesome to be able to differentiate these.

egrefen avatar Aug 31 '23 09:08 egrefen

Probably best solved as explained in https://github.com/koekeishiya/yabai/issues/601

koekeishiya avatar Aug 31 '23 13:08 koekeishiya

I've had similar weird interactions when I set my mouse_modifier to cmd trying to cmd+click links into new tabs. Not a specific fix for your problem, but I ended up using hidutil to remap right_control to fn and having yabai use fn as the mouse_modifier since that seems to have the least undesired interactions.

gist here: https://gist.github.com/mattbailey/9429c7691467bf82d64e1900c99fb53b generated with this tool: https://hidutil-generator.netlify.app/

mattbailey avatar Nov 30 '23 17:11 mattbailey

Wouldn't it be possible for yabai to capture the click only when the action is dragging (at least for windows move/resize) ?

dobladez avatar Feb 21 '24 13:02 dobladez

It's not quite that simple.

"Dragging" in macOS can only take place when a mouse button is held/pressed/down. The feature in yabai is built around the events reported by macOS, which for any drag-operation first consists of a mouse-down event, followed by one or more mouse-drag events, until a mouse-up event takes place.

For "click anywhere" to work, yabai needs to intercept the initial click event that is reported before the drag events begin. These events are reported in the same thread, in sequence. yabai cannot side-step the click, wait for a drag event to come in, and then tell macOS to void (make a no-op out of) the previously performed mouse-click.

The best that I can think of would be to replicate the click if no drag-events occur in between the mouse-down and mouse-up event.

koekeishiya avatar Feb 21 '24 14:02 koekeishiya

Thanks!

dobladez avatar Feb 21 '24 22:02 dobladez

New change somehow randomly causes segfaults... Not completely sure why, code looks fine to me, but w/e easy fix.

koekeishiya avatar Feb 22 '24 17:02 koekeishiya