towards new whatever!
This commit is contained in:
parent
99c1e1bf79
commit
11f963804e
10
config
10
config
@ -9,8 +9,8 @@ interval=5
|
||||
label=☼
|
||||
# label=☀,☼,✱,✲,✳,✴,✵,✺
|
||||
signal=3
|
||||
instance=color
|
||||
# instance=color,long
|
||||
instance=color,long
|
||||
# instance=color,bw,long
|
||||
|
||||
# [iface]
|
||||
# label=iface
|
||||
@ -18,7 +18,7 @@ instance=color
|
||||
[storage]
|
||||
label=⛁
|
||||
# label=⛀,⛁,⛂,⛃
|
||||
interval=60
|
||||
# interval=60
|
||||
|
||||
# if you want to display ram and swap seperately, you can assign another [ram] module
|
||||
# with instance=ram or instance=swap
|
||||
@ -31,13 +31,13 @@ instance=ram
|
||||
|
||||
[cpu]
|
||||
label=☷
|
||||
instance=long
|
||||
# instance=long
|
||||
interval=2
|
||||
|
||||
[temp]
|
||||
label=ϑ
|
||||
interval=2
|
||||
instance=long
|
||||
# instance=long
|
||||
|
||||
[ip]
|
||||
# label=ip
|
||||
|
@ -1,52 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR="/sys/class/backlight"
|
||||
|
||||
[[ "$BLOCK_INSTANCE" =~ "color" ]] && MODE="color" || MODE="bw"
|
||||
[[ "$BLOCK_INSTANCE" =~ "long" || "$BLOCK_BUTTON" == 1 ]] && LONG=true
|
||||
[[ "$BLOCK_INSTANCE" =~ "color" ]] && COLORS=True
|
||||
[[ "$BLOCK_INSTANCE" =~ "long" || "$BLOCK_BUTTON" == 1 ]] && LONG=True
|
||||
|
||||
if [[ -d "$DIR/acpi_video0" ]]; then
|
||||
DIR="$DIR/acpi_video0"
|
||||
elif [[ -d "$DIR/intel_backlight" ]]; then
|
||||
DIR="$DIR/intel_backlight"
|
||||
else
|
||||
echo " no backlight "
|
||||
echo "n/a"
|
||||
printf "no backlight\nn/a\n"
|
||||
exit 33
|
||||
fi
|
||||
|
||||
cat "$DIR/brightness" "$DIR/max_brightness" | gawk -v MODE="$MODE" -v LONG="$LONG" '
|
||||
BAR=("▁" "▂" "▃" "▄" "▅" "▆" "▇" "█")
|
||||
COLOR=("#64bc01" "#77a601" "#8a9101" "#9d7b00" "#b06701" "#c45100" "#d63c00" "#e92700")
|
||||
BW=("#565656" "#6d6d6d" "#848485" "#9c9c9c" "#b1b1b1" "#c7c7c7" "#dcdcdc" "#f5f5f6")
|
||||
|
||||
cat "$DIR/brightness" "$DIR/max_brightness" | gawk -v BAR="${BAR[*]}" -v COLOR="${COLOR[*]}" -v BW="${BW[*]}" -v COLORS="$COLORS" -v LONG="$LONG" '
|
||||
|
||||
BEGIN {
|
||||
bar[1] = "▁"; color[1] = "#64bc01"; bw[1] = "#565656"
|
||||
bar[2] = "▂"; color[2] = "#77a601"; bw[2] = "#6d6d6d"
|
||||
bar[3] = "▃"; color[3] = "#8a9101"; bw[3] = "#848485"
|
||||
bar[4] = "▄"; color[4] = "#9d7b00"; bw[4] = "#9c9c9c"
|
||||
bar[5] = "▅"; color[5] = "#b06701"; bw[5] = "#b1b1b1"
|
||||
bar[6] = "▆"; color[6] = "#c45100"; bw[6] = "#c7c7c7"
|
||||
bar[7] = "▇"; color[7] = "#d63c00"; bw[7] = "#dcdcdc"
|
||||
bar[8] = "█"; color[8] = "#e92700"; bw[8] = "#f5f5f6"
|
||||
step = 100 / length(bar)
|
||||
split(BAR, bar, / /)
|
||||
split(COLOR, color, / /)
|
||||
split(BW, bw, / /)
|
||||
interval = 100 / length(bar)
|
||||
}
|
||||
|
||||
NR==1 { cbr = $1 }
|
||||
NR==2 { mbr = $1 }
|
||||
NR == 1 { current_brightness = $1 }
|
||||
NR == 2 { maximum_brightness = $1 }
|
||||
|
||||
END {
|
||||
load = ( cbr / mbr ) * 100
|
||||
if (LONG == "true") {
|
||||
printf("%d%\n%d\n", load, load)
|
||||
brightness = ( current_brightness / maximum_brightness ) * 100
|
||||
if (LONG) {
|
||||
printf("%d%\n%d\n", brightness, brightness)
|
||||
} else {
|
||||
for (i in bar) {
|
||||
if (load <= i * step) {
|
||||
if (brightness <= i * interval) {
|
||||
printf("%s\n%s\n", bar[i], bar[i])
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i in color) {
|
||||
if (load <= i * step) {
|
||||
if (MODE == "color") {
|
||||
for (i in bw) {
|
||||
if (brightness <= i * interval) {
|
||||
if (COLORS) {
|
||||
printf("%s\n", color[i])
|
||||
} else {
|
||||
printf("%s\n", bw[i])
|
||||
|
Reference in New Issue
Block a user