dotfiles/.local/bin/print-status

32 lines
1 KiB
Bash
Executable file

#! /usr/bin/sh
today=$(date +'%Y-%m-%d')
now=$(date +'%H:%M:%S')
audio_mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
audio_volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n 1 | tr -d %)
audio_symbol="❔"
if [ "${audio_mute}" = "yes" ]; then
audio_symbol="🔇"
elif [ "${audio_mute}" = "no" ]; then
if [ "${audio_volume}" = "0" ]; then
audio_symbol="🔈"
elif [ "${audio_volume}" -lt 50 ]; then
audio_symbol="🔉"
else
audio_symbol="🔊"
fi
fi
battery=$(cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/capacity)
battery_state=$(cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0/status)
battery_symbol="❔"
if [ "${battery_state}" = "Charging" ]; then
battery_symbol="🗲"
elif [ "${battery_state}" = "Discharging" ]; then
battery_symbol="🔋"
fi
weather=$(cat /tmp/weather-report.txt)
echo ${weather} 📆${today}${now} ${audio_symbol}${audio_volume}% ${battery_symbol}${battery}%