-
-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(volume): Add pulseaudio backend #779
Conversation
8e469d6
to
569d409
Compare
I have not looked at the code yet, but I think it's great that polybar gets native pulse support. One thing right away: I think it would be better to have a dedicated I will try to take another look at this on the weekend and give some more feedback. |
Yeah, I think I made a mess of the build configuration there as well. Since the volume module is essentially the alsa module, I think it would be best to rename it to |
Yeah, I thought the same thing. And once we push the next major release we can remove the |
bd46147
to
5704693
Compare
Should I rename the volume module in this PR or do it separately? |
I think we leave it like it is in this PR and open a separate one, once this one is merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now tested this on my machine and it works great.
I think we should cap the volume at 100% because the user can increase the volume with the scroll wheel which can go pretty fast.
There should probably be more log messages as well.
For example warn, whenever the fallback sink is used.
Looking at modules/pulseaudio.cpp
, it seems that it shares a lot of code with the alsa module, and I think that is why you wanted them to be the same module in the first place, especially for loading the format-*
and label-*
settings and in the builder. Would it be feasible to create a sort of abstract volume module that contains all the functionality used by both modules (builder, event handler, common formatting config parameters etc), which both modules call upon?
I've added logging, a volume limit, and cleaned up some redundant volume retrieving. If an abstract module were to be built, it would only have |
ebb2d85
to
dc4ff45
Compare
Sorry for the wait on this. This is quite a big PR and I haven't had the time to review it properly. I will try to get in some thourough testing in the next few weeks. |
Have you had a chance to test this yet? |
I'm sorry, I haven't. My exams start in a week and I'm busy studying. I'll try to fit in some testing on my laptop and desktop on the weekend (nothing too thourough though) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now tested this on my laptop and desktop and everything seems to work. I also tested it with wired and usb headphones. I only tried it on arch, it could be that other distros may have problems, but I think we can merge this and then handle issues in other distros, as they come in
Breaking Changes: * `0 < label-NAME-maxlen < 3` will now throw an exception and disable the containing module, if ellipsis is enabled for that label. (#1198) Changelog: Deprecations: * `internal/volume` is now called `internal/alsa` (#967) * temperature: The `%temperature%` is deprecated in favor of `%temperature-c%`(#897) * mpd: `icon-repeatone` is deprecated in favor of `icon-single` (#1295), see #1279 Features: * feat(mpd): Add support for icon-consume (#861) * feat(bspwm): Add workspace separator (#942) * feat(i3): Add workspace separator (#938), see #929 * feat(build): Make polybar build on FreeBSD (#931, polybar/xpp#8), see #239 * feat(volume): Add pulseaudio backend (#779) * feat(script): Add %pid% token for tail commands (#934) * feat(temp): Add temperature tokens without unit (#897) * feat(memory): Add memory used/free ramp (#1038), see #1037 * feat(memory): Add swap tokens (#1018) * feat(net): Add unknown-as-up option (#1077), see #457 * feat(config): Support fractional size and offset (#972), see #953 * feat(xwindow): Add label-empty (#1136) * feat(battery): Add animation-discharging (analog to animation-charging) (#1190) * feat(config): Support pixel offset for bar size and offset values (#1224) * feat(mpd): Add `%album-artist%` token (#1263) * feat(net): Add local_ip6 token (#1239), see #1234 * feat(net): Add nl80211 support (#1009), see #277 Fixes: * fix(mpd): Wrong elapsed time when after standby (#921), see #915 * fix(config): Wrong min, maxlen when using the same token multiple times (#974), see #971 * fix(battery): use power_now correctly (#958), see #928 * fix(mpd): Crash when mpd isn't running (#983), see #979 * fix(xworkspaces): Respect 'enable-scroll' (#1002) * fix(xbacklight): Respect 'enable-scroll' (#1014) * fix(build): support xcb-proto >=1.13 (polybar/xpp#11), see #973 * fix(mpd): Respect MPD_HOST env variable (#1025), see #1007 * fix(i3): Reconnect i3 IPC socket on restart/error (#1099), see #762 * fix(cursor): Occasional crash on mouseover (#1124), see #1117 * fix(net): Mark 'not connected' on querying failure (#1171), see #1163 * fix(gcc): Fix -Wstringop-truncation warning (#1216, polybar/i3ipcpp#7), see #1215 * fix(builder): Don't truncate colors with same channels (#1217), see #1183 * fix(bspwm): Consistent behavior when scrolling through multiple desktops (#986), see #981 * fix(builder): Respect label-ellipsis option (#1198), see #1194
@NBonaparte Why do we check for the If we only checked for the library we could change the dependency in the AUR from |
You can have |
Ah, I see. But the binary is not necessary for polybar to run? |
Yeah I suppose. It would be up to the user to ensure that they actually have the binary installed. |
Provides an option to use PulseAudio instead of ALSA for the volume module, which is determined at compile time. If both are available, it will be compiled with PulseAudio by default.Provides a new PulseAudio module, including an adapter.
The only configuration option currently is
sink
, which provides the sink to be used as default (name can be found by runningpacmd list-sinks
). The backend subscribes to any changes in the PulseAudio sinks, so if the sinks change (e.g. headphones are unplugged) and the specified sink disappears, it will automatically revert to the default sink. Similarly, when the specified sink reappears, it will use it instead of the default. It seems like usually there is only one sink, so this option should be optional. The default configuration uses the default sink at all times.Currently, there is no volume cap, so it can go over 100% to an extremely high value, as supported by PulseAudio (not sure whether to limit or leave it to the user).The volume cap is set to
PA_VOLUME_UI_MAX
, which is the recommended maximum value for UIs.To-Do after merge:
internal/volume
tointernal/alsa
internal/volume