prototype with two windows

This commit is contained in:
talksik
2026-03-31 13:35:53 -07:00
parent 7f490b4596
commit 1effd9bb43
14 changed files with 237 additions and 1 deletions
+79
View File
@@ -22,6 +22,9 @@ if (process.platform === 'darwin' && !app.isPackaged) {
app.dock?.setIcon(path.join(__dirname, '../../assets/icon.png'));
}
let autoplayWindow: BrowserWindow | null = null;
let huddleWindow: BrowserWindow | null = null;
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
@@ -46,6 +49,68 @@ const createWindow = () => {
}
};
const createAutoplayWindow = () => {
if (autoplayWindow) {
autoplayWindow.focus();
return;
}
autoplayWindow = new BrowserWindow({
width: 300,
height: 100,
resizable: false,
frame: false,
alwaysOnTop: true,
skipTaskbar: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
});
if (AUTOPLAY_WINDOW_VITE_DEV_SERVER_URL) {
autoplayWindow.loadURL(AUTOPLAY_WINDOW_VITE_DEV_SERVER_URL);
} else {
autoplayWindow.loadFile(
path.join(__dirname, `../renderer/${AUTOPLAY_WINDOW_VITE_NAME}/index.html`),
);
}
autoplayWindow.on('closed', () => {
autoplayWindow = null;
});
};
const createHuddleWindow = () => {
if (huddleWindow) {
huddleWindow.focus();
return;
}
huddleWindow = new BrowserWindow({
width: 1024,
height: 768,
resizable: true,
fullscreenable: true,
frame: true,
title: 'Huddle',
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
});
if (HUDDLE_WINDOW_VITE_DEV_SERVER_URL) {
huddleWindow.loadURL(HUDDLE_WINDOW_VITE_DEV_SERVER_URL);
} else {
huddleWindow.loadFile(
path.join(__dirname, `../renderer/${HUDDLE_WINDOW_VITE_NAME}/index.html`),
);
}
huddleWindow.on('closed', () => {
huddleWindow = null;
});
};
// Window control IPC handlers
ipcMain.on('window:minimize', (event) => {
BrowserWindow.fromWebContents(event.sender)?.minimize();
@@ -66,6 +131,20 @@ ipcMain.on('window:fullscreen', (event) => {
if (win) win.setFullScreen(!win.isFullScreen());
});
// Secondary window IPC handlers
ipcMain.on('window:open-autoplay', () => {
createAutoplayWindow();
});
ipcMain.on('window:close-autoplay', () => {
autoplayWindow?.close();
});
ipcMain.on('window:open-huddle', () => {
createHuddleWindow();
});
ipcMain.on('window:close-huddle', () => {
huddleWindow?.close();
});
// --- Link metadata ---
const metadataCache = new Map<string, LinkMetadata>();