Add battery percent to sway

This commit is contained in:
James Grogan 2024-09-28 17:36:24 +01:00
parent 5ee3726a9e
commit 9688f5c7a3
2 changed files with 6 additions and 1 deletions

View file

@ -212,7 +212,7 @@ bar {
# When the status_command prints a new line to stdout, swaybar updates. # When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time. # The default just shows the current date and time.
status_command while date +'%Y-%m-%d %X'; do sleep 1; done status_command while ~/.config/sway/status.sh; do sleep 1; done
colors { colors {
statusline #ffffff statusline #ffffff

5
sway/.config/sway/status.sh Executable file
View file

@ -0,0 +1,5 @@
date_formatted=$(date "+%a %F %H:%M")
battery_status=$(cat /sys/class/power_supply/BAT1/capacity)
echo $battery_status'% -' $date_formatted