Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple disks support #224

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

smandon
Copy link

@smandon smandon commented May 14, 2023

Hi,

I made some modifications to add support for multiple disks/partitions, by adding the possibility to set multiple disks in the stats section of the theme.yaml, each referenced by its mount point (e.g. drive letter on windows).

Unfortunately, it forces changes to the theme.yaml format that breaks compatibility with previous versions.

I changed the sensors disk functions to add a "path" parameter that is used with psutil.disk_usage.
Stats was modified to add the mountpoint from theme.yaml in the disk functions calls. It also checks if the mount points path exists each time the stats() method is called, which for now spams the logs with a warning, maybe this could be handled better, but at least the program wouldn't crash if a disk/partition becomes unavailable or is unmounted.
The config's load_theme function had to be adapted to handle default values for disks via a seperate "default_disk.yaml" file.

All the default themes were modified accordingly, using "/" as mount point, as it was the case so far.
I think that it should work on all platforms, I tested only on windows.

Pay attention to the theme.yaml, for each disk definition there is a necessary double indent, due to a subtlety of the yaml format.

Adding support for multiple disks/partitions, by adding the possibility to set multiple disk in the stats section of the theme.yaml, each referenced by its mount point (e.g. drive letter on windows).
Unfortunately, it forces changes to the theme.yaml format that breaks compatibility with previous versions.
Removal of an unnecessary print
@mathoudebine
Copy link
Owner

Hello,
Thanks for this PR, I like the idea of being able to display multiple partitions, but I don't want to integrate breaking changes to theme.yaml format considering all the community themes people made and shared.
The best way would be to avoid removing or changing entries, if not possible the python program should at least still allow and process old theme format.

Maybe the code in stats.pycould be changed to something like this to keep compatibility :

        if config.THEME_DATA['STATS']['DISK'].get("MOUNTS", False):
            for mount in config.THEME_DATA['STATS']['DISK']['MOUNTS']:
                mountpoint = [k for k, v in mount.items()][0]
                _display_partition(mountpoint=mountpoint, theme_data=mount[mountpoint])    # A new function where you check if the mountpoint exist and then display it
        else:
            _display_partition(mountpoint="/", theme_data=config.THEME_DATA['STATS']['DISK'])

Please note I did not test this code.

@NurNano
Copy link
Contributor

NurNano commented Mar 28, 2024

I would love to have this feature and try the code out but unfortunately the code in stats.py was changed a lot in v3.4.0 and im not that good in programming to adjust the code myself.
If someone could change the code, you could count on me for testing!

@forofo
Copy link

forofo commented Jun 15, 2024

Please add this feature for Linux. This is very necessary with NAS having multiple disks. I have bought the screen for this exact purpose and I cannot find a way to show all disks. Activity and free space is necessary. And if possible adding the disks temperature it would be much better.

@forofo
Copy link

forofo commented Jun 16, 2024

I have installed this commit to have multiple disk support.
The system lacks of a graphical environment

How can I add more disks?

Inside res/themes/Terminal/theme.yaml there is this section:

  DISK:
    INTERVAL: 10
    MOUNTS:
      - "/":
          USED:
            GRAPH:
              SHOW: True
              X: 115
              Y: 357
              WIDTH: 178
              HEIGHT: 13
              MIN_VALUE: 0
              MAX_VALUE: 100
              BAR_COLOR: 255, 0, 0
              BAR_OUTLINE: False   
              BACKGROUND_COLOR: 0, 0, 0

and I need to add these:

# df -h 
/dev/sda1         58G    11G   44G  20% / 
/dev/sde1        917G   330G  588G  36% /srv/dev-disk-by-uuid-FD8DJFD5FDKSA743
/dev/sdc2        427G   153G  275G  36% /srv/dev-disk-by-uuid-01CMNFD743NFD882
/dev/sdd1        1,8T   211G  1,6T  12% /srv/dev-disk-by-uuid-ND7643JUHDSUHSAA
/dev/sdc5        427G   307G  121G  72% /srv/dev-disk-by-uuid-0AJFDS7233JJDSAs

besides the use of the graphical editor, the wiki is not very explicit about this.

Any help would be very appreciated.

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.

4 participants