Skip to content
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

Wait for tray #81

Closed
musjj opened this issue Aug 28, 2023 · 9 comments
Closed

Wait for tray #81

musjj opened this issue Aug 28, 2023 · 9 comments

Comments

@musjj
Copy link

musjj commented Aug 28, 2023

Is there a way to wait for the tray before erroring out? I have a service like this:

[Install]
WantedBy=tray.target

[Service]
ExecStart=/usr/bin/volctl

[Unit]
Description=Per-application volume control and OSD for Linux desktops
PartOf=tray.target

But it errors on startup because the tray is not ready yet:

Aug 28 08:36:28 $HOST volctl[1362]: PulseAudio connected
Aug 28 08:36:28 $HOST volctl[1362]: Warning: Could not embed Gtk.StatusIcon.
Aug 28 08:36:28 $HOST volctl[1362]: Fatal error: Could not create a status icon. Are you sure you have a working notification area?
Aug 28 08:36:28 $HOST volctl[1362]: pulseaudio disconnected
Aug 28 08:36:28 $HOST systemd[1324]: volctl.service: Main process exited, code=killed, status=14/ALRM
Aug 28 08:36:28 $HOST systemd[1324]: volctl.service: Failed with result 'signal'.

Other tray services does not seem to have this problem. Is there a way to handle this problem?

@raven2cz
Copy link
Contributor

This issue has surfaced approximately four weeks ago. It seems likely that the root cause may be a modification in PulseAudio, its API, or some other related library. This is noteworthy because Volctl, which has been stable for several years, hasn't undergone any changes that could explain this new problem. Unfortunately, due to time constraints, I haven't been able to investigate the cause of this unexpected behavior.

@musjj
Copy link
Author

musjj commented Aug 28, 2023

It looks like the problem is not with pulseaudio but with it failing to create a status icon. Can you clarify?

Looks like that it's an old problem: #56

As the commenter mentioned, other tray applications doesn't suffer from this problem. I wonder what do they do differently?

@raven2cz
Copy link
Contributor

A few weeks ago, something changed that affected the functionality, but not within Volctl itself. The link you provided is relevant; I'm experiencing the same issue now. As a temporary solution, I've had to adjust the initialization settings of Volctl and set a waiting time. However, this is merely a workaround and not a proper solution to the problem.

@musjj
Copy link
Author

musjj commented Aug 28, 2023

Looks like the fix is pretty simple. The culprit is this line:

self._check_embed_timeout = GLib.timeout_add(100, self._cb_gtski_check_timeout)

Removing it fixes the problem.

It tries to check if icon is embedded or not, but I'm not really sure if it's necessary. It'll automatically embed itself when the tray is ready.

I'm guessing that it's intended to check if there's a problem, but isn't there a better way? I'd assume that as long as Gtk.StatusIcon() isn't throwing any exceptions, things should work just fine.

@raven2cz
Copy link
Contributor

Nice! Try to create PR and @buzz look on it, thx!

@musjj
Copy link
Author

musjj commented Aug 30, 2023

I'm not really sure how well it works with Wayland though. What happens when statusnotifier isn't installed when volctl is launched? Will Gtk.StatusIcon fail silently or does it correctly throw an error?

@buzz
Copy link
Owner

buzz commented Sep 2, 2023

I'm not really sure how well it works with Wayland though. What happens when statusnotifier isn't installed when volctl is launched? Will Gtk.StatusIcon fail silently or does it correctly throw an error?

This issue is not related to Wayland. Check #39 instead.

@buzz
Copy link
Owner

buzz commented Sep 2, 2023

Closing this issue, as it is a dup of #56. I reopened the original issue and kindly ask to continue the discussion there.

@buzz buzz closed this as completed Sep 2, 2023
@buzz buzz added the duplicate label Sep 2, 2023
@musjj
Copy link
Author

musjj commented Sep 2, 2023

I think you misunderstood my comment. What I am asking is the impact of the change I proposed above on Wayland systems. The solution above works perfectly on X for me, but since I don't use Wayland, I can't predict what kind of impact it would have.

But it seems that volctl isn't actually supported on Wayland at all, so I guess it doesn't really matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants