From 95c5019d3e3f6bc6c8c58ee2084a28cefe885c14 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Mon, 9 May 2022 16:13:54 +0930 Subject: [PATCH] added status-bat for dwm, will use with xmonad too I think --- scripts/status-bat | 33 +++++++++++++++++++++++++++++++++ scripts/xmobar-status-vol | 2 +- scripts/xmobar-status-weather | 19 ++++++++++++++++++- 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100755 scripts/status-bat diff --git a/scripts/status-bat b/scripts/status-bat new file mode 100755 index 0000000..8f585bd --- /dev/null +++ b/scripts/status-bat @@ -0,0 +1,33 @@ +#!/bin/bash -x + +icon=" " + +current=$(acpi --battery | sed -e 's/%.*//' | sed 's/.*, //') + +state=$(acpi --battery | sed -e 's/,.*//' | sed 's/.*: //') + +if [[ "$state" == "Discharging" ]]; then + case $((current/5/4)) in + 1) + icon="" + ;; + 2) + icon="" + ;; + 3) + icon="" + ;; + 4) + icon="" + ;; + 5) + icon="" + ;; + esac +fi + +if [[ "$state" == "Not charging" ]]; then + icon="" +fi + +echo "$icon $current%" diff --git a/scripts/xmobar-status-vol b/scripts/xmobar-status-vol index 9f74c59..ea9141e 100755 --- a/scripts/xmobar-status-vol +++ b/scripts/xmobar-status-vol @@ -33,6 +33,6 @@ else color=$red icon="" # fa-volume-off f026 fi -echo "$icon $status" +echo "$icon $status" diff --git a/scripts/xmobar-status-weather b/scripts/xmobar-status-weather index fbb8550..b337e56 100755 --- a/scripts/xmobar-status-weather +++ b/scripts/xmobar-status-weather @@ -15,5 +15,22 @@ readarray -t y <<< "$weather" loc=${y[0]} temp=${y[1]} +color="" -echo -e "$loc $temp\u00b0C" +if ((temp > 30)) +then + color="#ff5555" +elif ((temp > 25)) +then + color="#ffb86c" +elif ((temp > 20)) +then + color="#f1fa8c" +elif ((temp > 10)) +then + color="#50fa7b" +else + color="#8be9fd" +fi + +echo -e "$loc $temp\u00b0C"