From 0397c80da6cc74392ba9a877127b93c49f2a233b Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Wed, 28 Oct 2026 14:08:13 +0200 Subject: [PATCH] Show battery charge icon in statusbar --- .config/i3blocks/battery | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.config/i3blocks/battery b/.config/i3blocks/battery index ce88d1e..440488d 100755 --- a/.config/i3blocks/battery +++ b/.config/i3blocks/battery @@ -6,7 +6,7 @@ print_dev_status() { status=$(busctl get-property org.freedesktop.UPower $dev_path org.freedesktop.UPower.Device State | cut -d' ' -f2) charge_f=$(busctl get-property org.freedesktop.UPower $dev_path org.freedesktop.UPower.Device Percentage | cut -d' ' -f2) - echo -e "$charge_f %" + printf '%s%% ' "$charge_f" } print_dev_status '/org/freedesktop/UPower/devices/DisplayDevice' @@ -25,15 +25,18 @@ print_dev_status '/org/freedesktop/UPower/devices/DisplayDevice' #printf ' ' -#if [[ "$status" == '1' ]]; then -# printf '\uf106' -#elif [[ "$status" == '2' ]]; then -# printf '\uf107' -#elif [[ "$status" == '4' ]]; then -# printf '\uf0e7' -#else -# printf '[%s]' "$status" -#fi +if [[ "$status" == '1' ]]; then + printf '\uf106' +elif [[ "$status" == '2' ]]; then + printf '\uf107' +elif [[ "$status" == '4' ]]; then + printf '\uf0e7' +elif [[ "$status" == '5' ]]; then + printf '\uf1e6' +else + printf '[%s]' "$status" +fi +echo #printf ' '