2022-11-23 21:44:03 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
run_command() {
|
|
|
|
playerctl -p '%any,chromium,firefox' $1
|
|
|
|
sleep 0.25
|
|
|
|
}
|
|
|
|
|
|
|
|
show_info() {
|
|
|
|
info="$( playerctl -p '%any,chromium,firefox' metadata -f '"{{title}}" by "{{artist}}" from "{{album}}"')"
|
|
|
|
local count=1
|
|
|
|
while [[ $count -le 10 ]] && [[ "$info" == "$oldInfo" ]]; do
|
|
|
|
info="$(playerctl -p '%any,chromium,firefox' metadata -f '"{{title}}" by "{{artist}}" from "{{album}}"')"
|
|
|
|
((count++))
|
|
|
|
sleep 0.25
|
|
|
|
done
|
|
|
|
notify-send "$info"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
oldInfo="$(playerctl -p '%any,chromium,firefox' metadata -f '"{{title}}" by "{{artist}}" from "{{album}}"')"
|
2022-11-26 18:30:13 -05:00
|
|
|
volume="0${2}"
|
|
|
|
volume=${volume: -2}
|
2022-11-23 21:44:03 -05:00
|
|
|
case "${1}" in
|
|
|
|
"prev") run_command "previous";show_info;;
|
|
|
|
"play") run_command "play";show_info;;
|
|
|
|
"pause") run_command "play-pause";;
|
|
|
|
"stop") run_command "stop";;
|
|
|
|
"next") run_command "next";show_info;;
|
|
|
|
"shuf") run_command "shuffle toggle";;
|
|
|
|
"info") unset oldInfo;show_info;;
|
2022-11-26 18:30:13 -05:00
|
|
|
"decvol") run_command "volume 0.${volume}-";;
|
|
|
|
"incvol") run_command "volume 0.${volume}+";;
|
2022-11-23 21:44:03 -05:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|