From 13334176f5011bd2bc1f3db8192d88095a762f6b Mon Sep 17 00:00:00 2001 From: cho Date: Mon, 10 Apr 2023 14:52:16 +0700 Subject: [PATCH] add sway status.sh --- home/default/.config/sway/status.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 home/default/.config/sway/status.sh diff --git a/home/default/.config/sway/status.sh b/home/default/.config/sway/status.sh new file mode 100755 index 0000000..bd33b09 --- /dev/null +++ b/home/default/.config/sway/status.sh @@ -0,0 +1,23 @@ +# 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. + +# Produces "21 days", for example +uptime_formatted=$(uptime | cut -d ',' -f1 | cut -d ' ' -f4,5) + +# 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 "+%d-%m-%Y %I:%M:%S %p") +date_formatted=$(date "+%Y-%m-%d %H:%M %p") + +# Returns the battery status: "Full", "Discharging", or "Charging". +battery_status=$(cat /sys/class/power_supply/BAT0/status) + +# Returns the battery capacity: n% +battery_capacity="$(cat /sys/class/power_supply/BAT0/capacity)%" +# Volume +vol="$(pamixer --get-volume)" + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" + +echo $uptime vol-"$vol%" \| $date_formatted \| mail-$unread