Skip to content

Instantly share code, notes, and snippets.

@fbrinker
Created May 17, 2020 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbrinker/f109426ca5035fa03fc2930c4c8f5478 to your computer and use it in GitHub Desktop.
Save fbrinker/f109426ca5035fa03fc2930c4c8f5478 to your computer and use it in GitHub Desktop.
Sync pamixer with playerctl volume
#!/bin/bash
function up() {
pamixer -i 10
sync
}
function down() {
pamixer -d 10
sync
}
function sync() {
if [ $(playerctl status) != "Stopped" ]; then
volume=$(LC_ALL=C printf "%.*f\n" 2 $(echo "scale=2; $(pamixer --get-volume) / 100.0" | bc))
playerctl volume $volume
fi
}
eval $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment