fix: use menu accelerator for shortcuts to prevent shortcut-hijacking on linux/windows #76
+208
−80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue
Fixes a bug where application shortcuts were globally overriding shortcuts in other applications, particularly noticeable on Linux and windows.
Closes: #57
Describe the add-ons or changes you've made
This PR refactors the application's shortcut handling to fix a critical bug where shortcuts like
Ctrl+RorCtrl+Twould not work in other applications when Peersky Browser was running.The Problem:
Shortcuts were implemented using Electron's
globalShortcutAPI, which creates system-wide keyboard hooks. This is incorrect for in-app actions.The Solution:
globalShortcut.register()for in-app actions fromactions.js.createMenuTemplatefunction that defines a native application menu structure ("File", "Edit", "View", "Go", etc.).acceleratorswithin this menu template.main.jsto build and set this menu on startup. This uses the OS's native, focus-aware shortcut handling, which is the correct approach.This change ensures that all keyboard shortcuts are only active when the application is in focus, resolving the conflict with other apps.
Type of change
How Has This Been Tested?
Checklist