Skip to content

Commit 9eeb5f8

Browse files
Add a FAQ
1 parent cd64135 commit 9eeb5f8

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,55 @@ font-Y = Font Awesome 5 Brands: pixelsize=11
207207
font-Z = Material Icons: style=Regular: pixelsize=13; 2
208208
```
209209

210+
## FAQ
211+
212+
### Can I use this with a status bar other than Polybar?
213+
214+
The only part of this script that's tied to Polybar is the color formatting.
215+
When muted, the dimmed color will probably not work. Please [let us know in this
216+
issue](https://github.com/marioortizmanero/polybar-pulseaudio-control/issues/36)
217+
if you want support for a new status bar. I'd strongly recommend you to open a
218+
PR yourself, as it should be relatively easy!
219+
220+
### Does this work with PipeWire?
221+
222+
Yes! You only need to install the pulseaudio client on your machine. On Arch
223+
Linux, that's
224+
[`pipewire-pulse`](https://archlinux.org/packages/extra/x86_64/pipewire-pulse/),
225+
for example.
226+
227+
It won't work with other audio servers like JACK, though.
228+
229+
### This script uses too much CPU
230+
231+
We use the `pactl subscribe` command to get notified of new events that may
232+
occur in order to refresh the output. However, the command often outputs *a lot*
233+
of events for a simple action, like increasing the volume. Instead of refreshing
234+
for every single line it prints, we:
235+
236+
1. Wait for one event
237+
2. Update the output first
238+
3. Continue to listen for events until a timeout ends, or until we reach a large
239+
enough number of them
240+
4. Update the output again
241+
5. Go back to step 1
242+
243+
This way, the first event will update quickly, and the following ones, which are
244+
most likely unnecessary, will be ignored until some time passes. This reduces
245+
the CPU usage, but it's not really perfect, as everyone percieves latency
246+
differently, and it depends on the use-case.
247+
248+
The timer can be configured with `--listen-timeout-secs`, which has a default
249+
value of `0.05` (50 ms). If you want less CPU usage, i.e., ignore more duplicate
250+
events, you can bump it to, for example, `0.1` (100 ms). Or for faster refreshes
251+
when performing multiple actions quickly, e.g., updating the volume with your
252+
mousewheel, you can even use a smaller value.
253+
254+
### This script feels laggy when performing multiple actions quickly
255+
256+
Please refer to the previous question, as you can fix this by setting a smaller
257+
refresh delay with `--listen-timeout-secs`.
258+
210259
## Sources
211260

212261
Part of the script and of this README's info was taken from [customlinux.blogspot.com](http://customlinux.blogspot.com/2013/02/pavolumesh-control-active-sink-volume.html), the creator. It was later adapted to fit polybar. It is also mixed with [the ArcoLinux version](https://github.com/arcolinux/arcolinux-polybar/blob/master/etc/skel/.config/polybar/scripts/pavolume.sh), which implemented the `listen` action to use less resources.

pulseaudio-control.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ OSD="no"
2222
NODE_NICKNAMES_PROP=
2323
VOLUME_STEP=2
2424
VOLUME_MAX=130
25-
LISTEN_TIMEOUT=0.1
25+
LISTEN_TIMEOUT=0.05
2626
# shellcheck disable=SC2016
2727
FORMAT='$VOL_ICON ${VOL_LEVEL}% $ICON_NODE $NODE_NICKNAME'
2828
declare -A NODE_NICKNAMES

0 commit comments

Comments
 (0)