mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 08:12:38 +00:00
Desktop tray icon and rpc console #746
No reviewers
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml!746
Loading…
Reference in a new issue
No description provided.
Delete branch "desktop-tray-rpc-console"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Combines the tray icon PR, the rpc console PR and the settings redesign, closes #538 and closes #540
For the tray icon, fixes #513:
Added window behavior as a new option in settings.
Added window behavior page, allows the user to configure if the tray is visible, behavior on minimization and behavior on closing.
Tray icon color matches the network the app is on.
Tray icon gives option to show or quit when clicked on.
Added unit, qml and functional tests.
For the rpc console, fixes #508:
Created page for rpc command console.
Created option under settings for console.
Preserved parsing logic currently in use along with autocomplete.
Added unit and functional tests.
For the settings redesign, fixes #685, fixes #688, fixes #747:
The settings menu now uses use a desktop sidebar layout instead of drill-down navigation.
Introduced a reusable SettingsHeader component, replacing NavigationBar2 + state machine boilerplate across all settings pages.
Removed redundant Dark Mode toggle from Developer Options, already exists in Display -> Theme.
Rpc console and peers now have their own icons on the main navbar and have been moved out of the settings page.
Added unit, qml and functional tests.
Updated functional tests to support rpc console and peers being out of the settings page.
Fixes from #750:
Fixes send page nav button crash on Qt 6.4.2.
Added qml_test_psbt.py to CI workflow file.
Also cleaned up a few minor style/design issues.
Platform support. The tray-icon window toggle uses an obscured-check (QGuiApplication::topLevelAt()) ported from the Qt Widgets GUI's GUIUtil::isObscured(). On Wayland the compositor forbids querying other windows, so obscured-detection is unavailable, showMinimized() does not report a Minimized visibility, and the window position is not preserved across a tray hide/show because the compositor, not the client, controls placement. The position limitation applies to any Wayland-compositor session, including X11 clients via Xwayland; geometry is restored correctly on native X11 (Xorg), macOS, and Windows. These match the limitations the existing Qt Widgets GUI has on Wayland and meet issue #513's DoD, which does not require obscured-detection parity. Tracking: bitcoin/bitcoin#19950 and #748.
Qt Quick has no system-tray API, so DesktopTrayIconController wraps QSystemTrayIcon (Qt Widgets) in C++, with a native QMenu context menu (Linux SNI/AppIndicator hosts require a menu set via setContextMenu()). This reuses the Qt Widgets dependency the GUI already links.
Note main navbar can't fit anymore elements, adding the rpc console and peers icon fill it up at max width
I think these headers aren't needed if we have the context already on the left sidebar.
Node only mode functional tests are failing.
-disablewalletcli arg will launch it in that mode.I can take them out if you want but without a full page redesign it doesn't look good. If I did do it I'd probably align the page with top of menu.

I'd prefer to keep the header title.
There should be 5 peer/node icons
The peers icon here is designed to be 5 icons with each one representing an increasing amount of connections to the node.
The original source of these icon is the bitcoin wallet ui kit https://www.figma.com/design/iaIQLsKeyK6CDRilTPeHie/Bitcoin-Wallet-UI-Kit---Design-System--Community-?node-id=4499-57506&t=Kq8aiiPsn58BlnQ1-4
It's available on https://bitcoinicons.com
Okay. I'll update to use all dynamically.
The command hints are super slick and useful! But when I hit return on any of the command, I'd expect the selected command to go through , but instead what ever is in my textfield went.
https://github.com/user-attachments/assets/f24d2c71-65c2-498f-b813-3a8f21a13f6d
Re: Settings layout, I believe Christoph had a simpler version here
Mainly
The icon sizes are off on macOS. Worth fixing it here if it's quick

Are we intentionally choosing to drop the wallet context here?
The lower-level executor already supports wallet scoping:
RpcCommandExecutor::RPCParseCommandLine()acceptswallet_nameand builds the/wallet/<percent-encoded-name>URI before callingnode.executeRpc().The button itself is disabled while
rpcConsoleModel.executingis true, butsubmitCommand()itself still accepts commands. That matters because Enter calls the QMLsubmitCommand()helper directly, so keyboard submission can still reach the invokable while another RPC is running.Qt Widgets handles this in
RPCConsole::on_lineEdit_returnPressed()by allowingstopas a special case, then returning early whenm_is_executingis true.The QML worker still executes queued commands serially, so this is not parallel RPC execution, but the
executingstate can become inaccurate: the first result callssetExecuting(false)even if another command is already queued or running behind it.The suggestion here is to model Qt Widgets with how it prevents calls from all forms, button and keyboard press
Maybe we should mirror the Qt Widgets load time clamp here?
Widgets has treated persisted settings as mutable external input in a few places:
The tray setting has the same precedent: since the original hide-tray feature (8b0e497028) and still after the positive “Show tray icon” rename (17174f8328), Widgets loads minimizeToTray as settings.value("fMinimizeToTray").toBool() && m_show_tray_icon.
An invalid state is not reachable through normal user clicks, but the gui is implemented to be defensive against an old/manually altered/stale QSettings value so that it cannot produce runtime
showTrayIcon=false && minimizeToTray=true.The needed changes would look something like
Alternatively I'm fine with this being a follow-up, or if this is merged before settings, I can include it in my settings PR.
a fix for this could look like:
a fix for the above can look like:
To reproduce manaully, you can enter the following, which is long running command:
On the current branch you can enter as many of them as you want and they will execute one after another, and return when they return. With the suggested patch you cannot enter another rcp command until that one returns, which is the Qt Widgets gui behavior.
This component is currently functional, and does the right things, so we can merge.
Longer term, though, I think the RPC console would benefit from being split into a few focused pieces.
Right now this one QML file owns page layout, warning/header text, output rendering, command input, keyboard handling, history navigation, autocomplete filtering, popup behavior, focus policy, and wallet context submission.
I think this warrants refactoring the console around a clearer ownership model (placeholder names below, we can figure out naming later):
The important design direction is that command acceptance should remain controller owned.
QML can ask
canSubmit(command)or consume a richerSubmitResult, but it shouldn't need to duplicate special cases like "stop is allowed while another command is executing."That keeps direct invokable calls, keyboard submission, button submission, and tests all going through the same policy.
While also giving us the benefit of a clean architecture split, and easier testability, and finer grain testability of each component independently.
Architecture diagram:
I think in a follow-up we can make the tray controller use one shared show/hide/restore model.
The tray click path and the native menu path currently make different decisions:
toggleWindow()checks the real window state: hidden, minimized, and obscured.m_window_visible.This means that a covered but visible window can be treated differently depending on whether the user clicks the tray icon or uses the OS native menu; tray click would try to show/raise it, while the menu can label/action it as “Hide”.
I don't think this needs to block this PR, but the follow up should probably centralize the decision in one helper, for example:
Then use that same logic for:
I noticed here that there is probably a related followup we would want to do:
This
hasMoreLinescalculation cannot reliably detect older entries.ReadRawLines()returns at mostloadLimitrows, and then this path checksfiltered.size() > m_load_limit. For a normal large log whose newestloadLimitrows are non-blank,filtered.size()will be exactlym_load_limit, not greater than it, even if the file has many older entries. SohasMoreLinesbecomes false and the button stays hidden.Building on the above, I think the debug log viewer would benefit from a refactor that treats this as a small log viewing subsystem rather than one list model that happens to read a file.
From first principles, the debug log viewer has four separate responsibilities:
Right now those responsibilities are mixed together. That makes a few correctness issues hard to avoid.
The current model mostly knows “I loaded N rows from the tail,” then tries to infer everything else from that. That makes
Load morea limit bump plus reread, append refresh a search for the old top row by message text, and rotation/truncation detection dependent on whether old content can still be found.I think the cleaner followup is to make this cursor-based: the reader returns rows plus
oldestCursor,newestCursor,hasOlderEntries, and file generation. Then initial load,Load more, appends, and reloads become direct operations instead of things that we try to best effort guesstimate.That also gives cleaner model notifications: insert new rows at the top, insert older rows at the bottom, emit
dataChangedfor relative-time-only updates, and reserve full resets for true replacement cases like filtering or rotation.I think a good architecture to move towards is one that implements the following split:
The important shift here is that the model stops guessing and starts tracking where it actually is in the file. The reader gives the model real cursors and file information.
This would make the behavior easier to reason about and test, while fixing the current pagination ambiguity, stale relative time labels, duplicate content refresh risk, and log lifecycle edge cases.
ACK 8f4a8379742ceece1b200292d740ad95d8097fca
These changes are good to merge now. Important follow-ups are documented in review.
ACK 8f4a8379742ceece1b200292d740ad95d8097fca
Needs rebase.
@pseudoramdom I fixed the 2 blockers from #750 here (send crash and adding to CI flow). Rest of review issues are less urgent.
nit: Should we give a padding to the left of the menu? Feels like there's no breathing room there compared to the rest of the app.

There are 2 commits in the PR that don't compile. Please resolve this before we ACK/merge.
8ac27bdc15 build: Add Qt6::Widgets and optional DBus support for system tray
48f9f2355b qt: Add DesktopWindowBehaviorModel
Both fail at CMake configure because test/CMakeLists.txt references test_desktoptrayiconcontroller.cpp before that file exists. The fix is straightforward: move the test_desktoptrayiconcontroller.cpp addition to test/CMakeLists.txt into the commit that adds that file, or add the file in the earlier build-system commit.
Everything else looks good enough to ACK/merge. I have added an issue to track a bug that Jarol also mentioned relating to the relativeTime updates.
The second commit 8d3d0818fd doesn't link properly
ACK
6ff51b854dRe-reviewed the latest push and confirmed the commit-order build issue is fixed
Manually tested on Ubuntu and macOS. Remaining non-blocking issues are tracked for follow-up.