From f65413f0287242fa63cfa030f6cc714e350ece61 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Tue, 21 Apr 2026 01:24:40 +0100 Subject: fix(zprofile): export DISPLAY=:0 for XWayland before exec sway MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sway's XWayland is lazy — DISPLAY isn't set in sway's env until the first X client connects, which means systemctl/dbus import-environment runs too early and nothing downstream sees DISPLAY. Setting DISPLAY=:0 in zprofile before 'exec sway' ensures sway itself inherits it, and therefore so do all its child processes (terminals, scripts, systemd user services via import-environment). XWayland will spawn on demand when a client actually connects to :0. Also drop the redundant fallback from rqr now that the session-wide export covers it. --- dot_config/zsh/dot_zprofile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'dot_config/zsh/dot_zprofile') diff --git a/dot_config/zsh/dot_zprofile b/dot_config/zsh/dot_zprofile index 32b9245..3a4af62 100644 --- a/dot_config/zsh/dot_zprofile +++ b/dot_config/zsh/dot_zprofile @@ -81,6 +81,10 @@ export INPUTRC="$XDG_CONFIG_HOME/sh/inputrc" # ── Wayland ─────────────────────────────────────────────────────────────────── export XDG_CURRENT_DESKTOP=sway export MOZ_ENABLE_WAYLAND=1 +# Point X clients at sway's (lazy) XWayland socket. XWayland spawns on demand +# when the first X client connects; setting DISPLAY unconditionally avoids +# "unable to open X display" errors from tools like zbarcam. +export DISPLAY="${DISPLAY:-:0}" # ── XDG cleanup: keep $HOME tidy ───────────────────────────────────────────── # https://wiki.archlinux.org/title/XDG_Base_Directory#Partial -- cgit v1.2.3-70-g09d2