polybar: add pipewire buffer size module

This commit is contained in:
2024-11-19 20:18:42 +02:00
parent 532f2eb9ee
commit e98ba9e7f4
2 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,18 @@
#!/bin/bash
BUFFER_SIZES=("64" "128" "256" "512" "1024" "2048" "4096")
current_buffer_size=$(pw-metadata -n settings 0 clock.force-quantum | grep -oP "value:'\K[0-9]+")
if [[ $1 == "click" ]]; then
new_buffer_size=$(echo "${BUFFER_SIZES[@]}" | tr ' ' '\n' | xmenu)
if [[ -n $new_buffer_size ]]; then
pw-metadata -n settings 0 clock.force-quantum "$new_buffer_size"
current_buffer_size=$new_buffer_size
fi
exit 0
fi
echo "$current_buffer_size"