polybar / polybar

A fast and easy-to-use status bar
https://polybar.github.io
MIT License
14.21k stars 710 forks source link

Pulseaudio module interaction causes crash #1580

Open Sporif opened 5 years ago

Sporif commented 5 years ago

Describe the issue

If pulseaudio is killed while polybar is already running any future mouse interaction with the pulseaudio module causes a crash of polybar.

To Reproduce

I can reproduce with the stock config with everything but pulseaudio and the example bar removed.

Config:

[colors]
background = #222
background-alt = #444
foreground = #dfdfdf
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40

[bar/example]
width = 100%
height = 27
radius = 6.0
fixed-center = false

background = ${colors.background}
foreground = ${colors.foreground}

line-size = 3
line-color = #f00

border-size = 4
border-color = #00000000

padding-left = 0
padding-right = 2

module-margin-left = 1
module-margin-right = 2

font-0 = misc fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = wuncon siji:pixelsize=10;1

modules-right = pulseaudio

tray-position = right
tray-padding = 2

cursor-click = pointer
cursor-scroll = ns-resize

[module/pulseaudio]
type = internal/pulseaudio

format-volume = <label-volume> <bar-volume>
label-volume = VOL %percentage%%
label-volume-foreground = ${root.foreground}

label-muted = 🔇 muted
label-muted-foreground = #666

bar-volume-width = 10
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 2
bar-volume-fill = ─
bar-volume-fill-font = 2
bar-volume-empty = ─
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}

Polybar Log

warn: No monitor specified, using "DP-2"
warn: pulseaudio: using default sink alsa_output.pci-0000_00_1f.3.analog-stereo
error: tray: Failed to put tray above 0x0c00001 in the stack (XCB_MATCH (8))
Assertion 'o' failed at pulse/operation.c:133, function pa_operation_get_state(). Aborting.
Aborted (core dumped)

Environment:

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) -render -damage -sync +composite +xkb +xrm +xcursor

Build type: RelWithDebInfo Compiler: /usr/lib/ccache/bin/c++ Compiler flags: -march=native -O2 -pipe -fstack-protector-strong -fno-plt -Wall -Wextra -Werror -Wno-noexcept-type -pedantic -pedantic-errors Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now

patrick96 commented 5 years ago

I've noticed polybar crashing from time to time when switching between ttys but was never able to reliably reproduce it. Looks like it should be easy to fix.

Lomadriel commented 4 years ago

@patrick96 This commit https://github.com/Lomadriel/polybar/commit/98fc04f7cca8866304b0ac425f57179036694929 fixes the missing part of your PR (#1590) if you want to extract the code from my PR.