alex-courtis / way-displays

way-displays: Auto Manage Your Wayland Displays
MIT License
253 stars 13 forks source link

Spurious error: XDG_RUNTIME_DIR not set in the environment. ? #24

Closed alex-courtis closed 2 years ago

alex-courtis commented 2 years ago

Don't display that, just fall back silently to /tmp

Possibly not working properly on FreeBSD

alex-courtis commented 2 years ago

Generated by wl_display_connect, not the socket creation.

Test using a running sway instance on FreeBSD if time permits, to see how (if?) XDG_RUNTIME_DIR is used.

alex-courtis commented 2 years ago

@jbeich have you successfully started way-displays in a wayland compositor?

I'm not sure if FreeBSD uses XDG_RUNTIME_DIR and it would be good to know if it and wayland successfully fall back to /tmp

jbeich commented 2 years ago

@jbeich have you successfully started way-displays in a wayland compositor?

Yes, at least auto-scaling works fine under Sway.

I'm not sure if FreeBSD uses XDG_RUNTIME_DIR and it would be good to know if it and wayland successfully fall back to /tmp

$ pkg info -D wayland
wayland-1.20.0:
On install:
Wayland requires XDG_RUNTIME_DIR to be defined to a path that will
contain "wayland-%d" unix(4) sockets. This is usually handled by
consolekit2 (via ck-launch-session) or pam_xdg (via login).

# pkg install pam_xdg
# echo 'session optional pam_xdg.so notroot runtime' >>/etc/pam.d/system
$ exit # re-login non-root users to get XDG_RUNTIME_DIR 

If you care/need DBus there's also

$ cat /etc/profile
# WARNING: zsh only reads /etc/zprofile, so make sure to symlink
# XDG_RUNTIME_DIR is preferred but usually requires pam_xdg or consolekit2 (pam_ck_connector or ck_launch_session)
if [ -n "$XDG_RUNTIME_DIR" ]; then
    if ! pgrep -qf -U ${USER:-$(id -u)} dbus.\*--session; then
        dbus-daemon --session --fork --address=unix:runtime=yes 2>/dev/null
    # Only necessary for some apps that fail to find default session bus (e.g., Emacs, Chrome)
    # https://gitlab.freedesktop.org/dbus/dbus/-/commit/e3f117e7610b
    export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
    fi
else
    eval $(dbus-launch --sh-syntax --exit-with-session 2>/dev/null)
fi
alex-courtis commented 2 years ago

That is good to hear, thank you.

Sockets were my concern, and it seems that wayland has ensured a solution that all the wayland things can use.

Many thanks for all your help on this: I've learned a lot and way-displays is much healthier.