Skip to content

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

Closed

Description

@tycode

This is my attempt to find a suitable workaround to #224515, given that we will probably not see a proper resolution to that bug for a long time if ever. I have implemented a proof-of-concept and intend to submit a PR for this shortly.

Add a "Force Custom Menu Style" option - boolean, default false.

image

If false, behavior is unchanged. If true, and "Title Bar Style" is "native", and we're running on Linux or Windows (notably: not Mac*, not web), then we display the OS native title bar, but we display the custom menu bar below it, taking care not to repeat the window title. Of course, it affects context menus as well as the main menu bar. The result: a pleasant user experience while using the native title bar.

force-custom-menu-contextmenu
Debian 12, MATE

Compare with the screenshots from my comment here - unfortunately I can't show the same menu, since I understand it's not possible (not allowed) to use the Marketplace from an unofficial build of VS Code, but hopefully it should still illustrate the point.

By default, you'll also get the "Command Center" and "Layout Controls" showing up next to the menu, since this menu bar is really just the custom title bar, forced to be displayed. The above screenshot, showing the classic "separate title bar and menu bar, with no additional clutter" layout, was accomplished by just using the existing settings to hide these items.

(*I have assumed that this isn't applicable on Mac, based on basic knowledge of the Mac interface and various comments in the VS Code source, but I don't use Mac myself, so I have no way to test this. If someone else finds a reason why it'd be useful to have this feature on Mac as well, then feel free to enable it there.)

Activity

  1. oddstr13 commented on Sep 19, 2024

    @oddstr13

    I too was thinking this would be a decent compromise during this past week, missing the native title bar.

  2. added
    titlebar
    system-context-menu
    and removed
    titlebar
    on Oct 15, 2024
  3. added
    feature-request
    on Dec 9, 2024
  4. lah7 commented on Dec 16, 2024

    @lah7

    *I have assumed that this isn't applicable on Mac, based on basic knowledge of the Mac interface and various comments in the VS Code source, but I don't use Mac myself, so I have no way to test this.

    You're spot on. 👍🏼 Under macOS 11 (obsolete, very old), I can confirm that VS Code 1.96 / Electron 32 does use the native menus, both for the menu bar (global/system) and context menus. No visual discrepancies across programs there.

    I'm hoping the Electron docs can be updated to clarify the so-called "native" menu:

  5. 0009-0009-1013-986X commented on Feb 28, 2025

    @0009-0009-1013-986X

    #229053 (comment)

    Rob Rolls (@tycode), why is a forced override of the context menu style dependent upon whether the title bar is CSD or SSD?

  6. tycode commented on Mar 1, 2025

    @tycode
    Author

    why is a forced override of the context menu style dependent upon whether the title bar is CSD or SSD?

    I'm not sure what you're asking here, can you be more specific please?

    Also, what is "CSD" and "SSD"?

  7. 0009-0009-1013-986X commented on Mar 1, 2025

    @0009-0009-1013-986X

    #229053 (comment)

    Rob Rolls (@tycode), they refer to whether the graphical toolkit renders the window borders, or the compositor(/display server) does (albeit via the window manager, regardless):

    Acronym Expansion
    CSD Client-Side Decoration
    SSD Server-Side Decoration

    Consequently, I'm asking why a context menu override is dependent upon having the titlebar be rendered by the application's GUI toolkit or window manager's preferred window decorations.

    I ask because I've seen examples of custom context menus from Electron, Tauri, Qt5+6 (and maybe GTK3+4) applications that don't render custom (CSD) title bars.

  8. tycode commented on Mar 2, 2025

    @tycode
    Author

    @RokeJulianLockhart

    OK, so if you're asking me why VS Code (1.91 for sake of argument) only lets you choose between a) "custom title and custom window menu and custom context menu" or b) "native title and 'native' window menu and 'native' context menu"... well I have no idea what the original reasoning was! I'm just a random user that got frustrated by #224515 and created this PR in response.

    If you're asking me why the setting I added in my PR is worded the way it is, and does what it does, it's because it was the simplest way I could think of to solve the problem. It did occur to me that it would be much nicer to have separate, totally independent settings for "title bar style", "window menu style" and "context menu style", and I vaguely recall briefly exploring this at some point, but I ended up with weird side-effects and crashes. The (existing) code makes assumptions that these are one and the same setting, and that the setting doesn't change except when the application is restarted. I felt it wasn't worth getting dragged into this rabbit-hole and producing something that would have far more code changes and complexity and be even less likely to be accepted.

    There's no fundamental reason why they should be tied together so it's going to be down to the history of the piece of software in question.

  9. added
    unreleased
    insiders-released
    and removed
    unreleased
    on May 20, 2025
  10. locked and limited conversation to collaborators on Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestinsiders-releasedon-testplansystem-context-menu

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions