diff options
author | Vasil Zlatanov <v@skozl.com> | 2019-06-24 17:09:17 +0100 |
---|---|---|
committer | Vasil Zlatanov <v@skozl.com> | 2019-06-24 17:09:17 +0100 |
commit | dd47092aa2212c0118de4014de502a0d8e673334 (patch) | |
tree | 704b0852f799861c2e12db9b95e07fdd7f446014 /Panel/lemonbar/panel_bar | |
parent | 4f474e3cf7187a0605343167f32bfcb2b8fe4e4d (diff) | |
download | dotfiles-dd47092aa2212c0118de4014de502a0d8e673334.tar.gz dotfiles-dd47092aa2212c0118de4014de502a0d8e673334.tar.bz2 dotfiles-dd47092aa2212c0118de4014de502a0d8e673334.zip |
Change lemonbar battery icon based on how much battery is left
Diffstat (limited to 'Panel/lemonbar/panel_bar')
-rwxr-xr-x | Panel/lemonbar/panel_bar | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Panel/lemonbar/panel_bar b/Panel/lemonbar/panel_bar index 64eed1d..d219ec6 100755 --- a/Panel/lemonbar/panel_bar +++ b/Panel/lemonbar/panel_bar @@ -43,17 +43,29 @@ while read -r line ; do ;; K*) # volume output - #musicvol="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_MUSIC} ${line#?} %{B-}%{F-}" + musicvol="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_MUSIC} ${line#?} %{B-}%{F-}" ;; BDischarging*) - percent=`echo ${line#?} | cut -d' ' -f2` - battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PWR} ${percent} %{B-}%{F-}"; + level=`echo ${line#?} | cut -d' ' -f2` + if [ $level -gt 90 ];then + ICON_PWR=$ICON_BAT100 + elif [ $level -gt 65 ];then + ICON_PWR=$ICON_BAT75 + elif [ $level -gt 35 ];then + ICON_PWR=$ICON_BAT50 + elif [ $level -gt 15 ];then + ICON_PWR=$ICON_BAT25 + else + ICON_PWR=$ICON_BAT0 + fi + battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PWR} ${level} %{B-}%{F-}"; ;; B*) - percent=`echo ${line#?} | cut -d' ' -f2` - battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PLUG} ${percent} %{B-}%{F-}"; + level=`echo ${line#?} | cut -d' ' -f2` + battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PLUG} ${level} %{B-}%{F-}"; + ;; @@ -112,6 +124,6 @@ while read -r line ; do # wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}" # ;; esac -# printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${essid}${signal}${volume}${musicvol}${battery}${time_infos} " - printf "%s\n" "%{l}${desktop}${wm_infos}%{r}${notification}${face}${priv}${pub}${mail}${playing}${paused}${cpu}${ram}${volume}${battery}${time_infos}" + printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${essid}${signal}${volume}${musicvol}${battery}${time_infos} " +# printf "%s\n" "%{l}${desktop}${wm_infos}%{r}${notification}${face}${priv}${pub}${mail}${playing}${paused}${cpu}${ram}${volume}${battery}${time_infos}" done |