Add E hotkey to collapse/expand all processes in tree mode#1564
Open
sardonyx001 wants to merge 3 commits intoaristocratos:mainfrom
Open
Add E hotkey to collapse/expand all processes in tree mode#1564sardonyx001 wants to merge 3 commits intoaristocratos:mainfrom
sardonyx001 wants to merge 3 commits intoaristocratos:mainfrom
Conversation
Pressing E in tree mode collapses all processes if any parent is currently expanded, or expands all if everything is already collapsed. This gives a quick per-application resource summary without having to manually toggle each node. Implemented across all platforms (Linux, macOS, FreeBSD, OpenBSD, NetBSD).
Root processes (those whose parent is not in the tracked process list, e.g. launchd on macOS or a top-level colima) are now left untouched by the E hotkey. Only their descendants are collapsed or expanded. The toggle direction is also determined solely from non-root parents, so a tree full of root-only visible rows correctly expands on the next E press.
When proc_tree is active and left/right changes the sort column, no_update was left as true. _tree_gen is called with no_update=true, which skips the p.filtered=true assignment for children of collapsed nodes while the unconditional else-if on line 211 of btop_shared.cpp clears their stale filtered flag from the previous cycle. This leaves collapsed children in an inconsistent state for one frame, causing a brief visual glitch before the next full update corrects it. Setting no_update=false only in tree mode keeps the fast path for flat list mode unchanged.
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.
Closes #1563, addresses #520, #673, #1528 and #686.
Been using btop for years, it's my favorite system monitor by far.
Tree mode is great but I always found myself tediously spacebar-collapsing every single node just to get the per-app summary view. Finally sat down gave it a try.
Here's the overview:
Ecollapses all processes in tree mode at once, or expands them all if everything is already collapsedEpairs naturally with the existinge(toggle tree mode on/off)Runner::runwithno_update=true, which meant_tree_genskipped settingp.filtered=truefor collapsed children while line 211 ofbtop_shared.cppwas unconditionally clearing their stale flag from the previous cycle. Fixed by forcingno_update=falseon left/right whenproc_treeis active.This is my first time contributing to a project so large so please tell me if there's anything I need to update/change.
Before and After:
Screen.Recording.2026-03-04.at.14.09.33.mov