Skip to content

Conversation

@Ankesh2004
Copy link
Contributor

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+R or Ctrl+T would not work in other applications when Peersky Browser was running.

The Problem:
Shortcuts were implemented using Electron's globalShortcut API, which creates system-wide keyboard hooks. This is incorrect for in-app actions.

The Solution:

  1. Removed all usage of globalShortcut.register() for in-app actions from actions.js.
  2. Implemented a new createMenuTemplate function that defines a native application menu structure ("File", "Edit", "View", "Go", etc.).
  3. All shortcuts are now defined as accelerators within this menu template.
  4. Updated main.js to 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  1. Launched the application on a Linux system.
  2. Opened another application alongside it (e.g., Chrome browser).
  3. Verified that all the shortcuts work without overriding or racing with other applications.
  4. Confirmed that there are no regressions and all shortcuts function as intended.

Checklist

  • My code follows the "contribution guidelines" of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly wherever it was hard to understand.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.

@akhileshthite akhileshthite added bug Something isn't working linux Related to Linux labels Oct 7, 2025
Copy link
Member

@akhileshthite akhileshthite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@akhileshthite akhileshthite merged commit 6ce2521 into p2plabsxyz:main Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working linux Related to Linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peersky is overriding other browser's shortcuts

2 participants