#1027069 waybar: improve its .service file?

Package:
waybar
Source:
waybar
Description:
Highly customizable Wayland bar for Sway and Wlroots based compositors
Submitter:
Patrice Duroux
Date:
2023-10-20 09:51:03 UTC
Severity:
normal
#1027069#5
Date:
2022-12-27 14:14:44 UTC
From:
To:
Dear Maintainer,

Could it be possible by improving the .service file to not start its service
when the graphical session is not a sway/wlroots based one?

It would avoid to have multiple messages like the following:
déc. 27 14:40:08 kos-moceratops systemd[2258]: waybar.service: Scheduled
restart job, restart counter is at 4.
déc. 27 14:40:08 kos-moceratops systemd[2258]: Stopped Highly customizable
Wayland bar for Sway and Wlroots based compositors..
déc. 27 14:40:08 kos-moceratops systemd[2258]: Started Highly customizable
Wayland bar for Sway and Wlroots based compositors..
déc. 27 14:40:08 kos-moceratops waybar[3656]: [2022-12-27 14:40:08.898] [info]
Using configuration file /etc/xdg/waybar/config
déc. 27 14:40:08 kos-moceratops waybar[3656]: [2022-12-27 14:40:08.898] [info]
Using CSS file /etc/xdg/waybar/style.css
déc. 27 14:40:08 kos-moceratops waybar[3656]: [2022-12-27 14:40:08.903] [error]
Failed to acquire required resources.
déc. 27 14:40:08 kos-moceratops systemd[2258]: waybar.service: Main process
exited, code=exited, status=1/FAILURE
déc. 27 14:40:08 kos-moceratops systemd[2258]: waybar.service: Failed with
result 'exit-code'.
déc. 27 14:40:09 kos-moceratops systemd[2258]: waybar.service: Scheduled
restart job, restart counter is at 5.
déc. 27 14:40:09 kos-moceratops systemd[2258]: Stopped Highly customizable
Wayland bar for Sway and Wlroots based compositors..
déc. 27 14:40:09 kos-moceratops systemd[2258]: waybar.service: Start request
repeated too quickly.
déc. 27 14:40:09 kos-moceratops systemd[2258]: waybar.service: Failed with
result 'exit-code'.
déc. 27 14:40:09 kos-moceratops systemd[2258]: Failed to start Highly
customizable Wayland bar for Sway and Wlroots based compositors..

And so 'systemctl --user status' reports 'State: degraded' probably due to
that.

I know that I can mask it in my own graphical session (GNOME).

Lastly, I don't know if this could be possible because I did not check how
other desktop session .service files
deal to avoid such cross-desktop "pollution". Or if it's really useful.

Regards,
Patrice

#1027069#10
Date:
2023-01-02 11:34:09 UTC
From:
To:
Hi,

I asked in the wlroots IRC channel and got the information that it is
not possible to find out if a program is starting in a wlroots based
compositor. I thought maybe an environment variable that usable with
systemd's `ConditionEnvironment` could exist, but apparently thats not
the case.
But I'm open to suggestions how to fix that.

cheers,
Birger

#1027069#15
Date:
2023-01-02 13:49:38 UTC
From:
To:
Hi,

The error is triggered by

```
 wl_display_roundtrip(wl_display);
  if (layer_shell == nullptr || xdg_output_manager == nullptr) {
    throw std::runtime_error("Failed to acquire required resources.");
  }
```

so

    weston-info 2>/dev/null | grep -E "interface: 'zwlr_layer_shell"

should get you pretty close. This will break once waybar switches to
ext-layer-shell so maybe

    weston-info 2>/dev/null | grep -E "interface: 'z(wlr|ext)_layer_shell"

works better.

Cheers,
 -- Guido

#1027069#20
Date:
2023-01-02 14:14:45 UTC
From:
To:
Hi,
[...]

Ah, thats nice! I also thought of simply writing a
`am_i_in_a_wlroots_compositor` program, but I fail to find out how I
would use that in a systemd service file so that the service does not
try to restart if the condition is not met.

cheers,
Birger

#1027069#25
Date:
2023-01-02 14:59:50 UTC
From:
To:
Hi,

Is there nothing to propose in the line of freedesktop.org?
(based for instance on any XDG_CURRENT_DESKTOP or DESKTOP_SESSION envvar)
I am not aware about how weston/sway based desktops are currently
integrated with the others (GNOME, KDE, etc).
Does-it exist a Debian team that would coordinate and may have
suggestions / recommendations for that?

Note also that using sid:
$ weston-info

*** Please use wayland-info instead
*** weston-info is deprecated and will be removed in a future version
<cut>

And I think that wayland-info is part of wayland-utils(1) that is not
yet packaged, isn't it?

Many thanks,
Patrice

(1) https://wayland.freedesktop.org/releases.html

Le lun. 2 janv. 2023 à 15:14, Birger Schacht <birger@debian.org> a écrit :

#1027069#30
Date:
2023-10-20 09:39:56 UTC
From:
To:
Note that in Trixie/Sid, `weston-info` is no longer available as it has been
removed from the `weston` package.
The `wayland-utils` package with the `wayland-info` package is available since
Bookworm (looks like they were just in time).