sway: fix WAYLAND_DISPLAY to be relative
This commit is contained in:
parent
dd7b1dae5f
commit
46fe6c690b
|
@ -8,7 +8,7 @@ let
|
|||
swayLauncher = pkgs.writeShellScriptBin "sway" ''
|
||||
# delete DISPLAY-related vars from env before launch, else sway will try to connect to a remote display.
|
||||
# (consider: nested sway sessions, where sway actually has a reason to read these)
|
||||
exec env -u DISPLAY -u WAYLAND_DISPLAY "REAL_WAYLAND_DISPLAY=$WAYLAND_DISPLAY" ${configuredSway}/bin/sway 2>&1
|
||||
exec env -u DISPLAY -u WAYLAND_DISPLAY "DESIRED_WAYLAND_DISPLAY=$WAYLAND_DISPLAY" ${configuredSway}/bin/sway 2>&1
|
||||
'';
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
|
@ -214,7 +214,8 @@ in
|
|||
# TODO: ensure this is reliable? might not work across sway restarts, etc.
|
||||
env.DISPLAY = ":0";
|
||||
# docs: <https://discourse.ubuntu.com/t/environment-variables-for-wayland-hackers/12750>
|
||||
env.WAYLAND_DISPLAY = "$XDG_RUNTIME_DIR/wayland/wayland-1";
|
||||
# N.B.: gtk apps support absolute paths for this; webkit apps (e.g. geary) support only relative paths (relative to $XDG_RUNTIME_DIR)
|
||||
env.WAYLAND_DISPLAY = "wayland/wayland-1";
|
||||
|
||||
services.sway = {
|
||||
description = "sway: tiling wayland desktop environment";
|
||||
|
@ -222,11 +223,11 @@ in
|
|||
command = pkgs.writeShellScript "sway-start" ''
|
||||
# have to create these directories before launching sway so that they're available in the sandbox
|
||||
mkdir -p "$(dirname "$SWAYSOCK")"
|
||||
mkdir -p "$(dirname "$WAYLAND_DISPLAY")"
|
||||
mkdir -p "$(dirname "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY")"
|
||||
mkdir -p /tmp/.X11-unix # for Xwayland
|
||||
exec sway
|
||||
'';
|
||||
readiness.waitExists = [ "$SWAYSOCK" "$WAYLAND_DISPLAY" ];
|
||||
readiness.waitExists = [ "$SWAYSOCK" "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ];
|
||||
};
|
||||
# link the graphical-session into the default target, so sway gets auto-started
|
||||
services.graphical-session.partOf = [ "default" ];
|
||||
|
|
|
@ -237,11 +237,11 @@ output $out_moby {
|
|||
}
|
||||
|
||||
# move the wayland socket that sway implicitly created to the place which other apps expect to find it
|
||||
exec --no-startup-id mv $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY $REAL_WAYLAND_DISPLAY
|
||||
exec --no-startup-id mv $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.lock $REAL_WAYLAND_DISPLAY.lock
|
||||
exec --no-startup-id mv $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY $XDG_RUNTIME_DIR/$DESIRED_WAYLAND_DISPLAY
|
||||
exec --no-startup-id mv $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.lock $XDG_RUNTIME_DIR/$DESIRED_WAYLAND_DISPLAY.lock
|
||||
# i'm sure there's a simpler way. not certain that this actually updates the sway environment variables anyway
|
||||
# the double-$ means to set the variable at *runtime*, not at "compile-time" (so that it doesn't impact the line immediately above us
|
||||
set $$WAYLAND_DISPLAY "$(echo $REAL_WAYLAND_DISPLAY)"
|
||||
set $$WAYLAND_DISPLAY "$(echo $DESIRED_WAYLAND_DISPLAY)"
|
||||
|
||||
|
||||
# manually export PATH here, since all my user services need that, and sane-sandboxed implementation depends on it.
|
||||
|
|
Loading…
Reference in New Issue
Block a user