Move electron app menu bar to UI title instead of electron one#478
Merged
ezewer merged 53 commits intobitfinexcom:stagingfrom Jan 16, 2025
Conversation
Release version 4.30.0
Release version 4.31.0
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the electron app menu bar to the UI title instead of the electron one so that we can customize the electron menu, as the native electron menu API doesn't provide that. It allows us to build the menu in the UI in one small line with the main app title and typical window buttons (minimize, maximize, and close in the top corner). This is very useful as it saves overall space and at the same time constantly displays the menu and does not require the user to press the
Altkey to display it (as practice has shown, because of the last one, many inexperienced users do not even know about the existence of menu functions)It can be safely merged before the implementation of UI, since the default is still using the native menu (we have a special flag for quick switching after the implementation of UI)
The start example of how the menu should look can be taken from the

VSCodeviewThe title should have:
For test and debug purposes a quite simple menu was implemented in the pure html/css and placed into the main
index.htmlTo understand the common logic of implementation look at
styles,htmlandscriptin this index.html file: https://github.com/ZIMkaRU/bfx-report-ui/blob/feature/add-test-electronjs-menu-to-html/public/index.htmlThe live beta release can be found here: https://github.com/ZIMkaRU/bfx-report-electron/releases/tag/v4.32.0-beta.10
Debug layout examples:
API for UI which is provided via context bridge to chromium window object:
The method
window.bfxReportElectronApi.getMenuTemplate()returns the following data structure on Ubuntu:Also, electronjs provides
titlebar-area-heightenv var to css for getting menu bar height. The example of usage can be found in the aboveindex.htmlfile. CSS should look like this:Get more info here:
Also, this PR updates
electronversion up to33.3.1and makes related changes to be able to add native window controlsnew BrowserWindow({ titleBarStyle: 'hidden' })https://www.electronjs.org/docs/latest/tutorial/custom-title-bar
Depends on this PR: