-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus_script.sh
More file actions
executable file
·22 lines (20 loc) · 1.13 KB
/
status_script.sh
File metadata and controls
executable file
·22 lines (20 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
while true; do
media_status=$(playerctl metadata --format "{{ artist }} - {{title }}" || echo "No media playing")
active_sink=$(pactl list short sinks | grep RUNNING | cut -f1)
# If no running sink is found, fallback to the default
if [ -z "$active_sink" ]; then
active_sink=$(pactl info | grep 'Default Sink' | cut -d: -f2 | xargs)
fi
# Get the description of the active sink
sink_description=$(pactl list sinks | awk -v sink="$active_sink" '
/^Sink #/ {is_target = $2 == "#"sink}
/Description:/ && is_target {gsub(/^.*Description: /, ""); print; exit}')
pactl set-default-sink $active_sink
freespace=$(df "$HOME" --output=pcent | cut -d: -f2 | xargs)
current_time=$(date +"%Y-%m-%d %X")
volumeSpeakers=$(pactl get-sink-volume "$active_sink" | awk -F '/' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//')
keyboardInput=$(swaymsg -t get_inputs | jq -r '[.[] | select(.type=="keyboard") | .xkb_active_layout_name][0]')
echo "$(cat /tmp/wttr_cache) | $sink_description 🔊 $volumeSpeakers | ⌨️ $keyboardInput | 💾 $freespace | $current_time"
sleep 0.1
done