Skip to content

Allow use of custom menu with native titlebar (on Linux and Windows) - #229385

Closed
Rob Rolls (tycode) wants to merge 5 commits into
microsoft:mainfrom
tycode:main
Closed

Rob Rolls (tycode) wants to merge 5 commits into
microsoft:mainfrom
tycode:main

Conversation

@tycode

@tycode Rob Rolls (tycode) commented Sep 23, 2024 •

Copy link
Copy Markdown

Closes #229053

Notes:

  • This is my first pull request to VS Code. I've followed all the guidelines I could see, please let me know if I've missed anything.
  • I've tested this pretty exhaustively: different combinations of the new "Force Custom Menu Style" setting, the existing "Title Bar Style" and "Menu Bar Visibility" settings, and whether or not the Command Center and/or Layout Controls are hidden, on Debian 12 (with MATE, which is my primary desktop environment) and Windows 11. I tested going in and out of fullscreen, and pressing Alt or Alt-F, with these different combinations, as these all affect showing/hiding the menu.
  • I cannot test on Mac as I don't have a Mac. I also cannot test on Web as trying to run npm run watch-web gives me a glorious out-of-memory error. Those platforms should not see any change at all, so hopefully this doesn't introduce any regressions to them, but someone who can will need to check them.
  • I made it so that the new "Force Custom Menu Style" setting requires a restart to take effect, in the same way as the "Title Bar Style" setting. See below.

Side-track: Why does the new setting require a restart?

At first, I did try to make it so that it didn't require a restart, but this sent me down a rabbit hole of a fair bit of refactoring (which would make it a lot harder to review if I included that!) as well as at least two bugs I couldn't figure out causing oddities when certain things are changed on the fly. These bugs already existed in unchanged VS Code, at least in v1.91.1 where I started developing this before rebasing, and can be reproduced if you try hard enough, by following certain steps including changing settings, saying "cancel" to the restart prompt and then changing more settings. So, I don't want that to hold up getting this pull request in, and I'm not going to be spending any more time on this (nor do I think it's worth me raising an issue for) if no one else is interested in sorting this out, but if anyone is looking at this area already, please link an appropriate issue and I can certainly share my findings in more detail there.

@tycode

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@tycode

Rob Rolls (tycode) commented Nov 18, 2024 •

Copy link
Copy Markdown
Author

Hi SteVen Batten (@sbatten) Benjamin Christopher Simmonds (@benibenj)

It's been nearly two months.

#224515 is still open with 70 thumbs-up (meaning countless more people will be out there with this issue who have not indicated this) and so far I haven't seen any alternative solution proposed. I personally am stuck on VS Code 1.91.x because of this, and I don't want to be getting further and further behind forever.

Could someone please let me know if there is any chance this feature will be adopted, or if the team is working on an alternative resolution?

I'm happy to rebase this to a newer VS Code version, resolve conflicts and re-test, if that would help get this merged, but I'd appreciate some indication that that effort would not go to waste first.

@benibenj

Copy link
Copy Markdown
Contributor

Rob Rolls (@tycode) Sorry about the longer wait. We are evaluating how likely it is that this will be fixed upstream in a reasonable time frame. We do not want to introduce a new setting just for a couple months if it will be fixed. If we can tell that this will be a long standing problem then we will consider addressing the issue with this PR.

Currently the workaround is to use the custom title bar.

@tycode

Copy link
Copy Markdown
Author

Benjamin Christopher Simmonds (@benibenj)

I had actually considered the ability to set the menu style independently from the title bar style as a neat new customisation feature that would be kept even if the upstream issue is fixed - personally, I'd say the VS Code custom menus are fantastic, and the only reason I'm not using them is that they can't be used with the native title bar. :)

But the stance does make sense; it's always hard to justify increasing the support matrix. I'll continue to remain on 1.91 for now. Thanks for the quick response!

@lah7

Luke Horwell (lah7) commented Dec 16, 2024 •

Copy link
Copy Markdown

Electron ("upstream") confirmed their position - they won't carry patches to restore native menus on their end:

Considering the general consensus from the comments, it seems very unlikely that their upstream (Chromium) will address this any time soon.

I hope the Electron API docs can clarify that native != Chromium menus.


I agree that separating the options would be a good move. VS Code's custom menus are much better, but the native title bar is essential for me. With some window manager magic (in KDE), I can have both, and this PR will help me eliminate 'double window controls' that I've introduced onto myself:

image

(See other comment) | It'll also help when maximized, since my cursor near the far edge (for activity bar) starts clicking/dragging like it was the window border.

Thank you both for looking into it!

@tycode

Copy link
Copy Markdown
Author

Hi Benjamin Christopher Simmonds (@benibenj)

As it is now three and a half months later - and, as Luke Horwell (@lah7) mentioned above, it looks like there is no chance of the original issue being resolved upstream - I just wanted to check in and see if there is any desire within the VS Code team yet to see this PR merged - or something else similar that would achieve the same goal.

I appreciate that my PR is now even more outdated and will need updating and re-testing. I am still happy to do this if there is a reasonable prospect it will be merged.

Alternatively - if you have a proposal for a better UX (or a more maintainable solution) than a "Force Custom Menu Style" setting as here - I'd be happy to implement whatever, as long as it achieves the goal (providing the ability to use the custom menu style with the native title bar) and isn't unreasonable.

@benibenj

Copy link
Copy Markdown
Contributor

Rob Rolls (@tycode) Thank you very much for creating this PR. It does seem unlikely that the issue will be resolved upstream, and since we want to support custom context menus for macOS users, we’re planning to include this feature in the next release.

I reviewed your PR and thought it looked good overall. However, we’ve decided to take a slightly different approach to the setting to better align with the existing configuration structure. We also want to make sure to support custom context menus on macOS. I’ve created a new PR that introduces a window.menuStyle setting, which can be set to native, custom, or inherit (the latter following the style of the title bar).

Since your PR had merge conflicts and differed a bit from the direction we’re going in, and given the timing ahead of the next release, I’ve gone ahead with the new PR. It was very much inspired by your work, and I’d be happy to add you as a co-author if you’d like.

@tycode

Copy link
Copy Markdown
Author

Benjamin Christopher Simmonds (@benibenj)

I’ve created a new PR that introduces a window.menuStyle setting, which can be set to native, custom, or inherit (the latter following the style of the title bar).

Thanks! This is great news. I've done a quick test of the latest Insiders release (1.101.0-1747983231, 747d0bd) and raised the two small issues I could see, hopefully they should be fairly simple to fix:

Having these sorted in the next Stable release would be ideal, and should allow me to upgrade again at last.

As an aside, I'm pleased with the way the new menuStyle setting is laid out - it feels better worded than my "force custom" setting, and the "native" option (which at the moment seems like it'll always do the same as "inherit") seems good future proofing for if that combination becomes available, which my setting didn't provide for.

[The new PR] was very much inspired by your work, and I’d be happy to add you as a co-author if you’d like.

Feel free to! I don't really mind whether I'm attributed here or not, to be honest - what's important is having this functionality in! :)

@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jul 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow use of custom menu with native titlebar (on Linux and Windows)

4 participants