Swaybar bash script

This commit is contained in:
Felipe M 2020-12-19 19:44:57 +01:00
parent 91b00b403b
commit 455013d5c1
2 changed files with 20 additions and 2 deletions

View File

@ -218,8 +218,9 @@ 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 %l:%M:%S %p'; do sleep 1; done
#
#status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done
status_command ~/.config/sway/swaybar.sh
colors {
statusline #ffffff
background #323232

17
.config/sway/swaybar.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
function getPowerValue() {
POWER=$(cat /sys/class/power_supply/BAT0/capacity)%
echo $POWER
}
function getDate() {
echo $(date +'%Y-%m-%d %H:%M')
}
while [ True ]; do
echo "$(getPowerValue) | $(getDate)"
sleep 30
done