diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2018-12-16 19:24:40 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2018-12-16 19:24:40 +0100 |
commit | 590e1b8feeab5949cc94dbfb7237676186fc0527 (patch) | |
tree | ea544eddf85dc10a0b6a57ef4713561c48c2e7b5 /i3blocks/i3battery.sh | |
parent | b022a45f840b0b8d12e7e6cddd0b49fd0317afa7 (diff) | |
download | scripts-590e1b8feeab5949cc94dbfb7237676186fc0527.tar.gz scripts-590e1b8feeab5949cc94dbfb7237676186fc0527.zip |
Several changes.
Diffstat (limited to 'i3blocks/i3battery.sh')
-rwxr-xr-x | i3blocks/i3battery.sh | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/i3blocks/i3battery.sh b/i3blocks/i3battery.sh index 34c461a..0db8daf 100755 --- a/i3blocks/i3battery.sh +++ b/i3blocks/i3battery.sh @@ -2,7 +2,7 @@ # Give a battery name (e.g. BAT1) as an argument. case $BLOCK_BUTTON in - 3) pgrep -x dunst >/dev/null && notify-send "<b>🔋 Battery module:</b> + 3) pgrep -x dunst >/dev/null && notify-send -t 5000 "<b>🔋 Battery module:</b> 🔋: discharging ♻: stagnant charge 🔌: charging @@ -14,24 +14,25 @@ esac capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit status=$(cat /sys/class/power_supply/"$1"/status) -#if [ "$capacity" -ge 80 ]; then -# color="#b8bb26" -#elif [ "$capacity" -ge 60 ]; then -# color="#ebdbb2" -#elif [ "$capacity" -ge 40 ]; then -# color="#fabd2f" -#elif [ "$capacity" -ge 20 ]; then -# color="#fe8019" -#else -# color="#fb4934" -# warn="❗" -#fi +if [ "$capacity" -ge 80 ]; then + color="#b8bb26" +elif [ "$capacity" -ge 60 ]; then + color="#ebdbb2" +elif [ "$capacity" -ge 40 ]; then + color="#fabd2f" +elif [ "$capacity" -ge 20 ]; then + color="#fe8019" +else + color="#fb4934" + warn="❗" +fi -[ ! "$capacity" -gt 15 ] && warn="❗" +#[ ! "$capacity" -gt 15 ] && warn="❗" [ -z $warn ] && warn="" -#[ "$status" = "Charging" ] && color="#FFF" +[ "$status" = "Charging" ] && color="#1fffaf" -printf "%s%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$warn" +#printf "%s%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$warn" +printf "<span color='%s'>%s%s%s</span>" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" echo "" |