chiark / gitweb /
dot/profile: Set `XDG_RUNTIME_DIR' if it looks relevant.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 23 Jan 2025 14:37:21 +0000 (14:37 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 14 Mar 2025 16:05:40 +0000 (16:05 +0000)
Without this, later `emacsclient' run from an SSH session can't find
the desktop session's Emacs server.

dot/profile

index 3c3ab08928ba67f942e3d78019042f5fa4f5e32c..55047b1da4bc5eeb73ff75f098060a4544649e96 100644 (file)
@@ -79,6 +79,12 @@ case ${SCHROOT_SESSION_ID+t} in t) ;; *) cd "$HOME" ;; esac
 ## logout hook, so synthesize one here.
 case ${DT+t} in t) trap "source $HOME/.shell-logout" EXIT; esac
 
+## Set the `runtime' directory.  This gets done automatically on a desktop
+## login, but not in, say, SSH, which causes anomalies.
+if [ -d /run/user ]; then
+  : ${XDG_RUNTIME_DIR=/run/user/$(id -u)}; export XDG_RUNTIME_DIR
+fi
+
 ###--------------------------------------------------------------------------
 ### Set some basic paths.