User. Who
User. Who

Reputation: 831

Override <ALT> to toggle menu bar on VS CODE

What I want to achieve is as follows:

  1. Disable ALT to show menu bar by toggle-menu-bar completely.

    -> Potentially map ALT to a NULL action?

  2. Use a different shortcut to toggle-menu-bar.

Is there a way to achieve this?

Upvotes: 67

Views: 17606

Answers (9)

amirhossein Zarif
amirhossein Zarif

Reputation: 1

open setting from File --> Preferences --> Settings and in searchBox type menu bar in Result you can turn off it and whatever you want to doenter image description here

Upvotes: 0

Fabian Lehmann
Fabian Lehmann

Reputation: 156

As in Dmitriy Botov answer, adding those lines

"window.customMenuBarAltFocus": false, 
"window.enableMenuBarMnemonics": false,
"window.menuBarVisibility": "hidden",

to the config works, but when I toggle the menu bar with e.g. alt+f the menu stays open. If I use the toggle menu bar command/keybind the setting of "window.menuBarVisibility": "hidden" will be changed to "window.menuBarVisibility": "classic" and then to "window.menuBarVisibility": "toggle" which enables showing the menu bar on alt key again.

However, I'm using the Settings Cycler extension and build a command with it that does the job for me:

1. in settings.json add:

"settings.cycle": [{
        "id": "toggleMenuBar",
        "values":[
            { "window.menuBarVisibility": "hidden" },
            { "window.menuBarVisibility": "visible" }
        ]
      }
    ],

2. Set a keybind for the new command:

{
     "key": "alt+shift+w",
     "command": "settings.cycle.toggleMenuBar",
}

This shows the menu bar and removes the "toggle on alt key" functionality when hidden.

Tested on vscode 1.60.0

Upvotes: 1

Peter Qiu
Peter Qiu

Reputation: 153

I have tried this on Win10, and adding these 3 lines to settings.json will work for me, while the latest upvoted answer will make the Menu bar hidden, which is not what we want.

"window.titleBarStyle": "custom",
"window.customMenuBarAltFocus": false,
"window.enableMenuBarMnemonics": false,

Upvotes: 13

Eyal Levin
Eyal Levin

Reputation: 18386

On Ubuntu I needed this two settings in settings.json :

"window.titleBarStyle": "custom",
"window.customMenuBarAltFocus": false

(VS Code restart might be required)


Related:

Upvotes: 102

Alan L V. Guedes
Alan L V. Guedes

Reputation: 21

Just "window.menuBarVisibility": "hidden" works.

Upvotes: 1

budden73
budden73

Reputation: 2651

The solution is to set menu always hidden to prevent interfering with alt-hotkeys. But enabling mnemonics still allows you to reveal it by pressing Alt+F for example.

This can be achieved with "window.menuBarVisibility": "hidden", "window.enableMenuBarMnemonics": true in settings.json. The enableMenuBarMnemonics seem to be the default and hence unnecssary.

To access menu, press Alt-F or Alt-E, or Alt-whatever

This answer originates from Dmitriy Botov's answer

and my comment on it

Upvotes: 5

biffta
biffta

Reputation: 189

This fixed it for me (I'm using Linux)

 "window.titleBarStyle": "custom"

Upvotes: 5

Dmitriy Botov
Dmitriy Botov

Reputation: 2651

My only solution is to set menu always hidden to prevent interfering with alt-hotkeys. But enabling mnemonics still allows you to reveal it by pressing Alt+F for example. enter image description here

Upvotes: 35

Todd Vanyo
Todd Vanyo

Reputation: 583

I'm using v1.25.1 and the setting to disable ALT menu selection is "window.enableMenuBarMnemonics": false. You can keep the menu visible.

Upvotes: 6

Related Questions