dotfiles

Luke's GNU/Linux dotfiles for i3, vim, ranger, bash, mpd, etc.
git clone git@git.lukesmith.xyz:dotfiles
Log | Files | Refs | README | LICENSE

commit c0a2cce420c12bac04c0b04698e550edde91cf24
parent df6363a298510db27bc36723e191e31520a43386
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Mon, 16 Jul 2018 19:16:47 -0400

separate battery script with colors

Diffstat:
M.config/i3blocks/config | 4++--
M.scripts/i3battery | 26++++++++++++++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/.config/i3blocks/config b/.config/i3blocks/config @@ -47,11 +47,11 @@ interval=10 [wifi] label=📶 -#instance=wlp3s0 +instance=wlp2s0 interval=10 [battery] -command=echo $(cat /sys/class/power_supply/BAT0/status | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/❓/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g") $(cat /sys/class/power_supply/BAT0/capacity | sed -e 's/$/%/') +command=i3battery interval=5 [time] diff --git a/.scripts/i3battery b/.scripts/i3battery @@ -1,2 +1,24 @@ -#!/bin/sh -#acpi | cut -d " " -f3-5 | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g" +#!/bin/bash +NUM=$(cat /sys/class/power_supply/BAT0/capacity) +STATE=$(cat /sys/class/power_supply/BAT0/status) + +colorget() { +if [[ $NUM -ge 80 ]]; then + color="#00FF00" +elif [[ $NUM -ge 60 ]]; then + color="#FF0000" +elif [[ $NUM -ge 40 ]]; then + color="#FFF600" +elif [[ $NUM -ge 20 ]]; then + color="#FFAE00" +else + color="#FF0000" +fi ;} + +if [[ $STATE == "Charging" ]]; then + color="#ffffff" +else + colorget +fi + +echo "<span color='$color'>$(echo $STATE | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/❓/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g") $(echo $NUM | sed -e 's/$/%/')</span>"