1

I might using the wrong search terms, thus I'm asking for this here:

How can I have modify my modeline to display my remaining disk space?

Currently I have to open a terminal in order to enter:

$ df -H --output=avail /dev/mapper/Arch-root | tail -n 1

results in 32G

3

There is the function free-disk-space since Emacs 27. Modify your modeline to insert (get-free-disk-space default-directory).

There are many ways to add information to the mode line. Do C-h i g(elisp)mode line format for all the gory details. And be prepared for some head scratching.

Here's an example if you want to add this information at the end of the mode line:

(add-to-list 'global-mode-string (list " " '(:eval (get-free-disk-space default-directory))) t)

This works even on remote directories.

3
  • Thank you. How do I modify the modeline
    – jjk
    Oct 24 at 12:53
  • Here's an example if you want to add this information at the end of the mode line: (add-to-list 'global-mode-string (list " " '(:eval (get-free-disk-space default-directory))) t) Oct 24 at 16:22
  • Added the comments to the answer to make it self-contained.
    – NickD
    Oct 24 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.