From 91773e2d7f212d384554661ef96430a4a2569172 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 28 Dec 2019 20:46:34 +0100 Subject: [PATCH] Extend battery for desktop pc, fix icons Signed-off-by: Knut Ahlers --- .config/i3blocks/arch-update | 2 +- .config/i3blocks/battery | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.config/i3blocks/arch-update b/.config/i3blocks/arch-update index 443dd99..fe0ae33 100755 --- a/.config/i3blocks/arch-update +++ b/.config/i3blocks/arch-update @@ -31,4 +31,4 @@ display_num="" # Requires reboot: Red (echo "${updates}" | grep -qE "^($(get_grep))") && color="#dd0000" -printf '\uf94f%s\n' "${color}" "${display_num}" +printf '\uf0ad%s\n' "${color}" "${display_num}" diff --git a/.config/i3blocks/battery b/.config/i3blocks/battery index a56d98a..851b990 100755 --- a/.config/i3blocks/battery +++ b/.config/i3blocks/battery @@ -1,6 +1,12 @@ #!/bin/bash set -euo pipefail +# Check no support for battery (likely desktop PC) +acpi -b |& grep -q 'No support' && { + printf '\uf0e7\n' + exit 0 +} || true + IFS=$'\n' ac_conn=0 @@ -26,7 +32,9 @@ done IFS=' ' if [ ${ac_conn} -eq 0 ]; then - printf '\uf58d %s\n' "${bat_cap[*]}" + # PS not connected, on battery + printf '\uf241 %s\n' "${bat_cap[*]}" else - printf '\uf740 %s\n' "${bat_cap[*]}" + # PS connected, on AC + printf '\uf376 %s\n' "${bat_cap[*]}" fi