Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,11 @@ app.whenReady().then(async () => {
// pre-selected (e.g. fresh session where the renderer skipped the
// source picker entirely). This avoids calling getSources() which
// would itself trigger an extra portal dialog.
const isWayland = process.env.XDG_SESSION_TYPE === "wayland";
const isLinuxPortalSentinel =
process.platform === "linux" && (sourceId === "screen:linux-portal" || !sourceId);
process.platform === "linux" &&
isWayland &&
(sourceId === "screen:linux-portal" || !sourceId);
if (isLinuxPortalSentinel) {
callback({ video: { id: "screen:0:0", name: "Entire screen" } });
return;
Expand Down
22 changes: 19 additions & 3 deletions electron/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,22 @@ function getHudOverlayDisplay() {
return getScreen().getPrimaryDisplay();
}


function getHudOverlayBounds() {
const { workArea } = getHudOverlayDisplay();

if (process.platform === "linux") {
const width = 520;
const height = 220;

return {
width,
height,
x: Math.round(workArea.x + (workArea.width - width) / 2),
y: workArea.y + workArea.height - 240,
};
Comment on lines +188 to +197
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Preserve the dragged HUD position before recentering on Linux.

This branch always recenters the HUD and ignores hudUserPosition, so any later applyHudOverlayBounds() call snaps a dragged HUD back to bottom-center even when the saved position is still valid.

Suggested fix
 	if (process.platform === "linux") {
 		const width = 520;
 		const height = 220;
+
+		if (hudUserPosition) {
+			return {
+				x: hudUserPosition.x,
+				y: hudUserPosition.y,
+				width,
+				height,
+			};
+		}
 
 		return {
 			width,
 			height, 
 			x: Math.round(workArea.x + (workArea.width - width) / 2),
 			y: workArea.y + workArea.height - 240,
 		};
 	}
🤖 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 188 - 197, The Linux branch always
recenters the HUD ignoring hudUserPosition—preserve and reuse the saved position
when valid. In the Linux branch (where width/height are set) check if
hudUserPosition exists and is within the current workArea bounds (clamp if
necessary), and return bounds using hudUserPosition.x/hudUserPosition.y with the
computed width/height instead of forcing center; otherwise fall back to the
centered x/y. Ensure this fixes subsequent applyHudOverlayBounds() calls by
returning the persisted position when present.

}

return {
x: workArea.x,
y: workArea.y,
Expand Down Expand Up @@ -250,7 +264,11 @@ ipcMain.on("hud-overlay-set-ignore-mouse", (_event, ignore: boolean) => {
}

if (ignore) {
hudOverlayWindow.setIgnoreMouseEvents(true, { forward: true });
if (process.platform === "linux") {
hudOverlayWindow.setIgnoreMouseEvents(true);
} else {
hudOverlayWindow.setIgnoreMouseEvents(true, { forward: true });
}
return;
}

Expand Down Expand Up @@ -360,7 +378,6 @@ export function createHudOverlayWindow(): BrowserWindow {
loadHudOverlayCaptureProtectionSetting();
const initialBounds = getHudOverlayBounds();
let hasShownHudWindow = false;

const win = new BrowserWindow({
width: initialBounds.width,
height: initialBounds.height,
Expand All @@ -383,7 +400,6 @@ export function createHudOverlayWindow(): BrowserWindow {
backgroundThrottling: false,
},
});

const showHudWindow = () => {
if (hasShownHudWindow || win.isDestroyed()) {
return;
Expand Down