Skip to content

fix: overlay not showing on non-primary monitors#969

Merged
cjpais merged 3 commits intocjpais:mainfrom
jondeibel:fix/overlay-multimonitor-positioning
Mar 11, 2026
Merged

fix: overlay not showing on non-primary monitors#969
cjpais merged 3 commits intocjpais:mainfrom
jondeibel:fix/overlay-multimonitor-positioning

Conversation

@jondeibel
Copy link
Contributor

@jondeibel jondeibel commented Mar 5, 2026

Before Submitting This PR

Please confirm you have done the following:

Human Written Description

The recording overlay wasn't showing on non-primary monitors. The fix replaces work_area() with monitor.position()/monitor.size() in calculate_overlay_position, since work_area() returns incorrect coordinates for monitors with negative positions. The per-platform OVERLAY_TOP_OFFSET/OVERLAY_BOTTOM_OFFSET constants already account for system chrome (menu bar, taskbar).

This is a single focused change to calculate_overlay_position only, based on CJ's fix in e0954ed. Rebased onto latest main (v0.7.10).

Related Issues/Discussions

Fixes #811

Community Feedback

Multiple users reported this in #811 across both macOS and Windows multi-monitor setups.

Testing

  • Verified overlay appears on the correct monitor based on cursor position at recording start
  • Tested on macOS 26 with 4 monitors (2560x1440 @ 1x, 3024x1964 @ 2x, 1440x2560 @ 1x vertical, 2560x1440 @ 1x)
  • Switching between monitors and starting new transcriptions works without flashing or disappearing
  • Primary monitor behavior unchanged
  • All 44 Rust tests pass, ESLint and formatting checks clean

AI Assistance

  • AI was used (please describe below)

If AI was used:

  • Tools used: Claude Code
  • How extensively: Helped research Tauri coordinate spaces and draft the initial fix, then simplified to match CJ's upstream suggestion (e0954ed)

@jondeibel
Copy link
Contributor Author

@cjpais I can confirm this fixes #811 for macos 26.3. It was driven by claude, so please feel free to just use this as a reference! I am not in love with having it as a macos only fix, given this is also a problem on windows. I will look into a more general fix later today when I test it on my windows machine.

Two issues prevented the recording overlay from appearing on secondary
monitors:

1. Monitor detection compared enigo's cursor coordinates against Tauri's
   physical monitor bounds without accounting for scale factor. On macOS,
   enigo returns logical coordinates; on Windows, GetCursorPos behavior
   depends on the process DPI-awareness context. Dividing monitor bounds
   by scale_factor normalizes to logical, which is safe on all platforms.

2. calculate_overlay_position used work_area() which returns incorrect
   coordinates for monitors with negative positions, and LogicalPosition
   which applied the wrong monitor's scale factor (doubling coordinates).
   Fix: compute position in physical pixels using monitor bounds directly,
   and use PhysicalPosition for all callers.

Closes cjpais#811

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jondeibel jondeibel force-pushed the fix/overlay-multimonitor-positioning branch from 7cf0ab4 to 8cf2fb3 Compare March 5, 2026 18:25
@jondeibel jondeibel changed the title fix: overlay not showing on non-primary monitors (macOS) fix: overlay not showing on non-primary monitors Mar 5, 2026
@cjpais
Copy link
Owner

cjpais commented Mar 6, 2026

Thank you for this, I will try and give this a test soon. Let's see if we can get this in the next release

@cjpais
Copy link
Owner

cjpais commented Mar 6, 2026

So I gave this a test and it doesn't seem to work perfectly to me. The behavior is maybe worse than it was before in the sense that at least when I'm testing on my machine and another monitor. When I click to the other monitor and do the transcription, there's like a flash of the overlay trying to be positioned in the right place, and then eventually it goes to the right place, which is good. But the problem is when I come back to my main monitor and click the transcribe button again starting a new transcription, the overlay doesn't show at all. And then when I click the button to finish the transcription, I do see a flash of it show in the right place. And then from there the next transcription on that monitor works as expected. But to me this is a bit of a regression. Maybe it's acceptable, but it would be best to fix it.

@cjpais
Copy link
Owner

cjpais commented Mar 6, 2026

I added a fix which worked for me, let me know if it works for you too

@jondeibel
Copy link
Contributor Author

@cjpais testing right now!

@jondeibel
Copy link
Contributor Author

Tested and it works fantastically without that bug you were mentioning. Shows instantly on the proper monitor in the proper place. Thank you for taking your time to get a proper fix in!

@jondeibel jondeibel closed this Mar 6, 2026
@jondeibel jondeibel reopened this Mar 6, 2026
@jondeibel
Copy link
Contributor Author

@cjpais I went ahead and cleaned up the diff of this PR to match your fix! I tested and it fully works on my local setup here.

@cjpais
Copy link
Owner

cjpais commented Mar 7, 2026

what was the issue with the commit that I had here? you confirmed it worked and I did as well? the extra stuff you did broke the build. just curious the rationale

@jondeibel
Copy link
Contributor Author

what was the issue with the commit that I had here? you confirmed it worked and I did as well? the extra stuff you did broke the build. just curious the rationale

Ah I misunderstood, I had thought JUST your commit was desired for the full fix so I moved to just your code changes!

@jondeibel jondeibel force-pushed the fix/overlay-multimonitor-positioning branch from 21ddaee to c6738e2 Compare March 10, 2026 10:12
@jondeibel
Copy link
Contributor Author

@cjpais Hey! Cleaned this up and it should be good to go now. Rebased onto latest main (v0.7.10), squashed into a single commit, and the diff only touches calculate_overlay_position. The build issue from before is fixed and I tested it locally across all my monitors, works great. Sorry about the mess earlier!

@cjpais
Copy link
Owner

cjpais commented Mar 10, 2026

Thanks! Let me take a look I will try to merge this today. I actually meant for this to be in 0.7.10 but just forgot

@cjpais
Copy link
Owner

cjpais commented Mar 11, 2026

To be honest, I have no idea what the heck this commit history is. I think we both tested on after my commit and everything was fine. I don't see why we needed any other changes to begin with? This just slowed down the merge, and would have meant more testing (which I have limited time for). We already tested and confirmed it worked.

I am reverting to that commit.

Sorry I am a bit annoyed, I just have limited time to do things and this process was messy and don't want to repeat it again. I do appreciate you taking the time to make the fix.

I kicked off a test build again mainly because of merging with main. Would you mind verifying it works again?

@cjpais cjpais force-pushed the fix/overlay-multimonitor-positioning branch from c6738e2 to e0954ed Compare March 11, 2026 05:02
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

🧪 Test Build Ready

Build artifacts for PR #969 are available for testing.

Download artifacts from workflow run

Artifacts expire after 30 days.

@jondeibel
Copy link
Contributor Author

jondeibel commented Mar 11, 2026

To be honest, I have no idea what the heck this commit history is. I think we both tested on after my commit and everything was fine. I don't see why we needed any other changes to begin with? This just slowed down the merge, and would have meant more testing (which I have limited time for). We already tested and confirmed it worked.

I am reverting to that commit.

Sorry I am a bit annoyed, I just have limited time to do things and this process was messy and don't want to repeat it again. I do appreciate you taking the time to make the fix.

I kicked off a test build again mainly because of merging with main. Would you mind verifying it works again?

I pulled and tested locally. I can confirm it works on my macbook with external displays!

Sorry for the headache! My latest consolidation/commit was intended to make the changeset as minimal and focused on the fix as possible, I didn't mean to cause churn in your testing 😅

@cjpais cjpais merged commit aebd432 into cjpais:main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Visual feedback overlay not displayed when using secondary monitors on Windows

2 participants