mirror of
https://github.com/szymon-jozef/superior_dotfiles.git
synced 2026-09-07 12:10:38 +02:00
very cool stuff
This commit is contained in:
34
private_dot_config/waybar/scripts/executable_mediaplayer.sh
Normal file
34
private_dot_config/waybar/scripts/executable_mediaplayer.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Użycie: $0 <nazwa_odtwarzacza>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
player="$1"
|
||||
playerctl -p "$player" metadata --format "{{status}} {{artist}} - {{title}}" --follow | while read -r line; do
|
||||
current_status=$(playerctl --player="$player" status 2>/dev/null)
|
||||
case "$current_status" in
|
||||
"Playing")
|
||||
text=""
|
||||
;;
|
||||
"Paused")
|
||||
text=""
|
||||
;;
|
||||
*)
|
||||
text=""
|
||||
;;
|
||||
esac
|
||||
tooltip=$(playerctl --player="$player" metadata --format "{{artist}} - {{title}}" 2>/dev/null)
|
||||
|
||||
tooltip=$(echo "$tooltip" | jq -R .)
|
||||
|
||||
json_text="{\"text\": \"$text\", \"tooltip\": $tooltip }"
|
||||
echo "$json_text"
|
||||
|
||||
if [[ -n "$text" ]]; then
|
||||
pkill -SIGRTMIN+1 waybar
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user