Skip to content

Add configurable disk display order (disks_order)#1700

Open
void143 wants to merge 1 commit into
aristocratos:mainfrom
void143:feat/disks-order
Open

Add configurable disk display order (disks_order)#1700
void143 wants to merge 1 commit into
aristocratos:mainfrom
void143:feat/disks-order

Conversation

@void143

@void143 void143 commented Jun 7, 2026

Copy link
Copy Markdown

Description

Adds an optional disks_order config 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_filter only filters, it doesn't reorder. With several disks mounted there's no way to get a preferred layout.

Resolves #1699.

Behavior

  • Value is a whitespace-separated list of mountpoints, with swap usable as a token for the swap entry — same format/spirit as disks_filter.
  • Listed disks are shown first, in the given order; any remaining disks keep their existing default order.
  • Empty (the default) → current behavior is unchanged, so it's fully backwards compatible.

Example:

disks_order = "/ swap /home /mnt/data"

Implementation

  • New Mem::apply_disks_order(mem_info&) helper in btop_shared.cpp reorders mem.disks_order (the single source of truth used by both draw loops) according to the option.
  • Called from each platform collector (linux, osx, freebsd, netbsd, openbsd) right after disks_order is built, so there's one shared implementation rather than per-platform logic.
  • Registered in the config defaults/descriptions (btop_config.cpp) and the options menu (btop_menu.cpp).

No new dependencies; uses the existing ssplit/v_contains helpers. +60 lines, no deletions.

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.
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.

Feature request: configurable disk display order (disks_order)

1 participant