On 2023-06-28 17:42:18, Antoine Beaupre wrote:

[...]

> The real fix here would be for Sway to send something to sd-daemon. Of
> course, the easiest way to do this would be to do a clever call to
> sd_notify() just at the right place in the Sway source code, but
> there's little chance such a patch would be merged upstream...
>
> I looked at the code, and the actual sd_notify() call is not *that*
> complex. It opens a UNIX socket and shoves a message in there,
> probably just READY=1. Surely Sway could figure out how to write to a
> socket on its own?
>
> Hell, it could even just vendor this stupid piece of code here:
>
> https://sources.debian.org/src/systemd/253-4/src/libsystemd/sd-daemon/sd-daemon.c/#L453-L602
>
> Anyway, I don't mean to troll here, but this was a really complicated
> bug to figure out and to fix for me (thanks #debian-systemd folks!),
> so I figured I would at *least* document it here somehow.
>
> The best case scenario for me is that sway gets sd_notify support. A
> working compromise could be an update to the README.Debian file or
> even better a sample sway config that has the right knobs.

Actually, it looks like Sway *already* links against libsystemd or at
least *can* link against it, if I parse the meson build files right. So
we could "just" have a patch that does indeed call sd_notify properly
without adding anything new to the dependency tree.

anarcat@angela:sway-1.7$ rg -i systemd
debian/sway.install
10:debian/config.d/50-systemd-user.conf /etc/sway/config.d/

debian/control
20:               libsystemd-dev (>= 239) | libelogind-dev (>= 239),

debian/changelog
97:  * Add a config file to set environment variables in systemd
208:   - Make build-deps libsystemd-dev and libelogind-dev alternatives
256:    Thus explicitly listing wayland-protocols and libsystemd as

meson_options.txt
11:option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 
'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus 
library')

meson.build
95:     sdbus = dependency(['libsystemd', 'libelogind'],
116:conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 
'libsystemd')

debian/config.d/50-systemd-user.conf
4:# and 
https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh
9:        dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY 
SWAYSOCK

include/swaybar/tray/tray.h
5:#if HAVE_LIBSYSTEMD
6:#include <systemd/sd-bus.h>

-- 
What this country needs is more unemployed politicians.
                        - Angela Davis

Reply via email to