feat: Send the application image with the screenpicker hook
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
This commit is contained in:
parent
45b949e1ae
commit
7f8f0646a5
|
|
@ -221,10 +221,19 @@ export function createMainWindow() {
|
|||
mainWindow.webContents.send(
|
||||
"screenPicker",
|
||||
sources.map((source, idx) => {
|
||||
const image = source.appIcon;
|
||||
if (image) {
|
||||
if (image.getAspectRatio() > 1) {
|
||||
image.resize({ width: 256 });
|
||||
} else {
|
||||
image.resize({ height: 256 });
|
||||
}
|
||||
}
|
||||
return {
|
||||
idx: idx,
|
||||
isFullScreen: source.id.startsWith("screen"),
|
||||
name: source.name,
|
||||
isFullScreen: source.id.startsWith("screen"),
|
||||
image: image?.toDataURL(),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,12 @@ contextBridge.exposeInMainWorld("native", {
|
|||
// Wrapped in braces to return void
|
||||
onceScreenPicker: (
|
||||
onScreenPick: (
|
||||
sources: { idx: number; isFullScreen: boolean; name: string }[],
|
||||
sources: {
|
||||
idx: number;
|
||||
name: string;
|
||||
isFullScreen: boolean;
|
||||
image?: string;
|
||||
}[],
|
||||
) => void,
|
||||
) => {
|
||||
ipcRenderer.once("screenPicker", (_, sources) => onScreenPick(sources));
|
||||
|
|
|
|||
Loading…
Reference in New Issue