Skip to content

Commit dc76432

Browse files
committed
feat(shortcuts): update keyboard shortcuts and menu accelerators
- Update keyboard shortcut mappings for consistency across platforms - Add CommandOrControl modifier support for shortcut manager - Disable menu accelerators to prevent conflicts with shortcuts - Improve shortcut display in settings UI
1 parent 8ab71fd commit dc76432

5 files changed

Lines changed: 34 additions & 19 deletions

File tree

src/common/publicData.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,8 @@ export const keyboardShortcuts = [
709709
visible: true,
710710
shortcuts: {
711711
mac: 'Command+M',
712-
win: 'Win+M',
713-
linux: 'Super+H'
712+
win: 'Ctrl+M',
713+
linux: 'Super+M'
714714
}
715715
},
716716
{
@@ -846,8 +846,8 @@ export const keyboardShortcuts = [
846846
visible: true,
847847
shortcuts: {
848848
mac: 'Command+,',
849-
win: 'Ctrl+,',
850-
linux: 'Ctrl+,'
849+
win: 'Ctrl+P',
850+
linux: 'Ctrl+P'
851851
}
852852
},
853853
{

src/main/index.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,23 @@ app.commandLine.appendSwitch('enable-oop-rasterization')
253253
label: global.FBW.store?.settingData?.autoSwitchWallpaper
254254
? t('actions.autoSwitchWallpaper.stop')
255255
: t('actions.autoSwitchWallpaper.start'),
256-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName(
257-
'toggleAutoSwitchWallpaper'
258-
),
256+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName(
257+
// 'toggleAutoSwitchWallpaper'
258+
// ),
259259
click: () => {
260260
global.FBW.store?.toggleAutoSwitchWallpaper()
261261
}
262262
},
263263
{
264264
label: t('actions.nextWallpaper'),
265-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('nextWallpaper'),
265+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('nextWallpaper'),
266266
click: () => {
267267
global.FBW.store?.doManualSwitchWallpaper('next')
268268
}
269269
},
270270
{
271271
label: t('actions.prevWallpaper'),
272-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('prevWallpaper'),
272+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('prevWallpaper'),
273273
click: () => {
274274
global.FBW.store?.doManualSwitchWallpaper('prev')
275275
}
@@ -278,7 +278,7 @@ app.commandLine.appendSwitch('enable-oop-rasterization')
278278
label: global.FBW.store?.settingData?.suspensionBallVisible
279279
? t('actions.closeSuspensionBall')
280280
: t('actions.openSuspensionBall'),
281-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('toggleSuspensionBall'),
281+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('toggleSuspensionBall'),
282282
click: () => {
283283
global.FBW.suspensionBall.toggle()
284284
}
@@ -314,7 +314,7 @@ app.commandLine.appendSwitch('enable-oop-rasterization')
314314
} else if (item.placement.includes('trayFuncMenu')) {
315315
trayFuncMenuList.push({
316316
label: t(item.locale),
317-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName(item.shortcutName),
317+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName(item.shortcutName),
318318
click: () => handleJumpToPage(item.name)
319319
})
320320
}
@@ -342,7 +342,7 @@ app.commandLine.appendSwitch('enable-oop-rasterization')
342342
},
343343
{
344344
label: t('actions.checkUpdate'),
345-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('checkUpdate'),
345+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('checkUpdate'),
346346
click: () => {
347347
// "检查更新"功能
348348
global.FBW.updater.checkUpdate()
@@ -353,7 +353,7 @@ app.commandLine.appendSwitch('enable-oop-rasterization')
353353
},
354354
{
355355
label: t('actions.quit'),
356-
accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('quitApp'),
356+
// accelerator: global.FBW.store?.shortcutManager?.getShortcutByName('quitApp'),
357357
click: () => {
358358
global.FBW.flags.isQuitting = true
359359
app.quit()

src/main/store/ShortcutManager.mjs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class ShortcutManager {
337337
global.FBW.store.doManualSwitchWallpaper('prev')
338338
}
339339
break
340-
case 'toggleAutoSwitch':
340+
case 'toggleAutoSwitchWallpaper':
341341
if (global.FBW?.store) {
342342
global.FBW.store.toggleAutoSwitchWallpaper()
343343
}
@@ -349,9 +349,11 @@ class ShortcutManager {
349349
})
350350
}
351351
break
352-
case 'checkUpdate':
353-
if (global.FBW?.updater) {
354-
global.FBW.updater.checkUpdate()
352+
case 'openUtils':
353+
if (global.FBW?.mainWindow) {
354+
global.FBW.mainWindow.reopen(() => {
355+
global.FBW.mainWindow.win.webContents.send('main:jumpToPage', 'Utils')
356+
})
355357
}
356358
break
357359
case 'openAbout':
@@ -361,6 +363,11 @@ class ShortcutManager {
361363
})
362364
}
363365
break
366+
case 'checkUpdate':
367+
if (global.FBW?.updater) {
368+
global.FBW.updater.checkUpdate()
369+
}
370+
break
364371
case 'editSelectAll':
365372
if (win) {
366373
win.webContents.selectAll()
@@ -822,6 +829,7 @@ class ShortcutManager {
822829
// macOS平台的修饰键名称
823830
const macModifiers = {
824831
Command: 'Cmd',
832+
CommandOrControl: 'Cmd',
825833
Ctrl: 'Ctrl',
826834
Option: 'Opt',
827835
Shift: 'Shift'
@@ -831,6 +839,7 @@ class ShortcutManager {
831839
// Linux平台的修饰键名称
832840
const linuxModifiers = {
833841
Control: 'Ctrl',
842+
CommandOrControl: 'Ctrl',
834843
Meta: 'Super',
835844
Shift: 'Shift',
836845
Alt: 'Alt'
@@ -840,6 +849,7 @@ class ShortcutManager {
840849
// Windows平台的修饰键名称
841850
const winModifiers = {
842851
Control: 'Ctrl',
852+
CommandOrControl: 'Ctrl',
843853
Shift: 'Shift',
844854
Alt: 'Alt',
845855
Windows: 'Win'

src/renderer/windows/MainWindow/components/ExploreCommon.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ onBeforeUnmount(() => {
18021802
18031803
<el-mention
18041804
v-model="searchForm.filterKeywords"
1805-
class="condition-item"
1805+
class="condition-item condition-keywords"
18061806
:disabled="flags.loading"
18071807
:options="hotTags"
18081808
:prefix="['#']"
@@ -2079,6 +2079,11 @@ onBeforeUnmount(() => {
20792079
.condition-item {
20802080
flex: none;
20812081
}
2082+
:deep(.condition-keywords) {
2083+
.el-input__inner {
2084+
color: #ffffff !important;
2085+
}
2086+
}
20822087
}
20832088
20842089
.body-block {

src/renderer/windows/MainWindow/pages/Setting.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ onBeforeUnmount(() => {
21062106
<template #default="scope">
21072107
<div class="shortcut-input">
21082108
<el-input
2109-
:value="isEditing(scope.row.name) ? editingShortcut : scope.row.shortcut"
2109+
:value="isEditing(scope.row.name) ? editingShortcut : scope.row.displayShortcut"
21102110
:placeholder="
21112111
isEditing(scope.row.name)
21122112
? t('pages.Setting.shortcutSetting.pressShortcut')

0 commit comments

Comments
 (0)