vv icon indicating copy to clipboard operation
vv copied to clipboard

Overwritten "default" shortcuts in macos are not used in vv

Open bartheerman opened this issue 3 years ago • 2 comments

Steps to reproduce:

  1. Default shortcut for minimize is <CMD-v>
  2. Go to System Preferences > Keyboard > Shortcuts
  3. Change the shortcut for Minimize, for example <CTRL-OPTION-CMD-m>
  4. Start vv
  5. Go to insert mode
  6. Type <CTRL-v>
  7. Type <CMD-m>
  8. Notice nothing happens. For other <CMD-...> shortcuts, this shows the shortcut. For example using <CMD-b>

bartheerman avatar Apr 07 '22 09:04 bartheerman

Hi @bartheerman. Thank you for the feedback. I took the liberty to edit your original message to make the shortcuts visible. I will take a look at your issue shortly.

igorgladkoborodov avatar Apr 22 '22 21:04 igorgladkoborodov

Hi @bartheerman. Sorry for the late answer. It seems doable. The problem is that we have to filter out the default system shortcuts here: https://github.com/vv-vim/vv/blob/main/packages/browser-renderer/src/input/keyboard.ts#L91

The shortcuts are hardcoded and I am unaware of a reliable way to get custom shortcuts using Electron API. But there is a way to get them using the defaults read NSGlobalDomain NSUserKeyEquivalents terminal command:

$ defaults read NSGlobalDomain NSUserKeyEquivalents
{
    Minimize = "@~^m";
}

So we need to detect shortcuts overrides with this command and replace the hardcoded ones with them. I can work on this shortly.

Meanwhile you can modify this keyboard.ts file and build your version of the app.

igorgladkoborodov avatar Jun 13 '22 03:06 igorgladkoborodov