diff --git a/batterystatus.sh b/batterystatus.sh index 21f6ed7..8e7b1e4 100755 --- a/batterystatus.sh +++ b/batterystatus.sh @@ -1,21 +1,14 @@ -#!/bin/bash +#!/bin/sh while true; do - # Get battery status - STATUS=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to full|percentage" | awk -F': +' ' + BATTERY=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to full|percentage" | awk -F': +' ' /state:/{s=$2} /time to full:/{split($2,a,",");h=int(a[1])} /percentage:/{gsub(",",".",$2);p=$2} END{if(s=="charging") printf("%dh - %.2f%%\n",h,p)} ') - - # Get current date and time DATE=$(date +'%Y-%m-%d %X') - - # Get volume of the default sink VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}') - - # Combine the output - echo "$STATUS | Volume: $VOLUME | $DATE" + echo "$VOLUME | $BATTERY | $DATE" sleep 1 done diff --git a/config b/config index 163ceae..b3f037d 100644 --- a/config +++ b/config @@ -223,7 +223,7 @@ bindsym $mod+r mode "resize" # # Read `man 5 sway-bar` for more information about this section. bar { - position top + position bottom # When the status_command prints a new line to stdout, swaybar updates. # The default just shows the current date and time.