aboutsummaryrefslogtreecommitdiff
path: root/home/.config/i3/status
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-11-11 14:01:55 -0800
committerJakob Odersky <jakob@odersky.com>2018-11-11 14:01:55 -0800
commit475362d7625306facdbaec36f8143464c8734d74 (patch)
tree432e0e4e6b80819c4374b014aaeedff81cd69191 /home/.config/i3/status
parent1edb20b22651718f9a1a82ec0284bd0e396679a6 (diff)
downloaddotfiles-475362d7625306facdbaec36f8143464c8734d74.tar.gz
dotfiles-475362d7625306facdbaec36f8143464c8734d74.tar.bz2
dotfiles-475362d7625306facdbaec36f8143464c8734d74.zip
Update i3 config
Diffstat (limited to 'home/.config/i3/status')
-rwxr-xr-xhome/.config/i3/status/battery13
-rwxr-xr-xhome/.config/i3/status/brightness4
-rwxr-xr-xhome/.config/i3/status/pwr11
3 files changed, 13 insertions, 15 deletions
diff --git a/home/.config/i3/status/battery b/home/.config/i3/status/battery
index 03bc740..d97fcb5 100755
--- a/home/.config/i3/status/battery
+++ b/home/.config/i3/status/battery
@@ -4,19 +4,24 @@ set -e
device="/sys/class/power_supply/BAT${BLOCK_INSTANCE:-0}"
status=$(cat "$device/status")
percent=$(cat "$device/capacity")
+energy=$(cat "$device/energy_now")
status_text=""
if [[ $status = "Discharging" ]]; then
- status_text=" (DIS)"
+ status_text=""
elif [[ $status = "Charging" ]]; then
- status_text=" (CHR)"
+ status_text=" "
fi
-echo "${percent}%${status_text}"
+printf '%i%% (%0.1fWh)%s\n' \
+ "$(( percent ))" \
+ "$(( energy ))e-6" \
+ "$status_text"
+
echo "${percent}%${status_text}"
# consider color and urgent flag only on discharge
-if [[ $status="Discharging" ]]; then
+if [[ $status = "Discharging" ]]; then
if [[ $percent -le 15 ]]; then
echo "#FF0000";
fi
diff --git a/home/.config/i3/status/brightness b/home/.config/i3/status/brightness
index 8e4bf06..1c887ad 100755
--- a/home/.config/i3/status/brightness
+++ b/home/.config/i3/status/brightness
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/bash
device="/sys/class/$BLOCK_INSTANCE"
brightness=$(cat "$device/brightness")
max_brightness=$(cat "$device/max_brightness")
-percent=$(( $brightness*100/$max_brightness ))
+percent=$(( brightness*100/max_brightness ))
echo "$percent%"
diff --git a/home/.config/i3/status/pwr b/home/.config/i3/status/pwr
index 1744a78..9363c20 100755
--- a/home/.config/i3/status/pwr
+++ b/home/.config/i3/status/pwr
@@ -4,14 +4,7 @@ power0=$(cat "/sys/class/power_supply/BAT0/power_now")
power1=$(cat "/sys/class/power_supply/BAT1/power_now")
power=$(( power0 + power1 ))
-energy0=$(cat "/sys/class/power_supply/BAT0/energy_now")
-energy1=$(cat "/sys/class/power_supply/BAT1/energy_now")
-energy=$(( energy0 + energy1 ))
-
-# [W@Wh]
-printf '%0.1f @ %0.1f\n' "$(( power ))e-6" "$(( energy ))e-6"
-
-# [mW@mWh]
-printf '%0.0fmW @ %0.0fmWh\n' "$(( power ))e-3" "$(( energy ))e-3"
+printf '%0.1fW\n' "$(( power ))e-6"
+printf '%0.1fW\n' "$(( power ))e-6"
exit 0