Skip to content

feat(hud): add shouldResizeHudOverlayFallback function and tests#770

Open
maxmedina05 wants to merge 2 commits into
webadderallorg:mainfrom
maxmedina05:fix/linux-hud-menu-expand
Open

feat(hud): add shouldResizeHudOverlayFallback function and tests#770
maxmedina05 wants to merge 2 commits into
webadderallorg:mainfrom
maxmedina05:fix/linux-hud-menu-expand

Conversation

@maxmedina05

@maxmedina05 maxmedina05 commented Jul 19, 2026

Copy link
Copy Markdown

Description

Re-lands e2802bf (#612), which was reverted as collateral in d2796fb (#656). On Linux isHudOverlayMousePassthroughSupported() is always false, so the HUD is a fixed 860x160 window instead of a full work-area overlay. Menus taller than 160 DIP get clipped at the window edge. #612 grew the window to 540 DIP while a menu is open; the revert restored the process.platform !== "linux" guard that skips that resize.

Part of a series of Linux fixes for Ubuntu 24.04; each PR is standalone and touches disjoint files.

Motivation

#656 set out to revert Windows HUD passthrough regressions introduced after v1.3.1, and swept up the Linux HUD fallback in the same "revert the whole area" pass. No issue or review comment attributes any regression to the Linux part.

Confirmed with git merge-base: v1.3.3 contains e2802bf and not d2796fb. That is exactly why the shipped 1.3.3 AppImage renders HUD menus correctly while current main clips them.

This restores the fix as a small predicate — shouldResizeHudOverlayFallback(mousePassthroughSupported, recordingActive) — that only expands the non-passthrough HUD when idle, and keeps it compact while recording. It does not touch the Windows passthrough paths #656 was protecting.

Type of Change

  • Bug Fix
  • New Feature
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

Re-lands #612 (reverted by #656).

Screenshots / Video

Not a new UI feature — the difference is that Linux HUD menus render fully instead of clipping at the 160 DIP window edge. A before/after of an open HUD menu (e.g. the language menu) on Linux shows the clipped vs. full menu.

Testing Guide

npx vitest --run electron/hudOverlayBounds.test.ts
npm run dev   # on Linux, open a HUD menu (e.g. language); it should render fully, not clip

Verified on Ubuntu 24.04 (GNOME, X11): HUD menus render fully instead of clipping. The predicate keeps the HUD compact while recording is active and only expands when idle.

Checklist

  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Notes

If the Linux fallback was reverted deliberately rather than as collateral, say so and I'll close this — but I could not find any report attributing a regression to it.

Investigated and drafted with Claude Code. The behaviour described is from real runs on Ubuntu 24.04, not generated — I can re-run on request.


Thank you for contributing!

Summary by CodeRabbit

  • Bug Fixes
    • Improved HUD overlay fallback resizing when mouse passthrough isn’t available.
    • Ensured fallback resizing/expansion won’t trigger while recording is active.
  • Tests
    • Added automated coverage to confirm the HUD overlay fallback resizing decision across recording and passthrough-supported states.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 33e9c5d2-aa38-41b0-82a7-fb4adf39375a

📥 Commits

Reviewing files that changed from the base of the PR and between e9a36ae and b4d414c.

📒 Files selected for processing (1)
  • electron/windows.ts

📝 Walkthrough

Walkthrough

Adds and tests shouldResizeHudOverlayFallback, then updates HUD overlay mouse passthrough handling to apply fallback expansion whenever passthrough is unsupported.

Changes

HUD overlay fallback resize

Layer / File(s) Summary
Fallback resize decision and tests
electron/hudOverlayBounds.ts, electron/hudOverlayBounds.test.ts
Adds shouldResizeHudOverlayFallback and tests passthrough and recording state combinations.
Mouse passthrough integration
electron/windows.ts
Stores passthrough support status and applies fallback expansion when support is unavailable.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: webadderall, meiiie, extrabinoss

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding the new HUD fallback helper and its tests.
Description check ✅ Passed The description follows the template well and includes purpose, motivation, issue link, testing guide, and checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
electron/windows.ts (1)

314-316: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant conditional check.

Due to the control flow in this function, the arguments passed to shouldResizeHudOverlayFallback are statically known at this point:

  • mousePassthroughSupported is guaranteed to be false because of the if (!mousePassthroughSupported) check on line 315.
  • hudOverlayRecordingActive is guaranteed to be false because of the early return on line 307 (if (hudOverlayRecordingActive) { ... return; }).

Consequently, shouldResizeHudOverlayFallback(false, false) will always evaluate to true, making this if block a tautology. Consider whether the helper function is necessary here or if the logic should be consolidated.

♻️ Proposed consolidation

If you intend to keep the existing early returns, you can simplify this block by removing the redundant condition:

 	const mousePassthroughSupported = isHudOverlayMousePassthroughSupported();
 	if (!mousePassthroughSupported) {
-		if (shouldResizeHudOverlayFallback(mousePassthroughSupported, hudOverlayRecordingActive)) {
-			setHudOverlayFallbackExpanded(!ignore);
-		}
+		setHudOverlayFallbackExpanded(!ignore);
 		hudOverlayWindow.setIgnoreMouseEvents(false);
 		return;
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron/windows.ts` around lines 314 - 316, In the fallback branch after the
`!mousePassthroughSupported` check, remove the redundant
`shouldResizeHudOverlayFallback` conditional and retain its body directly.
Preserve the existing early return for `hudOverlayRecordingActive` and the
surrounding mouse-passthrough flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@electron/windows.ts`:
- Around line 314-316: In the fallback branch after the
`!mousePassthroughSupported` check, remove the redundant
`shouldResizeHudOverlayFallback` conditional and retain its body directly.
Preserve the existing early return for `hudOverlayRecordingActive` and the
surrounding mouse-passthrough flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 48f83e02-a37e-472c-90db-fcf01ce188ce

📥 Commits

Reviewing files that changed from the base of the PR and between 360b160 and e9a36ae.

📒 Files selected for processing (3)
  • electron/hudOverlayBounds.test.ts
  • electron/hudOverlayBounds.ts
  • electron/windows.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant