Closed ghost closed 2 years ago
The disk info comes from the script located at .config/eww/mybar/scripts/disk_info
which contains the following code:
#!/bin/sh
raw=`df -h / | grep /dev/`
case $1 in
"--used" )
value=`echo $raw | awk '{printf $3}'`
;;
"--all" )
value=`echo $raw | awk '{printf $2}'`
;;
"--free" )
value=`echo $raw | awk '{printf $4}'`
;;
* )
true
;;
esac
As you can see, I store a "raw" line with everything needed, which then I parse differently depending on the flag provided. If you wanna change which partition the script monitors you'd just need to change what line you store in raw
Notice that I use df -h /
since I wanted to monitor the only partition mounted at /
, By only using df -h
you can get a list of all partitions currently mounted on your system.
For example, this is my output for df -h
:
Filesystem Size Used Avail Use% Mounted on
dev 3.7G 0 3.7G 0% /dev
run 3.7G 9.3M 3.7G 1% /run
/dev/nvme0n1p1 173G 120G 45G 73% /
tmpfs 3.7G 51M 3.7G 2% /dev/shm
tmpfs 3.7G 7.7M 3.7G 1% /tmp
/dev/nvme0n1p6 1.1G 440K 1.1G 1% /boot/efi
tmpfs 751M 72K 751M 1% /run/user/1000
/dev/nvme0n1p4 58G 38G 21G 65% /run/media/kz87/AE68C45C68C42545
If I wanted to monitor, let's say, /dev/nvme0n1p4
(which is where I have my windows instalation) I'd change line 3 in disk_info
to:
raw=`df -h | grep /dev/nvme0n1p4`
Notice that I pipe to grep to only get the line for the partition I want.
Before change | After change |
---|---|
Not sure if my answer fully closes the issue, so I'm leaving it open just in case.
aight, closing since there was no activity in like 3 days, and I'd say my answer was sufficient. Feel free to reopen if there are still any questions about the same topic :)
on a drive with the following partitions:
the disk readout provides a fraction of the 30gb allocated to the root file system. It's probably what I want, but for curiosity, how would I configure the drive widget to read another partition?