sindresorhus / electron-context-menu

Context menu for your Electron app
MIT License
1.4k stars 157 forks source link

Enable accelerators for edit options #150

Open parkerholladay opened 3 years ago

parkerholladay commented 3 years ago

For the edit options such as Copy, Cut, and Paste that have system hotkeys, it would be helpful to have a flag that you could use to enable the CmdOrCtrl+C, etc. hotkeys to be displayed in the MenuItem[]. That could look something like the following:

{
  ...options,
  showEditAccelerators: true
}

Another possibility would be to extend the labels option to allow not just a string, but an object for the string label and an accelerator. i.e.

{
  ...options,
  labels: {
    copy: {
      label: 'Copy',
      accelerator: 'CmdOrCtrl+C'
    }
  }
}

I'd be more than happy to submit a PR depending on which route you prefer architecturally.

Bartel-C8 commented 2 years ago

It was once suggested here, but declined back then... https://github.com/sindresorhus/electron-context-menu/pull/87

For MacOS (only?), the shortcuts CMD + C & CMD + V do not work, if no accelerator are defined for these actions...