Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac shortcut not working (in vscode) [cmd+h or cmd+m] #71800

Open
rkdmen opened this issue Apr 5, 2019 · 87 comments · May be fixed by #154882
Open

Mac shortcut not working (in vscode) [cmd+h or cmd+m] #71800

rkdmen opened this issue Apr 5, 2019 · 87 comments · May be fixed by #154882
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities webview Webview issues
Milestone

Comments

@rkdmen
Copy link

rkdmen commented Apr 5, 2019

  • VSCode Version: 1.60.1 ( Recent )
  • OS Version: Mac 11.15.2

Steps to Reproduce:

  1. On Release Note Screen
  2. (hide or minimize) cmd+h or cmd+m does not work (have not tried other shortcut).

Does this issue occur when all extensions are disabled?: Yes

@vscodebot vscodebot bot added the new release label Apr 5, 2019
@vscodebot vscodebot bot removed the new release label Apr 9, 2019
@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug webview Webview issues labels Sep 23, 2019
@mjbvz mjbvz added this to the Backlog milestone Nov 5, 2020
@mjbvz mjbvz added the help wanted Issues identified as good community contribution opportunities label Nov 5, 2020
@mjbvz mjbvz changed the title Mac shortcut not working on Release Note Screen Mac shortcut not working in webviews May 21, 2021
@timdmackey
Copy link

I'm having this issue everywhere in VSCode, regardless of the view or document open. Issue still occurs when all extensions are disabled.

VSCode Version: 1.56.2
MacOS 10.15.7

@douira
Copy link

douira commented Jun 16, 2021

I also have this issue. I can't even hide the window by right clicking on the application icon in the dock. When I try to hide it that way, the window hides for a split second and then re-appears immediately. cmd + H only works and actually hides the window when a native dialog like the "about" window or the dialog that opens if you close an unsaved file.

Version: 1.57.0
Commit: b4c1bd0a9b03c749ea011b06c6d2676c8091a70c
Date: 2021-06-09T17:22:31.215Z
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Darwin x64 19.6.0

@jacobweber
Copy link

jacobweber commented Jun 21, 2021

Same here. For example, open Git Graph and close it. From then on, while that workspace is open, pressing command-H on the Mac will no longer hide the app. Opened #126859.

@ryanromanov
Copy link

I'm unable to hide or minimize with cmd + h / cmd + m regardless of where I am in the editor.

VS Code Version: 1.58.2.

@bowernite
Copy link

Moved here, for a better title and visibility:

#130194

@lramos15
Copy link
Member

lramos15 commented Aug 5, 2021

@mjbvz I think this issue is a little bit more annoying than initially thought because it breaks the keybinding for the entire VS code session until you quit the window and re-open it.

@bowernite
Copy link

@rkdmen could we rename the issue to clarify that these shortcuts are not just broken during webviews, but rather always? Just want to make sure it gets the attention it deserves 🙂

@rolf-langer
Copy link

Happens with current latest version 1.59.0 under macOS Catalina (10.15.7) just with normal code views. Maybe related to the display of the changelog after update. App restart does fix this behavior for me.

@nebbles
Copy link

nebbles commented Aug 16, 2021

I was seeing this on the following version:

Version: 1.58.2
Commit: c3f1263
Date: 2021-07-14T22:09:06.581Z
Electron: 12.0.13
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Darwin x64 19.6.0

After updating to 1.59.0 seems to have fixed it (although maybe that was just the required restart when updating).

Edit: can confirm shortly after updating it returned

@bowernite
Copy link

I’m on 1.59.0, still broken for me

@brachycera
Copy link

Version: 1.59.1
Commit: 3866c35
Date: 2021-08-19T11:53:52.479Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Darwin x64 19.6.0

Got the same problem.

There is a osX workaround to hide the VS app. I leave this here maybe it helps someone.

use CMD + TAB keys to choose the VS code app
keep pressing CMD and release the TAB key
while holding down the CMD key hit H to hide the VS code app

@operatorone
Copy link

Version: 1.59.1
Commit: 3866c35
Date: 2021-08-19T11:53:52.479Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Darwin x64 20.5.0

Also broken for me.

@mhutchie
Copy link

Confirmed that the bug @jacobweber referenced above almost 3 months ago is still occurring in Visual Studio Code 1.61.1.

Version: 1.60.1
Commit: 83bd43b
Date: 2021-09-10T17:09:14.403Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

@mjbvz Would you please consider increasing the priority of this issue, as it has been affecting users for quite some time (worsened by the Webview changes a few months back)?

@bowernite
Copy link

@rkdmen could we rename the issue to clarify that these shortcuts are not just broken during webviews, but rather always? Just want to make sure it gets the attention it deserves 🙂 (and the VS Code team closed my other issue, that had a different title)

@operatorone

This comment has been minimized.

@10bo
Copy link

10bo commented Apr 4, 2022

Same thing here 😴

Version: 1.66.0
Commit: e18005f
Date: 2022-03-30T05:49:37.118Z (5 days ago)
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin arm64 21.1.0

@jon-sully
Copy link

I've been feeling the Cmd+H / Cmd+M bug for a long time, I didn't realize all this time that it was the markdown previewer! Glad we at least know where it's coming from! I wish I could disable the previewer altogether given this effect — I don't recall even using it. I usually stick to Typora..

Regardless — a note on workarounds

Sorry for overcomplicating the issue, but this only works for me when I move focus back to the Editor using ctrl+tab, not when switching tabs by clicking on them with the mouse.

I find this same behavior as well but I also realized that the "Double Click To Switch To Editor" feature also hands back focus in a way that resumes standard Cmd+H / Cmd+M control, and I believe this feature is on by default. Just open a markdown file, open the previewer, then double click anywhere in the previewer to hand focus back and get your keybindings back.

It's almost funny. With both panes open you can click on the previewer, nothing works, double click it, key-binds work again, click the previewer and...they're back off.

@jacobweberbowery
Copy link

My workaround is to just define a Keyboard Maestro macro for command-H that hides VSCode. Not perfect, but it works.

@benhutchins
Copy link

I also found that the SQLTools extension can cause this problem, they use a shortcut that looks for CMD+E, CMD+H (a sequence). Even though it is not bound to the CMD+H, it prevents the native CMD+H macOS functionality.

I don't blame that extension, but I think this is a bug within Visual Studio Code. It could dynamically to the CMD+H only after the CMD+E is struck.

@Trandung5698
Copy link

Trandung5698 commented Apr 5, 2022 via email

@Trandung5698
Copy link

Trandung5698 commented Apr 5, 2022 via email

@10bo
Copy link

10bo commented Apr 6, 2022

I've been feeling the Cmd+H / Cmd+M bug for a long time, I didn't realize all this time that it was the markdown previewer! Glad we at least know where it's coming from! I wish I could disable the previewer altogether given this effect — I don't recall even using it. I usually stick to Typora..

Regardless — a note on workarounds

Sorry for overcomplicating the issue, but this only works for me when I move focus back to the Editor using ctrl+tab, not when switching tabs by clicking on them with the mouse.

I find this same behavior as well but I also realized that the "Double Click To Switch To Editor" feature also hands back focus in a way that resumes standard Cmd+H / Cmd+M control, and I believe this feature is on by default. Just open a markdown file, open the previewer, then double click anywhere in the previewer to hand focus back and get your keybindings back.

It's almost funny. With both panes open you can click on the previewer, nothing works, double click it, key-binds work again, click the previewer and...they're back off.

Thank you for pointing out this workaround. This has worked for me.

The workaround for anyone experiencing this issue with Markdown:

  1. Create new file (⌘+N or Ctrl+N).
  2. Change language mode to Markdown (⌘+P or Ctrl+P then select Change Language Mode).
  3. Open locked preview to side (⌘⇧+P or Ctrl⇧+P then select Markdown: Open Locked Preview to the Side)
  4. Double click anywhere on the locked preview.

Note: Ensure 'Markdown > Preview: Double Click To Switch' is enabled in settings.

@BB9z
Copy link

BB9z commented May 21, 2022

I have a workaround:

Open command palette and search: Open Keyboard Shortcuts (JSON)

Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

@ktravelet
Copy link

I have a workaround:

Open command palette and search: Open Keyboard Shortcuts (JSON)

Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

FINALLY!! thank you!

@esthor
Copy link

esthor commented Jun 12, 2022

I have a workaround:

Open command palette and search: Open Keyboard Shortcuts (JSON)

Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

This also worked for me.

And just a note that making this change in the visual editor for Keyboard Shortcuts (Code -> Preferences -> Keyboard Shortcuts) does not solve it. You really do need to go into the Keyboard Shortcuts JSON and make the change. The important thing for me was to remove the "when": "testing.isPeekVisible". If I leave that, it still breaks the cmd+h/cmd+m behavior anytime I open a Markdown preview.

@Bill-Haku
Copy link

I have a workaround:

Open command palette and search: Open Keyboard Shortcuts (JSON)

Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

Thanks, it worked for me!

@niekvandepas
Copy link

niekvandepas commented Jun 21, 2022

I have a workaround:

Open command palette and search: Open Keyboard Shortcuts (JSON)

Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

I've had this item in my config for a while, but still ran into this bug today. Restarting VS Code obviously did temporarily fix the issue, but that's not exactly a viable workaround...

@rkdmen
Copy link
Author

rkdmen commented Jun 21, 2022

I have a workaround:
Open command palette and search: Open Keyboard Shortcuts (JSON)
Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

I've had this item in my config for a while, but still ran into this bug today. Restarting VS Code obviously did temporarily fix the issue, but that's not exactly a viable workaround...

Same here, I tried over week with this shortcut but bug still exist.

@alfuken
Copy link

alfuken commented Jun 23, 2022

How many more comments and upvotes should this issue receive to get it fixed?...

@ssigwart
Copy link
Contributor

ssigwart commented Jul 9, 2022

I looked into this and created a PR for it. It does not make Cmd+H or Cmd+M work while in a webview (e.g. Markdown preview), but it does fix it breaking those keybindings until you reboot. More details are in the PR.

As a workaround until the PR is merged, you can make sure that you focus on a different editor before closing a Markdown preview. You can also use that trick to get it working again instead of having to completely restart VS Code if you accidentally do close the editor while focused on the webview.

@timdmackey
Copy link

Thank you @ssigwart! The pull request is here for those interested in more details: #154648

@ssigwart ssigwart linked a pull request Jul 12, 2022 that will close this issue
@djmtype
Copy link

djmtype commented Dec 1, 2022

I have a workaround:

Open command palette and search: Open Keyboard Shortcuts (JSON)

Then put this item in config file:

{
    "key": "",
    "command": "testing.toggleTestingPeekHistory"
}

Restart VSCode then it will be fine.

I already had:

{
  "key": "cmd+h",
  "command": "testing.toggleTestingPeekHistory",
  "when": "testing.isPeekVisible"
}

Does this not mean the same thing? However, this doesn't always do the trick. It's also hard to reproduce this bug because with cmd+h sometimes I can get VS Code to hide and other times it won't.

@CodingMarkus
Copy link

I have the issue as well but the workaround doesn't work for me as testing.isPeekVisible has never been set to cmd+h in the first place, it's set to opt+h. There is no shortcut set for cmd+h at all anywhere and still it fails for certain windows while it works for other windows. Also the window it fails has never been a markup preview, it's an editor editing a shell script and never has been anything else. Two other open windows work as expected.

@cfarvidson
Copy link

I have the issue as well but the workaround doesn't work for me as testing.isPeekVisible has never been set to cmd+h in the first place, it's set to opt+h. There is no shortcut set for cmd+h at all anywhere and still it fails for certain windows while it works for other windows. Also the window it fails has never been a markup preview, it's an editor editing a shell script and never has been anything else. Two other open windows work as expected.

Same for me. I can't find "cmd+h" but hiding vscode does not work.

@Lawrence-of-AnKing
Copy link

me too...

I can not hide my vsc by Command + H.

And I've been annoyed by this problem for a looooong time...

@operatorone
Copy link

Mee too. I can't understand that this is consistently not solved and it stresses me every day.

@juliand665
Copy link

For what it's worth, I've recently noticed it happening only in environments that are not the regular text editor, so e.g. a Jupyter notebook. The "What's New" view for patch notes is another one, iirc.

@maximillianus
Copy link

This happens to me too especially Cmd+M in markdown editing using Markdown All In One plugin installed. This is very annoying as Cmd+M in Markdown All in One plugin is replaced into shortcut for Markup.

Cmd+H and Cmd+M in markdown preview does not work too.

@mocenigo
Copy link

mocenigo commented Sep 11, 2023

Hello. it is still there and it is very annoying. If I am in a web view, cmd-H will not hide the application, and I am forced to click in a text pane first.

I am using VS Code 1.81 and VSCodium 1.80 under macOS Sonoma

@nurp
Copy link

nurp commented Nov 23, 2023

Somehow My Mac M1 (13.5 Ventura) doesn't hide the last window whether it is VSCode (1.84) or terminal or Chrome. Unhide another window and see if you can hide VSCode now. I think it is a mac bug.

@Urist-McUristurister
Copy link

Urist-McUristurister commented Nov 23, 2023

Somehow My Mac M1 (13.5 Ventura) doesn't hide the last window whether it is VSCode (1.84) or terminal or Chrome. Unhide another window and see if you can hide VSCode now. I think it is a mac bug.

This is not the same issue.

The last window on Mac can not be hidden.

If you click on menu "%whatever_app_you_have_currently_active%" > "Hide others", it will hide all other apps except %current%. To hide %current%, you have to focus Finder app first.

It's not a bug, it has been like that forever.

@nbbaier
Copy link

nbbaier commented Mar 18, 2024

I have been experiencing this behavior a lot lately on VSCode 1.87.2 running on a M2 mac (Sonoma 14.4). Has anyone found a consistent workaround so that that ⌘H works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities webview Webview issues
Projects
None yet