Skip to content

[FEAT] Separate Zram usage from disk swap to avoid misleading totals #2315

@bhorolsky

Description

@bhorolsky

Description

Currently, fastfetch merges all swap memory into a single line, treating zram devices and disk swap files/partitions as identical swap resources

While this is technically correct from the kernel's perspective, it misrepresents system state for users relying on zram. Zram is commonly used today (e.g., Fedora, Ubuntu, Arch with custom configs) as compressed RAM, not as slow disk I/O

The current output shows, for example: Swap: 3.2G / 8.0G
If 4.0G of that is zram and 4.0G is disk, a user might incorrectly think disk swap is 50% full, while in reality, disk I/O is still zero, and zram still has free compressed space

Motivation

Why doesn't Command module suffice?

The official recommendation is to use the Command module with a custom script. However:
The Command module breaks the native look and feel of fastfetch (indentation, coloring, alignment with other system stats)
Parsing /proc/swaps and separating /dev/zram* from disk swap requires external dependencies (awk, numfmt, or custom binary), which adds complexity and hurts portability

A native implementation inside fastfetch would be faster, cleaner, and maintain the standard unified formatting

Zram is increasingly a system-level feature (enabled by default in many kernels and distros). Displaying it correctly falls under the "hardware/system level software" category

Additional context

Many Linux users (especially on laptops and low-memory devices) rely on zram to extend usable memory without thrashing disk. Showing their true swap composition helps them monitor memory pressure accurately without resorting to external scripts or having to remember that "Swap" actually means "Zram + Disk"

A simple split like:
Swap (disk): 512M / 2.0G
Zram: 2.1G / 4.0G

or a combined line with inline breakdown would resolve the confusion for good

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions