LaTeX-Workshop icon indicating copy to clipboard operation
LaTeX-Workshop copied to clipboard

Cmd+M shortcut prefix conflicts with window minimise on macOS

Open jryans opened this issue 2 years ago โ€ข 1 comments

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, restart VS Code, and check that you still see this issue. [Required]

Yes

Make sure to visit the wiki FAQ before filling an issue.

Yes

If your issue is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

You can compile a TeX document manually?: Not applicable

Describe the bug [Required]

LaTeX Workshop defines a number of math-focused keyboard shortcuts (latex-workshop.shortcut.math*). On Windows / Linux, they use a Ctrl+M prefix, and perhaps that's okay over there. The macOS equivalent is Cmd+M, which is already occupied by a default enabled OS-level shortcut for minimising windows.

To Reproduce

Steps to reproduce the behavior:

  1. Install extension on macOS
  2. Try to minimise VS Code with a LaTeX file focused

Expected behavior

I expect common OS-level shortcuts (such as this one) to always be functional in all programs.

Desktop [Required]

Please write exact version numbers. Please don't write latest instead of exact numbers.

  • OS: macOS 12.6
  • VS Code version: 1.73.1
  • Extension version: 9.0.1
  • TeX distribution version: MacTeX 2022.0321

Additional questions

Are you using VSCodium?

No

Are you using the Snap or Flatpack versions of VS Code?

No

Are you using LaTeX Workshop with VS Code Remote?

No

jryans avatar Nov 10 '22 13:11 jryans

As an aside, thanks for your great work on LaTeX Workshop! It's very helpful. ๐Ÿ˜„

jryans avatar Nov 10 '22 13:11 jryans

It is a little more complicated than it looks. On Windows/Linux, ctrl+m is used by vscode for editor.action.toggleTabFocusMode. Because, we use ctrl+m as a prefix, it deactivates vscode's default shortcut. So, we introduced ctrl+l ctrl+m, see https://github.com/James-Yu/LaTeX-Workshop/wiki/FAQ#latex-workshop-uses-ctrlm-for-fonts-keybindings.

Looking closely at vscode's default shortcuts, it uses ctrl+shift+m for editor.action.toggleTabFocusMode. I was tempted to use shift+cmd+m on osx, but this is already bound to workbench.actions.view.problems.

I see two approaches:

  1. Add a new setting to deactivate all the cmd+M shortcuts.
  2. Replace cmd+M by ctrl+shift+M for our shortcuts and defined cmd+l ctrl+shift+M for `editor.action.toggleTabFocusMode, which is only used for keyboard only navigation.

jlelong avatar Nov 10 '22 17:11 jlelong

Either approach would be okay for me... though I don't actually use these particular shortcuts from the extension, so mainly I'm just thinking about how to get them out of the way of OS defaults. ๐Ÿ˜…

Perhaps for those who do want to use these shortcuts on macOS, approach 2 sounds a bit nicer, since that way they could still use these extension shortcuts while still retaining OS default minimise behaviour.

jryans avatar Nov 10 '22 18:11 jryans

An interesting observation: vscode use option+shift+M for editor.action.toggleTabFocusMode on macos, which is ctrl+shift+m on windows. What about we change all cmd+Ms to option+shift+Ms for consistency? option+M is OS-wise reserved for ยต though.

James-Yu avatar Nov 14 '22 12:11 James-Yu

Replacing Cmd+M with Option+Shift+M sounds like an improvement to me, even if it does stomp on an accented character (ร‚)... Though, I have never needed to type such a character, so perhaps I am not the best one to decide... ๐Ÿ˜‡

jryans avatar Nov 14 '22 12:11 jryans

It seems that on OSX, vscode use ctrl+shift+M for editor.action.toggleTabFocusMode and not option+shift+M. At least, this is the default shortcut used by vscode on my mac with a French keyboard. This is also what is shown on https://code.visualstudio.com/docs/getstarted/keybindings (the displayed shortcuts depend the OS).

The modifier shift+option is often used on OSX to enter special characters. I am more in favour of using ctrl+shift+M.

jlelong avatar Nov 14 '22 12:11 jlelong

Ctrl+Shift+M does indeed seem to be unoccupied on macOS, so perhaps that's a good fit.

jryans avatar Nov 14 '22 12:11 jryans

There must be something wrong with my mac. Will do a PR on this shortly (tm).

James-Yu avatar Nov 14 '22 13:11 James-Yu