Skip to content

Add desktop application menu bar - #876

Open
pseudoramdom wants to merge 2 commits into
bitcoin-core:qt6from
pseudoramdom:desktop-menu-bar
Open

Add desktop application menu bar#876
pseudoramdom wants to merge 2 commits into
bitcoin-core:qt6from
pseudoramdom:desktop-menu-bar

Conversation

@pseudoramdom

@pseudoramdom pseudoramdom commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Add an application menu bar to the desktop

  • Add File, Edit, View, Window, and Help menus
  • Use native menus on macOS ( and Windows and an in-window menu bar on Linux, but untested)
  • Add shortcuts for Node, Activity, Send, Receive, and node-information views
  • Route menu commands through the existing QML navigation and dialogs
  • Disable wallet-specific commands when no wallet is available
  • Add the RPC Documentation help action
File Edit View Window Help
Screenshot 2026-08-25 at 8 56 37 PM Screenshot 2026-08-25 at 9 06 21 PM Screenshot 2026-08-25 at 9 11 54 PM Screenshot 2026-08-25 at 9 11 56 PM Screenshot 2026-08-25 at 9 11 59 PM

Add shared desktop menu actions with native menu presentation on macOS
and (Windows and an in-window menu bar on Linux, both not tested)

Wire file, edit, navigation, window, and help commands into the existing
QML application. Enable wallet-specific commands only when a wallet is
available, and add shortcuts, translations, and routing tests.

@johnny9 johnny9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found three areas to address: static Qt plugin linkage, edit-command focus after navigation, and the Linux menu implementation.

Comment thread qml/bitcoin.cpp
Q_IMPORT_PLUGIN(QmlSettingsPlugin)
Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
Q_IMPORT_PLUGIN(QtLabsPlatformPlugin)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bitcoinqml_qmltests is a separate executable, so this import does not make the plugin available there. Both static Depends jobs fail to load MainWindow with module "Qt.labs.platform" plugin "labsplatformplugin" not found. Link Qt6::LabsPlatformplugin to bitcoinqml_qmltests inside the static-Qt block and run the static QML tests.

Comment thread qml/pages/MainWindow.qml
|| typeof target.redo === "function"
|| typeof target.copy === "function"
|| typeof target.paste === "function")) {
appWindow.menuEditTarget = target

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

menuEditTarget retains the last editor after focus leaves its page. Edit a Send field, switch to Activity, then press Ctrl+Z: the hidden Send field is modified. Route edit commands to the current focus item. If native menu focus requires caching, clear the cache on page changes and reject hidden targets. Add a Send → Activity → Undo regression test.

Comment thread qml/pages/MainWindow.qml
menuBar: DesktopInWindowMenuBar {
id: desktopInWindowMenuBar
actions: desktopMenuActions
active: appWindow.appModeDesktopForUi && Qt.platform.os === "linux"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove DesktopInWindowMenuBar and use DesktopNativeMenuBar on Linux as well, so supported desktop environments can expose the application menu through com.canonical.AppMenu.Registrar. Linux sessions without a DBus global-menu registrar will have no application menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants