sbmpost / AutoRaise

AutoRaise (and focus) a window when hovering over it with the mouse
GNU General Public License v3.0
1.48k stars 60 forks source link

Regression in Sonoma: instant focus, delayed raise #202

Closed dreeves closed 6 months ago

dreeves commented 6 months ago

I had the following working in macOS Ventura:

  1. Focus follows mouse instantly
  2. Raise happens with a delay

But the AutoRaise version I was using in Ventura stopped working when I upgraded to Sonoma and I'm failing to find the right combination of compiler flags and settings to get this working again.

What I've tried so far:

make CXXFLAGS="-DEXPERIMENTAL_FOCUS_FIRST"

plus the following in ~/.AutoRaise:

pollMillis=50
delay=10
focusDelay=1
dreeves commented 6 months ago

Oh! Maybe never mind. I don't know why the above didn't work but the following does seem to work:

  1. Clone the repo: git clone https://github.com/sbmpost/AutoRaise.git autoraise
  2. cd autoraise
  3. make CXXFLAGS="-DEXPERIMENTAL_FOCUS_FIRST"
  4. ./AutoRaise -pollMillis 50 -delay 11 -focusDelay 1
dreeves commented 6 months ago

I spoke too soon. I repeated the above steps to make sure they work and now once again I'm getting delayed focus. This is driving me completely insane.

dreeves commented 6 months ago

I'm continuing to experiment with variants and I think this is the real issue I'm having:

(This is all specific to the EXPERIMENTAL_FOCUS_FIRST flag, without which nothing I want to do works.)

If I do -pollMillis 50 -delay 0 -focusDelay 1 then everything works as expected: ~instant focus-follows-mouse with no autoraise. If I change that -delay 0 to -delay 11 for a 500ms delay on autoraise, everything works as expected when switching between apps, but not when switching between windows of the same app. For the latter, it ignores the focusDelay setting and delays both the focus and the autoraise by 500ms.

sbmpost commented 6 months ago

@dreeves

I noticed a couple of regressions with the latest Sonoma update. I am currently collecting them. Fixing them might not be trivial. Thanks for reporting as always.

sbmpost commented 6 months ago

@dreeves

everything works as expected when switching between apps, but not when switching between windows of the same app. For the latter, it ignores the focusDelay setting and delays both the focus and the autoraise by 500ms.

Might be a side effect of #188. Does downgrading to v4.7 work for you? Of course this is only to pinpoint the problem.

dreeves commented 6 months ago

Ah, alas, I'm seeing the same behavior in 4.7.

(Side note that I persist in being confused by the overloading of "0" to mean "infinity". I probably suggested this before but I think "-1" would be a less confusing choice.)

dreeves commented 6 months ago

I think I can better capture the bug report like so:

Replicata

  1. On macOS Sonoma, git clone the latest version (5.1) of AutoRaise: git clone https://github.com/sbmpost/AutoRaise.git autoraise
  2. cd autoraise
  3. make CXXFLAGS="-DEXPERIMENTAL_FOCUS_FIRST"
  4. ./AutoRaise -pollMillis 50 -delay 11 -focusDelay 1
  5. Put two chrome windows side by side
  6. Move the mouse from one to the other and wait for focus to follow the mouse

Expectata

Since the focusDelay is 1, I expect the focus to change within 50ms. The raising of the window I expect to be delayed by (11-1)*50 = 500ms.

Resultata

Both the focus and the raise are delayed by 500ms.

sbmpost commented 6 months ago

@dreeves

Clear, let's try to get this fixed then.

sbmpost commented 6 months ago

@dreeves should be OK with latest master now.

dreeves commented 6 months ago

Confirmed! You are my hero, seriously.

(And sorry for the convoluted bug report at first. Before I noticed the different-apps-vs-different-windows-in-the-same-app distinction I thought I was going crazy!)

PS: Any hope of the EXPERIMENTAL_FOCUS_FIRST feature graduating from compiler flag to proper setting?

sbmpost commented 6 months ago

@dreeves

Confirmed! You are my hero, seriously.

It is only because of the great feedback I am receiving that allows me to be one ;-)

(And sorry for the convoluted bug report at first. Before I noticed the different-apps-vs-different-windows-in-the-same-app distinction I thought I was going crazy!)

Thats fine, np

PS: Any hope of the EXPERIMENTAL_FOCUS_FIRST feature graduating from compiler flag to proper setting?

I think most people use focus first by now. It is indeed a bit strange that it is experimental. On the other hand, we have seen how Apple can break things easily. This makes me still hesitant to make it a proper setting. I will give it some thought though.