Skip to content

Instantly share code, notes, and snippets.

@jordiclariana
Created August 3, 2020 09:09
Show Gist options
  • Save jordiclariana/16c0fa5ecae4a5c800ab6266a67fc40f to your computer and use it in GitHub Desktop.
Save jordiclariana/16c0fa5ecae4a5c800ab6266a67fc40f to your computer and use it in GitHub Desktop.
Device "nanoKONTROL2"
// Discord volume
Command controller
id=5
channel=0
remap=0:100
shell="pactl set-sink-input-volume $(pactl list | grep -E '(^Sink Input)|(media.name = \"playStream\")|(application.name = \"WEBRTC\"$)' | awk '/playStream/ {print a} {a = $0}' | cut -c 13-) $value%"
// Firefox volume
Command controller
id=5
channel=0
remap=0:100
shell="for i in $(pactl list sink-inputs | awk -v appname=Firefox '$0 ~ \"Sink Input\" {idx = substr($3,2)} $1 == \"application.name\" && $0 ~ appname {print idx}'); do pactl set-sink-input-volume $i $value%; done"
// Chrome volume
Command controller
id=5
channel=0
remap=0:100
shell="for i in $(pactl list sink-inputs | awk -v appname=Chrome '$0 ~ \"Sink Input\" {idx = substr($3,2)} $1 == \"application.name\" && $0 ~ appname {print idx}'); do pactl set-sink-input-volume $i $value%; done"
//Spotify volume
Command controller
id=6
channel=0
remap=0:100
shell="for i in $(pactl list sink-inputs | awk -v appname=spotify '$0 ~ \"Sink Input\" {idx = substr($3,2)} $1 == \"application.name\" && $0 ~ appname {print idx}'); do pactl set-sink-input-volume $i $value%; done"
//Spotify PlayPause
Command controller
id=41
channel=0
range=64:127
remap=1:0
float = true
shell="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
//Spotify Stop
Command controller
id=42
channel=0
range=64:127
remap=1:0
float = true
shell="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop"
//Spotify PreviousSong
Command controller
id=43
channel=0
range=64:127
remap=1:0
float = true
shell="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"
//Spotify NextSong
Command controller
id=44
channel=0
range=64:127
remap=1:0
float = true
shell="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"
//Spotify Mute
Command controller
id=54
channel=0
remap=0:1
float = true
shell="for i in $(pactl list sink-inputs | awk -v appname=spotify '$0 ~ \"Sink Input\" {idx = substr($3,2)} $1 == \"application.name\" && $0 ~ appname {print idx}'); do pactl set-sink-input-mute $i $value; done"
//Spotify Raise
Command controller
id=70
channel=0
remap=0:1
float = false
shell=":;[ $value -eq 0 ] && action=windowminimize || action=windowactivate; xdotool $action $(xwininfo -root -tree -children | awk '$2 !~ /spotify/ && $0 ~ /spotify/ {print $1}')"
// Blue Yeti volume
Command controller
id=0
channel=0
remap=0:100
shell="pactl set-source-volume $(pactl list short sources | grep "input.*Blue" | awk '{print $1}') $value%"
// Blue Yeti mute
Command controller
id=48
channel=0
remap=0:1
float = false
shell="pactl set-source-mute $(pactl list short sources | awk '$0 ~ /input.*Blue/ {print $1}') $value"
// Built-in Microphone volume
Command controller
id=1
channel=0
remap=0:30
shell="pactl set-source-volume $(pactl list short sources | awk '$2 ~ /input\.pci-/ {print $1}') $value%"
// Built-in Microphone mute
Command controller
id=49
channel=0
remap=0:1
float = false
shell="pactl set-source-mute $(pactl list short sources | awk '$2 ~ /input\.pci-/ {print $1}') $value"
// Master volume
Command controller
id=7
channel=0
remap=0:100
shell="pactl -- set-sink-volume $(pactl list short sinks | awk '{print $1; exit}') $value%"
// Master mute
Command controller
id=55
channel=0
remap=100:0
float = false
shell="pactl set-sink-volume $(pactl list short sinks | awk '{print $1; exit}') $value%"
// Pavucontrol
Command controller
id=71
channel=0
remap=0:1
float = false
shell=":;[ $value -eq 0 ] && action='killall -q' || action=; $action pavucontrol"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment