Last active
October 15, 2020 09:56
-
-
Save jordanrobinson/ab0b80a79861a1ce68c2c059176cc95d to your computer and use it in GitHub Desktop.
change the volume of spotify from bash command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LANGUAGE="en_US" | |
app_name="Spotify" | |
current_sink_num= | |
sink_num_check= | |
app_name_check= | |
pactl list sink-inputs |while read line; do \ | |
sink_num_check=$(echo "$line" |sed -rn 's/^Sink Input #(.*)/\1/p') | |
if [ "$sink_num_check" != "" ]; then | |
current_sink_num="$sink_num_check" | |
else | |
app_name_check=$(echo "$line" \ | |
|sed -rn 's/application.name = "([^"]*)"/\1/p') | |
if [ "$app_name_check" = "$app_name" ]; then | |
pactl set-sink-input-volume "$current_sink_num" $1% | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment