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