add files
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
spotify_status=$(playerctl --player=mpd status 2>/dev/null)
|
||||
|
||||
if [ "$spotify_status" == "Playing" ]; then
|
||||
playerctl --player=mpd next
|
||||
fi
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
spotify_status=$(playerctl --player=mpd status 2>/dev/null)
|
||||
|
||||
if [ "$spotify_status" == "Playing" ]; then
|
||||
playerctl --player=mpd previous
|
||||
fi
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
spotify_status=$(playerctl --player=mpd status 2>/dev/null)
|
||||
|
||||
if [ "$spotify_status" == "Playing" ]; then
|
||||
playerctl --player=mpd position $(($(playerctl --player=mpd position | awk '{print int($1)}') + 30))
|
||||
fi
|
||||
|
||||
# mpris-ctl --player Spotify seek +30
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo "Usage: ${0} up|down|mute"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STEP=0.03 # Volume change step
|
||||
|
||||
get_vol() {
|
||||
playerctl -p mpd volume
|
||||
}
|
||||
|
||||
set_vol() {
|
||||
playerctl -p mpd volume $1
|
||||
}
|
||||
|
||||
current_vol=$(get_vol)
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
new_vol=$(echo "$current_vol + $STEP" | bc)
|
||||
[[ $(echo "$new_vol > 1.0" | bc) -eq 1 ]] && new_vol=1.0
|
||||
set_vol $new_vol
|
||||
;;
|
||||
down)
|
||||
new_vol=$(echo "$current_vol - $STEP" | bc)
|
||||
[[ $(echo "$new_vol < 0.0" | bc) -eq 1 ]] && new_vol=0.0
|
||||
set_vol $new_vol
|
||||
;;
|
||||
mute)
|
||||
if [[ "$current_vol" != "0.0" ]]; then
|
||||
set_vol 0.0
|
||||
else
|
||||
set_vol 0.5 # or store last volume
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ${0} up|down|mute"
|
||||
;;
|
||||
esac
|
||||
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
# check command line arguments first
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
|
||||
echo "Usage ${0} up|down|mute"
|
||||
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $1 != "up" -a $1 != "down" -a $1 != "mute" ]; then
|
||||
|
||||
echo "Usage ${0} up|down|mute"
|
||||
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# go through each line of the sink-inputs output
|
||||
|
||||
pactl list sink-inputs | while read line; do
|
||||
|
||||
# Update current sink input id
|
||||
|
||||
[[ $line =~ ^Sink\ Input\ \#([[:digit:]]+) ]] && this_input=${BASH_REMATCH[1]}
|
||||
|
||||
# check if it is spotify
|
||||
|
||||
if [[ $line =~ "application.name = \"spotify\"" ]]; then
|
||||
|
||||
echo "Spotify is sink-input ${this_input}"
|
||||
|
||||
case $1 in
|
||||
|
||||
up)
|
||||
|
||||
pactl set-sink-input-volume ${this_input} +5%
|
||||
|
||||
;;
|
||||
|
||||
down)
|
||||
|
||||
pactl set-sink-input-volume ${this_input} -5%
|
||||
|
||||
;;
|
||||
|
||||
mute)
|
||||
|
||||
pactl set-sink-input-mute ${this_input} toggle
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
echo "Error"
|
||||
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user