Skip to main content

Powerline Disk Utilization Indicator

A tiny Powerline segment I wrote (originally for tmux) to show me disk space utilization in its status line. This component does not work natively with tmux - if you just want a native tmux-specific component, check out tmux-df.

Here is a screenshot of this segment in action:

disk utilization example

The root / is red because, unlike /cache, it's over the critical_threshold I set to 40% for this example.

In this case, the relevant part of the powerline config (cat ~/.config/powerline/themes/tmux/default.json) is:

{
"segments": {
  "right": [
    {
      "function": "powerline_diskspace.diskspace.Diskspace",
      "priority": 30,
      "args": {
        "format": "{mounted_on} @ {capacity:.0f}%",
        "mount_ignore_pattern": "(/snap|/dev|/run|/boot|/sys/fs)",
        "show_when_used_over_percent": {
          "/": 20,
        },
        "critical_threshold": 40
      }
    }
  ]
}
}

(Other plug-ins featured in the screenshot, like uptime, are not shown.)

Getting Started

System requirements:

  • Linux (macOS support is only partial)
  • Python 3.8+
  • Powerline set up and in use (code only tested in tmux, but other places like vim should work to)

Installation steps:

  1. Install the Python package: pip install powerline-diskspace.
  2. Update your powerline (not tmux!) config following the example above.
  3. Restart the Powerline daemon: powerline-daemon --replace

If you have any questions or encounter issues setting up, please don't hesitate to open up an issue on GitHub!

Customization

There are many ways to customize your output. Please refer to the __call__ method in diskspace.py, which is essentially the "main function" of the segment for more documentation.

Development

Testing

  1. Create a test environment, e.g., with venv or conda.
  2. Ensure powerline-status and pytest are installed in your test environment.
  3. Run pytest inside the powerline_diskspace folder.

Deployment

  1. Read the official guide to refresh your memory, if needed.
  2. pip install --upgrade build twine
  3. python3 -m build
  4. python3 -m twine upload --verbose dist/*

Metadata

Release files for powerline-diskspace 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for powerline-diskspace 0.1.3
File Size Uploaded
powerline_diskspace-0.1.3.tar.gz 20.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for powerline-diskspace 0.1.3
File Interpreter ABI Platform
powerline_diskspace-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 28.1 kB

Release files / powerline_diskspace-0.1.3.tar.gz

Download URL powerline_diskspace-0.1.3.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c879cfa3115aba8b0f52a148fcf0b94d7ee61134105b4a00f7ce706d6f9d49e
BLAKE2b-256 checksum
How to use checksums
4ea3bc8f06db6e0c225abda080d4489799c768f28558e60a09cc24c90a33fabe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2025.

Transparency log

Release files / powerline_diskspace-0.1.3-py3-none-any.whl

Download URL powerline_diskspace-0.1.3-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3cdc7de11e978de4b3e04a3b53458f46487cb2bfab076d6b8ac923fb492aa27
BLAKE2b-256 checksum
How to use checksums
388ed895f3abd82e1217da7c326f1bb53e529e3c23120242acd3bc98ffd07c75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page