From c917476f21f26b00b64fe22a38a345502452df46 Mon Sep 17 00:00:00 2001 From: Ohad Livne Date: Wed, 4 Jun 2025 22:44:36 +0300 Subject: [PATCH] Move the status bar configuration to a script --- .config/sway/config | 2 +- .local/bin/print-status | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 .local/bin/print-status diff --git a/.config/sway/config b/.config/sway/config index b098bf6..7af97ff 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -251,7 +251,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 echo $(date +'%Y-%m-%d %H:%M:%S') 🔋$(cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/capacity)%; do sleep 1; done + status_command while echo $(print-status); do sleep 1; done colors { statusline #ffffff diff --git a/.local/bin/print-status b/.local/bin/print-status new file mode 100755 index 0000000..fb0e316 --- /dev/null +++ b/.local/bin/print-status @@ -0,0 +1,6 @@ +#! /usr/bin/sh + +battery=$(cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/capacity) +now=$(date +'%Y-%m-%d %H:%M:%S') + +echo ${now} 🔋${battery}%