dracula / dracula/tmux

Bug: Doesn't detect AMD GPUs

Open
#218 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
856
Forks
368
Avg merge
2m
Merged PRs (30d)
1

Description

### Describe the bug
The status plugin for GPU usage doesn't process AMD and intel GPUs

### To Reproduce
Steps to reproduce the behavior:
1. Have something other than an Nvidia GPU
2. Add `gpu-usage` to `@dracula-plugins`
3. See 'unknown' in the GPU block

### Expected behavior
It should report any GPU usage.

### System
- OS: Arch Linux
- Tmux Version: 3.3a

### Possible fix:
Change `gpu_usage.sh` [line 32](https://github.com/dracula/tmux/blob/79068c40b39351f683494e6afbf3ccd6bb6fb086/scripts/gpu_usage.sh#L32) from...
```
usage='unknown'
```
...to something along the lines of...
```
usage=$(cat /sys/class/drm/card?/device/gpu_busy_percent | sed -z -e 's/\n/%\//g' -e 's/\/$//g')
```
...which can handle one or more GPUs of any type?

Same fixes can be used for `gpu_ram_info.sh`:
```
usage=$(cat /sys/class/drm/card?/device/mem_info_vram_used /sys/class/drm/card?/device/mem_info_vram_total | cat /sys/class/drm/card?/device/mem_info_vram_used /sys/class/drm/card?/device/mem_info_vram_total | numfmt --to=iec-i --suffix=B | sed -z -e 's#\n#/#g' -e 's#/$##g'
```
...and `gpu_power.sh`:
```
usage=$(echo "$(($(cat /sys/class/drm/card0/device/hwmon/hwmon2/power1_average) / 1000 / 1000))W/$(($(cat /sys/class/drm/card0/device/hwmon/hwmon2/power1_cap_max) / 1000 / 1000))W")
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.