Skip to content

Instantly share code, notes, and snippets.

@kidsil
Last active February 23, 2021 15:23
Show Gist options
  • Save kidsil/cf0d48759fc8b24551a17bcb38286d71 to your computer and use it in GitHub Desktop.
Save kidsil/cf0d48759fc8b24551a17bcb38286d71 to your computer and use it in GitHub Desktop.
Script to control the Volume of a USB headset

Script to control the Volume of a USB headset, can connect to shortcuts.

sh volumeChange.sh up sh volumeChange.sh down

#!/bin/bash
operator="-"
if [ "$1" = "up" ]; then
operator="+"
fi
pactl set-sink-volume $(pactl list sinks short | grep USB_Headset | grep '^[[:digit:]]*' -o) ${operator}5%
#!/bin/bash
operator="-"
if [ "$1" = "up" ]; then
operator="+"
fi
pactl set-sink-volume $(pactl list sinks short | grep -i usb_headset | grep -P '^\d+' -o) ${operator}5%
@kidsil
Copy link
Author

kidsil commented Apr 15, 2020

Updated to perl-free version. In case there's ever a need for one.

@kidsil
Copy link
Author

kidsil commented Feb 23, 2021

Updated to support sinks with multiple digits (just a simple * after digit.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment