dotfiles/dotlocal/bin/print_yuck_disks_mounted

57 lines
1.7 KiB
Text
Raw Normal View History

2024-07-20 22:10:54 +02:00
#!/bin/sh
output="(box :class \"disks_box\" :orientation 'v' "
field="$(ls -l /dev/mapper/cryptdata-* 2> /dev/null| cut -d " " -f 9)
$(ls -l /dev/mapper/cryptlvm-root 2> /dev/null| cut -d " " -f 9)
$(ls -l /dev/mapper/cryptlvm-home 2> /dev/null| cut -d " " -f 9)"
all_values=""
for i in $field
do
if [ ! "${all_values}" == "" ]
then
all_values="${all_values}\n"
fi
result=$(df "$i" -h --output="target,size,used,pcent" | tail -n 1)
all_values="${all_values}${result///home\/primardj/\~}"
#echo $(df "$i" -h --output="source,size,used,pcent" | tail -n 1)
done
echo -e $all_values > /tmp/disk_opens
while read inp
do
v1="$(echo ${inp} | cut -d " " -f 1 )"
v2="$(echo ${inp} | cut -d " " -f 2 )"
v3="$(echo ${inp} | cut -d " " -f 3 )"
v4="$(echo ${inp} | cut -d " " -f 4 )"
v4="${v4/\%/}"
output="${output} (box :orientation \"h\" :halign \"fill\" :space-evenly false "
output="${output} (box :orientation \"h\" :halign \"start\" :hexpand true :space-evenly false "
output="${output} (label :class \"val_disks\" :halign \"start\" :text \"${v1:0:17}\" )"
output="${output} ) (box :orientation \"h\" :halign \"end\" :space-evenly false "
#output="${output} (label :class \"val_disks\" :halign \"end\" :text \"${v3}/${v2}\" )"
output="${output} (progress :valign \"center\" :halign \"end\" :width 25 :class \"disk_bar\" :value \"${v4}\" )"
output="${output} ))"
#output="${output} (box :orientation \"h\" (label :class \"val_label\":halign \"fill\" :text \"${inp}\" ))"
#echo $inp
done < /tmp/disk_opens
output="${output} )"
#echo -e $all_values
echo $output
#output="${output}${field})"
#echo "${output}"