Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apps auto raise when hovering over Dock after unplugging external display #660

Closed
Surimitzu opened this issue Sep 13, 2020 · 21 comments
Closed
Labels
help wanted Community help appreciated

Comments

@Surimitzu
Copy link

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.

@acmcelwee
Copy link

This sounds like the same symptoms described in #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.

@Boltzmachine
Copy link

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

@Surimitzu
Copy link
Author

Surimitzu commented Sep 23, 2020

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.

@acmcelwee
Copy link

@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.

@acmcelwee
Copy link

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.

@midfm
Copy link

midfm commented Oct 11, 2020

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.

@Boltzmachine
Copy link

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

@midfm
Copy link

midfm commented Oct 14, 2020

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.

@choco
Copy link

choco commented Oct 26, 2020

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

@stockmind
Copy link

stockmind commented Nov 14, 2020

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

@koekeishiya
Copy link
Owner

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?

@koekeishiya koekeishiya added the help wanted Community help appreciated label Nov 14, 2020
@choco
Copy link

choco commented Nov 17, 2020

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

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

@koekeishiya
Copy link
Owner

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

@choco
Copy link

choco commented Nov 17, 2020

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

koekeishiya added a commit that referenced this issue Nov 17, 2020
@koekeishiya
Copy link
Owner

Should be fixed on master.

@koekeishiya
Copy link
Owner

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.

@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Dec 3, 2020
@nctiggy
Copy link

nctiggy commented Jan 18, 2021

Still seeing this on MacBook Pro (16-inch, 2019) Version 11.1 (20C69)
yabai-v3.3.6
Stop/Start does fix until un-docking again

@cantfindagood1
Copy link

I'm seeing this on a 15-inch 2018 MBP running Catalina 10.15.7 and Yabai 3.3.7. Definitely seems to have something to do with switching between discrete GPU and the built-in Intel GPU. I use my MBP with a dock and 3 external displays during the day, which forces it to use the discrete GPU. When I un-dock in the evenings, it generally switches to the integrated GPU, and this is when I start getting the unintended clicks behavior. I notice it mostly on the dock, but it also happens in pull-down menus within some applications and even pull-down selection lists on webpages in Opera. Restarting Yabai corrects it temporarily. Switching from integrated GPU to discrete GPU when I dock again does not seem to trigger the behavior.

@jdarren
Copy link

jdarren commented Apr 14, 2021

not sure what the repo case is, but I do occasionally see this behavior (i.e. phantom clicks when hovering on dock) as well. using yabai-v3.3.7

@catlee
Copy link

catlee commented Jun 6, 2021

still seeing this with v3.3.8

@bergerx
Copy link

bergerx commented Jun 6, 2021

I have been struggling with this annoying issue for a long while, after reading the comment of @cantfindagood1 above, I found https://nathansnelgrove.com/how-to-force-your-macbook-pro-to-use-its-discrete-graphics-card-when-its-plugged-in/.

When I'm away from my monitors I just use the sudo pmset -a gpuswitch 0 to force my laptop to fix the GPU to the integrated one, and this issue never happened again.

Here are some notes on the command:

-a --> all
-b --> battery
-c --> charger (wall power)
-u --> UPS

# Always use the integrated graphics card
sudo pmset -a gpuswitch 0

# Always use the discrete graphics card
sudo pmset -a gpuswitch 1

# Automatically switch between discrete and integrated graphics card (this is the default setting)
sudo pmset -a gpuswitch 2

unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community help appreciated
Projects
None yet
Development

No branches or pull requests