]> code.delx.au - dotfiles/commitdiff
bash: pick up XDG_RUNTIME_DIR in case it isn't set automatically
authorJames Bunton <jamesbunton@delx.net.au>
Sat, 23 Apr 2022 00:21:52 +0000 (10:21 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Sat, 23 Apr 2022 00:21:52 +0000 (10:21 +1000)
.bashrc

diff --git a/.bashrc b/.bashrc
index 6a5588ed8a071d342f03a1ab416c72aa79594c8b..45b10eed39140029ca334173ef8c965be9011b26 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -30,6 +30,12 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
     fi
 fi
 
+# Look for XDG_RUNTIME_DIR
+if [ -z "$XDG_RUNTIME_DIR" ] && [ -d "/run/user/$(id -u)" ]; then
+    XDG_RUNTIME_DIR="/run/user/$(id -u)"
+    export XDG_RUNTIME_DIR
+fi
+
 # Look for DBUS
 if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -S "/run/user/$(id -u)/bus" ]; then
     DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"