15 lines
635 B
Bash
15 lines
635 B
Bash
# The Sway configuration file in ~/.config/sway/config calls this script.
|
|
# You should see changes to the status bar after saving this script.
|
|
# If not, do "killall swaybar" and $mod+Shift+c to reload the configuration.
|
|
|
|
# The abbreviated weekday (e.g., "Sat"), followed by the ISO-formatted date
|
|
# like 2018-10-06 and the time (e.g., 14:01)
|
|
date_formatted=$(date "+%a %d-%m-%+4Y %H:%M")
|
|
|
|
# Returns the battery status: "Full", "Discharging", or "Charging".
|
|
battery_status=$(cat /sys/class/power_supply/BAT1/status)
|
|
battery_level=$(cat /sys/class/power_supply/BAT1/capacity)
|
|
|
|
echo "$battery_level%" $battery_status '|' $date_formatted
|
|
|