volctl doesn't start if notification area is not ready
volctl often does not start with my window manager at startup and I need to launch it, either through CLI or rofi. The error that I get at startup is
PulseAudio connected
Warning: Could not embed Gtk.StatusIcon.
Fatal error: Could not create a status icon. Are you sure you have a working notification area?
I'm launching volctl in my .xprofile which is then executed by my window manager with volctl &.
I ended up "fixing" the issue by increasing MAX_EMBED_ATTEMPTS to 100. Before making this change I tried to reinstall the package through AUR multiple times with no difference.
SystemInfo:
- ArchLinux w/ kernel 5.13.10
- x86
- awesomeWM v4.3
- Python 3.9
Could you provide any guidance on how I should debug this further?
I have same configuration and awesome (not 4.3, but 4.4+), but it is almost same. And it works. The problem will be in the initialization sequence. Try my settings with autorun script. The settings are in
https://github.com/raven2cz/dotfiles/blob/master/.config/awesome/autorun.sh
started from rc.lua.
@lfiolhais You're facing a race condition. The system tray icon area of your DE is not ready when volctl is started. Just delay the start of volctl by a couple seconds to make sure your system tray is properly initialized. (sleep 5 && volctl & or similar)
Hi all
@raven2cz My setup is equivalent to yours. The same problems occurs.
@buzz Ah that sucks. However, I should say that I have other tray applications starting in the same way and none display this issue. I'm not very fond of delaying my startup routine because of one application. As I said, other applications don't exhibit this problem. Since I have a solution and you have identified the problem on my end, I'll close the issue.
Thank you to both.
Referencing a new report at #81. This issue still seems to exist for some people.
The current implementation retries the status icon creation up to 5 times after a fixed delay of 100ms. This results in a max waiting time of 500ms for the notification area to be usable.
I propose extending the current mechanism with an exponential backoff, thus doubling the delay on each failure and increasing MAX_EMBED_ATTEMPTS to 6. This would result in a max waiting time of 6.7 seconds.
The consideration here is to account for the case when no GTK status icon area is available. Those would have to wait until volctl errors out as we can't know if a notification area is currently initializing or the environment simply doesn't have one.
Happy to review a PR.