Skip to content

feat: Adding path support for disk storage display#920

Open
Walter0697 wants to merge 1 commit into
mathoudebine:mainfrom
Walter0697:feat/disk-path-support
Open

feat: Adding path support for disk storage display#920
Walter0697 wants to merge 1 commit into
mathoudebine:mainfrom
Walter0697:feat/disk-path-support

Conversation

@Walter0697

Copy link
Copy Markdown

The current implementation only read disk storage for the root path "/'
I added support for it so that you can optionally custom define path for your theme
It is more important for me to know the mounted storage in my use case that's why I want this functionality

For the theme setting, we can have the additional PATH attribute for DISK in theme.yaml

STAT:
  DISK:
    INTERVAL: 10
    PATH: /mnt/data            # ← New optional parameter
    USED:
      RADIAL:
        SHOW: True
        X: 225
        Y: 385

@nataliapc

Copy link
Copy Markdown

Thanks for working on this feature. I tested the same sensor API changes on Linux with /home mounted on a separate filesystem, including a PyInstaller build, and the monitor correctly displayed /home usage instead of /. On this system, / was at 39% usage while /home was at 94%, so the result was easy to verify.

Would you consider making the selected path a global setting in config.yaml instead of a theme property?

config:
  DISK_PATH: "/"

library/stats.py can then keep the current behavior as a fallback:

DISK_PATH = config.CONFIG_DATA["config"].get("DISK_PATH") or "/"

This would keep the filesystem selection independent from the visual theme and avoid repeating the same path in every theme. It also seems to match the use case described in #947.

There is also a backward-compatibility issue in the current implementation: disk_theme_data['PATH'] raises KeyError for all existing themes that do not define PATH, although the PR describes it as optional. If the theme-level approach is preferred, using disk_theme_data.get("PATH") or "/" would preserve compatibility.

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.

2 participants