sway: simplify wrapper
This commit is contained in:
parent
48b2280f2e
commit
dcdf58e1ab
|
@ -5,21 +5,11 @@
|
|||
let
|
||||
cfg = config.sane.programs.sway;
|
||||
wrapSway = configuredSway: let
|
||||
# `wrapSway` exists to launch sway with our desired debugging facilities.
|
||||
# i.e. redirect output to syslog.
|
||||
systemd-cat = "${lib.getBin pkgs.systemd}/bin/systemd-cat";
|
||||
swayLauncher = pkgs.writeShellScriptBin "sway" ''
|
||||
# sway defaults to auto-generating a unix domain socket named "sway-ipc.$UID.NNNN.sock",
|
||||
# which allows for multiple sway sessions under the same user.
|
||||
# but the unpredictability makes static sandboxing & such difficult, so hardcode it:
|
||||
export SWAYSOCK="$XDG_RUNTIME_DIR/sway-ipc.sock"
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
|
||||
echo "launching sway (sway.desktop)..." | ${systemd-cat} --identifier=sway
|
||||
echo "launching sway (sway.desktop)..." | tee /dev/stderr
|
||||
# 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 \
|
||||
${configuredSway}/bin/sway 2>&1 | ${systemd-cat} --identifier=sway
|
||||
exec env -u DISPLAY -u WAYLAND_DISPLAY ${configuredSway}/bin/sway 2>&1
|
||||
'';
|
||||
in
|
||||
pkgs.symlinkJoin {
|
||||
|
@ -197,6 +187,7 @@ in
|
|||
# this way `swaymsg -- reload` can work even if the fd for ~/.config/sway/config changes.
|
||||
".config/sway"
|
||||
".config/s6"
|
||||
".local/state/s6" #< TODO: remove?
|
||||
];
|
||||
sandbox.extraConfig = [
|
||||
"--sane-sandbox-keep-namespace" "pid"
|
||||
|
@ -222,8 +213,10 @@ in
|
|||
};
|
||||
|
||||
env.XDG_CURRENT_DESKTOP = "sway";
|
||||
# TODO: don't hardcode user id!
|
||||
env.SWAYSOCK = "/run/user/1000/sway-ipc.sock";
|
||||
# sway defaults to auto-generating a unix domain socket named "sway-ipc.$UID.NNNN.sock",
|
||||
# which allows for multiple sway sessions under the same user.
|
||||
# but the unpredictability makes static sandboxing & such difficult, so hardcode it:
|
||||
env.SWAYSOCK = "$XDG_RUNTIME_DIR/sway-ipc.sock";
|
||||
# TODO: ensure this is reliable? might not work across sway restarts, etc.
|
||||
env.DISPLAY = ":0";
|
||||
env.WAYLAND_DISPLAY = "wayland-1";
|
||||
|
|
Loading…
Reference in New Issue
Block a user