From 9688f5c7a3acbb92279f4a3b293457a59ee4cab9 Mon Sep 17 00:00:00 2001 From: jgrogan Date: Sat, 28 Sep 2024 17:36:24 +0100 Subject: [PATCH] Add battery percent to sway --- sway/.config/sway/config | 2 +- sway/.config/sway/status.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 sway/.config/sway/status.sh diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 3ae15d2..8bffe08 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -212,7 +212,7 @@ bar { # When the status_command prints a new line to stdout, swaybar updates. # 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 { statusline #ffffff diff --git a/sway/.config/sway/status.sh b/sway/.config/sway/status.sh new file mode 100755 index 0000000..4ad1796 --- /dev/null +++ b/sway/.config/sway/status.sh @@ -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