mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
feat(menu, dev-tools): enhance menu with view options and enable dev tools in development mode
This commit is contained in:
parent
98697f1dd6
commit
bf4e60d224
5 changed files with 27 additions and 4 deletions
|
|
@ -58,7 +58,23 @@ export function setupMenu(): void {
|
|||
}
|
||||
|
||||
const isMac = process.platform === 'darwin';
|
||||
const isDev = !app.isPackaged;
|
||||
const updateMenuItem = getUpdateMenuItem();
|
||||
const viewSubmenu: Electron.MenuItemConstructorOptions[] = [
|
||||
{ role: 'reload' as const },
|
||||
{ role: 'forceReload' as const },
|
||||
...(isDev
|
||||
? [
|
||||
{ role: 'toggleDevTools' as const },
|
||||
]
|
||||
: []),
|
||||
{ type: 'separator' as const },
|
||||
{ role: 'resetZoom' as const },
|
||||
{ role: 'zoomIn' as const },
|
||||
{ role: 'zoomOut' as const },
|
||||
{ type: 'separator' as const },
|
||||
{ role: 'togglefullscreen' as const },
|
||||
];
|
||||
const template: Electron.MenuItemConstructorOptions[] = [
|
||||
...(isMac
|
||||
? [{
|
||||
|
|
@ -79,7 +95,10 @@ export function setupMenu(): void {
|
|||
: []),
|
||||
{ role: 'fileMenu' as const },
|
||||
{ role: 'editMenu' as const },
|
||||
{ role: 'viewMenu' as const },
|
||||
{
|
||||
label: 'View',
|
||||
submenu: viewSubmenu,
|
||||
},
|
||||
{ role: 'windowMenu' as const },
|
||||
{
|
||||
role: 'help' as const,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BrowserWindow, clipboard, globalShortcut, ipcMain, screen, shell } from 'electron';
|
||||
import { app, BrowserWindow, clipboard, globalShortcut, ipcMain, screen, shell } from 'electron';
|
||||
import path from 'path';
|
||||
import { IPC_CHANNELS } from '../ipc/channels';
|
||||
import { checkAccessibilityPermission, getFrontmostApp, simulateCopy, simulatePaste } from './platform';
|
||||
|
|
@ -51,6 +51,7 @@ function createQuickAskWindow(x: number, y: number): BrowserWindow {
|
|||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
devTools: !app.isPackaged,
|
||||
},
|
||||
show: false,
|
||||
skipTaskbar: true,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BrowserWindow, desktopCapturer, nativeImage, screen } from 'electron';
|
||||
import { app, BrowserWindow, desktopCapturer, nativeImage, screen } from 'electron';
|
||||
import path from 'path';
|
||||
import { IPC_CHANNELS } from '../../ipc/channels';
|
||||
function fitNativeImageToWorkArea(img: Electron.NativeImage, display: Electron.Display): Electron.NativeImage {
|
||||
|
|
@ -261,6 +261,7 @@ export function pickScreenRegion(opts?: { windowDataUrl?: string }): Promise<str
|
|||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
devTools: !app.isPackaged,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BrowserWindow, desktopCapturer, ipcMain, screen } from 'electron';
|
||||
import { app, BrowserWindow, desktopCapturer, ipcMain, screen } from 'electron';
|
||||
import path from 'path';
|
||||
import { IPC_CHANNELS } from '../../ipc/channels';
|
||||
|
||||
|
|
@ -185,6 +185,7 @@ export function pickOpenWindowCapture(): Promise<PickedWindowResult | null> {
|
|||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
devTools: !app.isPackaged,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export function createMainWindow(initialPath = '/dashboard'): BrowserWindow {
|
|||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
webviewTag: false,
|
||||
devTools: !app.isPackaged,
|
||||
},
|
||||
show: false,
|
||||
...(isMac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue