commit 91612d0a0bfdeb607ee7c37b339a6e859e42d82f
parent ac0a35cd69ac65002d669530d7a23752ff444c30
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 27 Jul 2021 11:59:36 -0700
Set XDG_RUNTIME_DIR if not set by session manager
The sway window manager requires this variable to be set, but if
launching a session manually from the console, this isn't set -- at
least not on FreeBSD.
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/.zshenv b/.zshenv
@@ -35,3 +35,11 @@ fi
if [[ -d "$HOME/.perl5/lib/perl5" ]]; then
export PERL5LIB="$HOME/.perl5/lib/perl5:$PERL5LIB"
fi
+
+# When not running under a FreeDesktop-compliant session manager, set
+# XDG_RUNTIME_DIR for programs (e.g. sway) that need it.
+if [[ -z "$XDG_RUNTIME_DIR" ]]; then
+ export XDG_RUNTIME_DIR="/tmp/user/$(id -u)"
+ mkdir -p "$XDG_RUNTIME_DIR"
+ chmod 0700 "$XDG_RUNTIME_DIR"
+fi