Add configurable disk display order (disks_order)#1700
Open
void143 wants to merge 1 commit into
Open
Conversation
The order of disks shown in the mem box is currently fixed: root first, the swap pseudo-disk after it, then the remaining disks in mount-table order. With several disks mounted this makes a preferred layout impossible to achieve. Add an optional "disks_order" config option: a whitespace-separated list of mountpoints (with "swap" as a token for the swap entry) defining the leading display order. Listed disks are shown first in the given order; any remaining disks keep their default order. An empty value preserves the current behavior. Implemented as a single shared Mem::apply_disks_order() helper called from each platform collector (linux, osx, freebsd, netbsd, openbsd) after disks_order is built, plus registration in the config defaults and the options menu.
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.
Description
Adds an optional
disks_orderconfig option that lets the user define a custom top-to-bottom order for the disks shown in the mem box.Currently the order is fixed (root first, the swap pseudo-disk after it, then the rest in mount-table order) and
disks_filteronly filters, it doesn't reorder. With several disks mounted there's no way to get a preferred layout.Resolves #1699.
Behavior
swapusable as a token for the swap entry — same format/spirit asdisks_filter.Example:
Implementation
Mem::apply_disks_order(mem_info&)helper inbtop_shared.cppreordersmem.disks_order(the single source of truth used by both draw loops) according to the option.disks_orderis built, so there's one shared implementation rather than per-platform logic.btop_config.cpp) and the options menu (btop_menu.cpp).No new dependencies; uses the existing
ssplit/v_containshelpers. +60 lines, no deletions.