ultrabug / py3status

py3status is an extensible i3status wrapper written in python

Home Page:https://ultrabug.github.io/py3status/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to hide unavailable disk in `diskdata` module

jdholtz opened this issue · comments

How can we help you today?
Hi. How can I hide the diskdata module when the disk is not currently mounted to the system? By default, it outputs 0.0 GB. I've messed around with the thresholds and if conditions with format, but I was not able to figure it out.

Your py3status version
py3status version 3.48 (python 3.10.9) on i3

Share your configuration
Here is my current format: format = "{free} GB free"

Additional context
I have tried doing

thresholds = [
    {"free": (0, "hidden")}
]

and many conditionals in the format. Here is one: format = [\\?if=!free {free} GB free]

commented

This module haven't been updated like other modules so typical things you tried didn't work... Also, everything is separated in their own format_ so it might be a bit backward / confusing. Something like this might work.

diskdata {
    disk = "sde"
    format = "\?if=used_percent {disk}: {used_percent}% ({total})"
    format_space = r"\?if=!value=err [\?min_length=5 {value:.1f}]"
}

Thank you! That works. The only thing is that the r has to be removed from the format_space option.