Improved blocks

This commit is contained in:
Ashish Kumar Yadav 2020-11-23 11:42:13 +05:30
parent 6802c81903
commit ef29c7ddd5
5 changed files with 41 additions and 13 deletions

View file

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
ICON=" "
read -r capacity </sys/class/power_supply/BAT0/capacity read -r capacity </sys/class/power_supply/BAT0/capacity
echo " ${capacity}%" echo "${ICON}${capacity}%"

View file

@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
echo " $(date '+%a, %d %b')" ICON=" "
echo "${ICON}$(date '+%a, %d %b')"

View file

@ -1,12 +1,15 @@
#!/bin/sh #!/bin/sh
crit=70 ICONc=" " # icon for critical temperatures
ICONn=" " # icon for normal temperatures
crit=70 # critical temperature
read -r temp </sys/class/thermal/thermal_zone0/temp read -r temp </sys/class/thermal/thermal_zone0/temp
temp=${temp%???} temp=${temp%???}
if [ "$temp" -ge "$crit" ] ; then if [ "$temp" -ge "$crit" ] ; then
echo " ${temp}°C" echo "${ICONc}${temp}°C"
else else
echo " ${temp}°C" echo "${ICONn}${temp}°C"
fi fi

View file

@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
echo " $(date '+%H:%M')" ICON=" "
echo "${ICON}$(date '+%H:%M')"

View file

@ -1,9 +1,31 @@
#!/bin/sh #!/bin/sh
ICONhm=" " # headphone plugged in, muted
ICONhn=" " # headphone plugged in, not muted
ICONsm=" " # headphone unplugged, muted
ICONsn=" " # headphone unplugged, not muted
volstat=$(pamixer --get-mute --get-volume) pacmd list-sinks |
awk -v iconhm="$ICONhm" -v iconhn="$ICONhn" -v iconsm="$ICONsm" -v iconsn="$ICONsn" '
if "${volstat% *}" ; then /\* index: /,0 {
echo " ${volstat#* }%" if ($1 == "index:") {
else exit
echo " ${volstat#* }%" } else if ($1 == "muted:" && $2 == "yes") {
fi muted = 1
} else if ($1 == "volume:") {
volumel = $3
volumer = $10
volumelp = $5
volumerp = $12
} else if ($1 == "active" && $2 == "port:" && $3 ~ /headphones/) {
headphone = 1
}
}
END {
printf "%s", headphone ? (muted ? iconhm : iconhn) : (muted ? iconsm : iconsn)
if (volumel == volumer) {
print volumelp
} else {
printf "L%s R%s\n", volumelp, volumerp
}
}
'