Created
May 17, 2020 12:38
-
-
Save fbrinker/f109426ca5035fa03fc2930c4c8f5478 to your computer and use it in GitHub Desktop.
Sync pamixer with playerctl volume
This file contains hidden or 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 | |
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