Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.59k stars 705 forks source link

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

Open Anonim19992 opened 2 months ago

Anonim19992 commented 2 months ago

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",

yangyingchao commented 2 months ago

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}"
  }
}