Compare commits

2 Commits

Author SHA1 Message Date
chyoo fd9ac20fbf Update LMS package metadata 2026-07-03 16:22:50 +09:00
chyoo dcc2c04692 Fix devtools shortcuts in packaged app 2026-07-03 16:15:27 +09:00
2 changed files with 22 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "lms", "name": "lms",
"version": "1.0.5", "version": "1.0.6",
"description": "Autonomy Studio LMS Electron app", "description": "Autonomy Studio LMS Electron app",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": { "author": {
+21 -2
View File
@@ -1,4 +1,4 @@
import { app, BrowserWindow, globalShortcut, ipcMain, screen } from 'electron' import { app, BrowserWindow, Menu, globalShortcut, ipcMain, screen } from 'electron'
import type { WebContents } from 'electron' import type { WebContents } from 'electron'
import { spawn, type ChildProcessWithoutNullStreams } from 'child_process' import { spawn, type ChildProcessWithoutNullStreams } from 'child_process'
import { createWriteStream, existsSync } from 'fs' import { createWriteStream, existsSync } from 'fs'
@@ -3111,8 +3111,10 @@ if (process.platform === 'linux' && !is.dev) {
function attachDevToolsShortcut(win: BrowserWindow): void { function attachDevToolsShortcut(win: BrowserWindow): void {
win.webContents.on('before-input-event', (event, input) => { win.webContents.on('before-input-event', (event, input) => {
if (input.type !== 'keyDown') return
const key = input.key.toLowerCase() const key = input.key.toLowerCase()
if (input.key === 'F12' || (input.control && input.shift && key === 'i')) { const code = input.code.toLowerCase()
if (input.key === 'F12' || code === 'f12' || ((input.control || input.meta) && input.shift && key === 'i')) {
event.preventDefault() event.preventDefault()
win.webContents.toggleDevTools() win.webContents.toggleDevTools()
} }
@@ -3138,6 +3140,23 @@ function toggleFocusedDevTools(): void {
function registerDevToolsShortcuts(): void { function registerDevToolsShortcuts(): void {
globalShortcut.register('CommandOrControl+Shift+I', toggleFocusedDevTools) globalShortcut.register('CommandOrControl+Shift+I', toggleFocusedDevTools)
globalShortcut.register('F12', toggleFocusedDevTools) globalShortcut.register('F12', toggleFocusedDevTools)
Menu.setApplicationMenu(Menu.buildFromTemplate([
{
label: 'View',
submenu: [
{
label: 'Toggle Developer Tools',
accelerator: 'F12',
click: toggleFocusedDevTools
},
{
label: 'Toggle Developer Tools',
accelerator: 'CommandOrControl+Shift+I',
click: toggleFocusedDevTools
}
]
}
]))
} }
function createSplashWindow(): void { function createSplashWindow(): void {