arnaucube
arnaucube/configsPublic Self-hosted repository
configs/sway/status.sh
sway/status.shRaw
 1# sway config at ~/.config/sway/config calls this script, through line:
 2#     status_command while ~/.config/sway/status.sh; do sleep 1; done
 3# Changes should be applied when saving this script, if not, use
 4# "killall swaybar" and $mod+Shift+c to reload the configuration.
 5
 6uptime_formatted=$(uptime | cut -d ',' -f1  | cut -d ' ' -f4,5)
 7
 8# date and time format: Tue 2025-08-19 22:37
 9date_formatted=$(date "+%a %F %H:%M")
10
11volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}')
12muted=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
13# if [ "$MUTED" = "yes" ]; then // TODO
14#     echo "πŸ”‡ Muted"
15# else
16#     echo "πŸ”Š $VOLUME"
17# fi
18
19battery_status=$(cat /sys/class/power_supply/BAT0/status) # "Full", "Discharging", or "Charging"
20battery_capacity=$(cat /sys/class/power_supply/BAT0/capacity) # %
21
22# πŸ’Ž πŸ’» πŸ’‘ πŸ”Œ ⚑ πŸ“ \| 🐧
23echo $uptime_formatted ↑ $volume $muted πŸ”Š $battery_status $battery_capacity% πŸ”‹ $date_formatted