config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 8a5075227308e596e03a8c4a9ca820a2ff75f6af
parent cbc20054d62f9172b1cd9d02dda89905127a43f3
Author: jacobsGit <JacobDoesLinux@protonmail.com>
Date:   Thu,  2 Jan 2020 23:42:04 -0800

rewrote entierly using previous as refrence

Diffstat:
Mxmobar/.xmobar/xmb-battery | 80+++++++++++++++++++++++++++++++------------------------------------------------
1 file changed, 31 insertions(+), 49 deletions(-)

diff --git a/xmobar/.xmobar/xmb-battery b/xmobar/.xmobar/xmb-battery @@ -1,71 +1,53 @@ #!/bin/sh -# 2019 - Jacob Edwards -# -# Made for xmobar because batteryP -O option would not work - -suspendAt=10 # percent -suspendDelay=130 # in seconds - -batteryPrefix='' -batterySuffix='<fc=#666666>%%</fc>' -batteryColor='aa0000' - -poweredPrefix='' -poweredSuffix='<fc=#666666>%%</fc>' -poweredColor='123478' - -fullColor='1a1a1a' -fullSuffix='<fc=#1a1a1a>%%</fc>' -fullPrefix='' +suspendThreshold='10' +suspendDelay='130' +prefixF='<fc=#1a1a1a>' +suffixF='%%</fc>' +prefixC='<fc=#123478>' +suffixC='</fc><fc=#666666>%%</fc>' +prefixD='<fc=#aa0000>' +suffixD='</fc><fc=#666666>%%</fc>' +status="$(acpi -a | awk '{print $3}')" +charge="$(acpi -b | cut -d '%' -f 1 | rev | awk '{print $1}' | rev )" -status="$(acpi -a | awk '{print $3}')" -percentage="$(acpi -b | cut -d '%' -f 1 | rev | awk '{print $1}' | rev )" if [[ "$status" = 'on-line' ]] && [[ "$percentage" -ge '100' ]]; then - statusPrefix="$fullPrefix" - suffix="$fullSuffix" - color="<fc=#$fullColor>" - + prefix="$prefixF" + suffix="$suffixF" elif [[ "$status" = 'on-line' ]]; then - statusPrefix="$poweredPrefix" - suffix="$poweredSuffix" - color="<fc=#$poweredColor>" - + prefix="$prefixC" + suffix="$suffixC" elif [[ "$status" = 'off-line' ]]; then - statusPrefix="$batteryPrefix" - suffix="$batterySuffix" - color="<fc=#$batteryColor>" + prefix="$prefixD" + suffix="$suffixD" fi +if [[ "$charge" -le "$suspendThreshold" ]] && [[ "$status" = 'off-line' ]]; then + brightness="$(xbacklight -get)" + + xbacklight -set 0 -time 0 + notify-send " suspending in $suspendDelay seconds due to low battery " -i null + xbacklight -set "$brightness" -time 120 -if [[ "$percentage" -le "$suspendAt" ]] && [[ "$status" = 'off-line' ]]; then - brightness="$(xbacklight -get)" - xbacklight -set 0 -time 0 - - notify-send " suspending in $suspendDelay seconds due to low battery " - xbacklight -set "$brightness" -time 120 + sleep "$suspendDelay" + status="$(acpi -a | awk '{print $3}')" - sleep "$suspendDelay" + if [[ "$charge" -le "$suspendThreshold" ]] && [[ "$status" = 'off-line' ]]; then + suspend-warning 0 10 -n status="$(acpi -a | awk '{print $3}')" - - if [[ "$percentage" -le "$suspendAt" ]] && [[ "$status" = 'off-line' ]]; then - suspend-warning 0 10 -n - - status="$(acpi -a | awk '{print $3}')" - - if [[ "$percentage" -le "$suspendAt" ]] && [[ "$status" = 'off-line' ]]; then - systemctl suspend - fi + + if [[ "$charge" -le "$suspendThreshold" ]] && [[ "$status" = 'off-line' ]]; then + systemctl suspend fi fi +fi - -printf "<fc=#5f5f5f>$statusPrefix</fc> $color$percentage</fc>$suffix" +printf "$prefix$charge$suffix"