Yabai: Apps auto raise when hovering over Dock after unplugging external display

Created on 13 Sep 2020  路  16Comments  路  Source: koekeishiya/yabai

Hello,

I have installed yabai with a minimal setup (to use "focus follow mouse" feature, without auto raise):

yabai -m config focus_follows_mouse autofocus

I'm very satisfied with it, however I noticed, that sometimes (I haven't figured out real root cause yet) all apps auto raise, but only when I hover over them in Dock. Then I need to restart yabai to fix this. It seems like it has something to do with external display, because if I plug it in, it works ok, but if I unplug, I face this issue. Seems like it's not replicable everytime I do this tho, but I was not able to reproduce it differently so my guess is that it has something to do with external display un/plugging.

Has anyone experienced this issue? Any idea how to fix it?

Thank you.

help wanted

Most helpful comment

yeah, I also have this problem every time I start my machine. It disappears after I restart yabai.

All 16 comments

This sounds like the same symptoms described in https://github.com/koekeishiya/yabai/issues/637, and I can confirm that I still occasionally experience the issue. I also have an external display, but I haven't been able to determine the exact scenario that causes it to start happening. Since it maybe happens once a week for me, I've just gotten used to restarting yabai when it happens.

yeah, I also have this problem every time I start my machine. It disappears after I restart yabai.

I guess I have found another clue. I've got MBP 15 with dedicated graphics and when I go to System Preferences -> Energy Saver -> Uncheck Automatic graphics switching (to use only dedicated AMD GPU) seems like the issue is gone and I haven't experienced this from the time I unchecked that when plugging/unplugging external display.

Because I think when external display is plugged in, Mac automatically switches to dedicated GPU and if this option is checked, after unplugging it switches back to integrated low power one. So this switching might be the cause.

@Surimitzu, you're on to something here. I'm working on my laptop after disconnecting the monitor, and I just hovered over a MacOS menu bar, and the annoying clicks (that we've all described here) started happening.

As soon as I started experiencing this, I recalled the update on this issue that I'd seen, and I opened up System Preferences and unclicked the "Automatic graphics switching" option. After that point, hovering over any MacOS UI elements (menu bar items, Dock icons, etc) did not trigger the phantom clicks that are being described here. I can toggle that graphics switching option back on, and I can now reliably trigger the phantom clicks on the MacOS UI elements. Unclicking the option resumes the normal behavior of not experiencing the phantom clicks.

If there's any more diagnostic info I can capture, I'm happy to collect it, and I'll see if I can now figure out how to reliably get into this odd state.

Ok, I can reliably reproduce this. For me, the steps to reproduce are:

  • Plug sleeping MacBook Pro into external monitor (via USB-C) w/ the MBP lid closed
  • Wake from sleep
  • Login to MBP
  • Restart yabai - brew services restart yabai
  • Verify no unwanted "click on hover" behavior
  • Open MBP screen
  • Disconnect from external monitor

From here, I consistently experience the "phantom click on hover" behavior until I either restart yabai or unclick the "Automatic graphics switching" option. Re-enabling that graphics switching option reliably brings the unwanted behavior back. Restarting yabai permanently resolves the issue until I go through this same sequence.

I've tried this sequence with that option both enabled and disabled at the beginning of the sequence, and it doesn't seem to impact the final outcome.

I can also reliably reproduce this on 3.3.0, with autofocus* on (does not happen with autoraise).

Any switch away from the discrete GPU (i.e. unplugging ext. monitor, or using a utility like GFXCardStatus to switch to and away from it) will result in the behaviour described above the "phantom click on hover" - it affects both menubar (menu items only - not the actual bar icons) and the Dock. I tried enabling debug_output, then triggering the behaviour, but couldn't see anything useful in either of Yabai's log files.

*Sad to see there are plans to remove autofocus - I much prefer it to autoraise - e.g. I prefer being able to scroll the view in partially occluded windows, without covering my foreground window. I get the choice to raise the lower-layer window with a click if I want to - don't get that flexibility with autoraise.

Well, maybe all of your problems are related to GPU. But my problem just appears randomly. You can never predict when it appears.

Correction to my previous comment - where I stated that I only see this behaviour with autofocus - I do see it with autoraise as well (could have sworn it didn't happen at first, but now it's consistent with autoraise as well, perhaps I was mistaken).

Another potentially interesting data point: if I unplug my external monitor (GPU switches and this behaviour is triggered), I can then plug the monitor back in (switch back to discrete GPU) and the behaviour stops, WITHOUT restarting Yabai.

I'm also experiencing this issue, really annoying :(

Same behavior, macbook pro 16, i9, AMD Radeon Pro 5500M, macOS Catalina 10.15.7, every time the discrete GPU toggle up and then down i keep getting click events fired on everything i hover (menus, apps, icons, dialogs, etc..), it's really dangerous.

brew services restart yabai will fix this until next discrete GPU session is over,

@koekeishiya There is anything we can log/look to help debug this?

Relevant contents of .yabairc

#!/usr/bin/env sh

yabai -m config window_opacity               off

# global settings
yabai -m config mouse_follows_focus          off
yabai -m config focus_follows_mouse          autoraise
yabai -m config window_placement             second_child
yabai -m config window_topmost               off
yabai -m config window_shadow                on
yabai -m config window_border                off
yabai -m config window_border_placement      inset
yabai -m config window_border_width          4
yabai -m config window_border_radius         -1.0
yabai -m config active_window_border_topmost off
yabai -m config active_window_border_color   0xff775759
yabai -m config normal_window_border_color   0xff505050
yabai -m config insert_window_border_color   0xffd75f5f
yabai -m config split_ratio                  0.50
yabai -m config auto_balance                 on
yabai -m config mouse_modifier               fn
yabai -m config mouse_action1                move
yabai -m config mouse_action2                resize

# general space settings
yabai -m config layout                       bsp
yabai -m config top_padding                  5
yabai -m config bottom_padding               5
yabai -m config left_padding                 5
yabai -m config right_padding                5
yabai -m config window_gap                   10

I really don't know why this behaviour would change when a GPU toggle happens and I don't have a discrete GPU in my macbook; it is not really something I can work on. Seems like a macOS issue to me.

Does this happen if you disable focus-follows-mouse?

I haven't been to reproduce this since when I disabled focus-follows-mouse

EDIT: also noticed that both 'autoriseandautofocus` seems to be affected

Can you install version 3.2.0 and try to reproduce the problem.

Yeah, I can't reproduce it with that version, pretty dumb of me to not write down that this started happening once I updated....

Should be fixed on master.

If people are still having this issue in v3.3.5, someone that can reproduce the issue will have to do a git bisect from v3.2.0 and identify the commit that introduces the problem.

Was this page helpful?
0 / 5 - 0 ratings