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

The waybar-disks module and 2 or more paths #3533

Open
Anonim19992 opened this issue Aug 20, 2024 · 1 comment
Open

The waybar-disks module and 2 or more paths #3533

Anonim19992 opened this issue Aug 20, 2024 · 1 comment

Comments

@Anonim19992
Copy link

Anonim19992 commented Aug 20, 2024

Good time of day. I switched from the x environment, where I used polibar to wayland with waybar.
In polibar, I could specify 2 or more paths (because 2 ssd (on 1 / and /boot, on the other /home) (
mount-0 = /
mount-1 = /home
)
In waybar, at the moment I have to use the following bash script:

`#! /bin/bash
#--------------------------------------------------------------------------------------------

root_free_for_person="$(df -h | grep "/$" | sed 's/ */:/g' | cut -d : -f 5 )"
home_free_for_person="$(df -h | grep "/home$" | sed 's/ */:/g' | cut -d : -f 5 )"
TEXT=$(echo "$root_free_for_person $home_free_for_person")

#Optional parameter for tooltip
root_total="$(df -h | grep "/$" | sed 's/ */:/g' | cut -d : -f 2 )"
root_used="$(df -h | grep "/$" | sed 's/ */:/g' | cut -d : -f 3 )"
root_free="$(df -h | grep "/$" | sed 's/ */:/g' | cut -d : -f 4 )"
home_total="$(df -h | grep "/home$" | sed 's/ */:/g' | cut -d : -f 2 )"
home_used="$(df -h | grep "/home$" | sed 's/ */:/g' | cut -d : -f 3 )"
home_free="$(df -h | grep "/home$" | sed 's/ */:/g' | cut -d : -f 4 )"
TOOLTIP=$(echo "Root: Total:$root_total Used:$root_used Free:$root_free \n Home: Total:$home_total Used:$home_used Free:$home_free ")

printf '{"text": "%s", "tooltip": "%s"}
' "$TEXT" "$TOOLTIP"
`

"custom/percentage_disks": { "format": " {}", "interval": 30, "exec": "~/.config/waybar/scripts/disk.bash 2> /dev/null", "return-type":"json", "hide-empty-text": true },

How can such a moment be implemented using standard waybar tools?
I've tried it
"path-01": "/",
"path-02": "/home",

  • it didn't help
@yangyingchao
Copy link
Contributor

You can add multiple waybar-disk, with "#" sign and additional id, like:

{
  "modules-right": [
    "disk",
    "disk#2"
  ],

  "disk": {
    "path": "path-1",
    "interval": 30,
    "format": "{percentage_free}% free on {path}"
  },

  "disk#2": {
    "path": "path-2",
    "interval": 30,
    "format": "{percentage_free}% free on {path}"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants