|
|
|
|
|
by arijo
606 days ago
|
|
We could maybe chose the target window as the screenshot capture source instead of the full screen to prevent it to be hidden buy the Agent: ```
const getScreenshot = async (windowTitle: string) => {
const { width, height } = getScreenDimensions();
const aiDimensions = getAiScaledScreenDimensions(); const sources = await desktopCapturer.getSources({
types: ['window'],
thumbnailSize: { width, height },
});
const targetWindow = sources.find(source => source.name === windowTitle);
if (targetWindow) {
const screenshot = targetWindow.thumbnail;
// Resize the screenshot to AI dimensions
const resizedScreenshot = screenshot.resize(aiDimensions);
// Convert the resized screenshot to a base64-encoded PNG
const base64Image = resizedScreenshot.toPNG().toString('base64');
return base64Image;
}
throw new Error(`Window with title "${windowTitle}" not found`);
};
``` |
|
More graceful solutions would intelligently hide the window based on the mouse position and/or move it away from the action.