mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +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 path from 'path';
|
||||||
import { IPC_CHANNELS } from '../ipc/channels';
|
import { IPC_CHANNELS } from '../ipc/channels';
|
||||||
import { getServerPort } from './server';
|
import { getServerPort } from './server';
|
||||||
|
|
@ -28,6 +28,7 @@ function createQuickAskWindow(x: number, y: number): BrowserWindow {
|
||||||
y,
|
y,
|
||||||
type: 'panel',
|
type: 'panel',
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
fullscreenable: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, 'preload.js'),
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
|
|
@ -44,7 +45,13 @@ function createQuickAskWindow(x: number, y: number): BrowserWindow {
|
||||||
quickAskWindow?.show();
|
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.on('closed', () => {
|
||||||
quickAskWindow = null;
|
quickAskWindow = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue