mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 17:56:25 +02:00
keep panel floating, handle window opens, disable fullscreen
This commit is contained in:
parent
7cbb67f0dd
commit
2ae83e8b28
1 changed files with 9 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { BrowserWindow, clipboard, globalShortcut, ipcMain, screen } from 'electron';
|
||||
import { BrowserWindow, clipboard, globalShortcut, ipcMain, screen, shell } from 'electron';
|
||||
import path from 'path';
|
||||
import { IPC_CHANNELS } from '../ipc/channels';
|
||||
import { getServerPort } from './server';
|
||||
|
|
@ -28,6 +28,7 @@ function createQuickAskWindow(x: number, y: number): BrowserWindow {
|
|||
y,
|
||||
type: 'panel',
|
||||
resizable: true,
|
||||
fullscreenable: false,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
contextIsolation: true,
|
||||
|
|
@ -44,7 +45,13 @@ function createQuickAskWindow(x: number, y: number): BrowserWindow {
|
|||
quickAskWindow?.show();
|
||||
});
|
||||
|
||||
quickAskWindow.on('blur', hideQuickAsk);
|
||||
quickAskWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url.startsWith('http://localhost')) {
|
||||
return { action: 'allow' };
|
||||
}
|
||||
shell.openExternal(url);
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
quickAskWindow.on('closed', () => {
|
||||
quickAskWindow = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue