Files
t3code/apps/desktop/gnome-extension/feedbackGeometry.js
T
299404a754 feat(desktop): add cross-platform window capture (#8103)
Co-authored-by: Dara Adedeji <[email protected]>
Co-authored-by: Dara Adedeji <[email protected]>
Co-authored-by: Wout Stiens <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
2026-09-07 18:21:53 -07:00

29 lines
908 B
JavaScript

// PID comes from the bus daemon, not from the caller. Never focus a different T3 process.
export function findCaptureDestination(windows, pid, title) {
const owned = windows.filter((window) => window.get_pid() === pid);
const matching = owned.filter((window) => window.get_title() === title);
if (matching.length === 1) return matching[0];
return owned.length === 1 ? owned[0] : undefined;
}
export function captureDestinationFrame(relative, bounds) {
const { x, y, width, height } = relative;
if (
![x, y, width, height].every(Number.isFinite) ||
x < 0 ||
y < 0 ||
width <= 0 ||
height <= 0 ||
x + width > 1.01 ||
y + height > 1.01
) {
throw new Error("Invalid capture animation destination.");
}
return {
x: bounds.x + x * bounds.width,
y: bounds.y + y * bounds.height,
width: width * bounds.width,
height: height * bounds.height,
};
}