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

diff --git a/.bashrc b/.bashrc
index 784fd1306983b11f9bc5b0dcba40b334b438f617..6a5588ed8a071d342f03a1ab416c72aa79594c8b 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -30,6 +30,12 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
     fi
 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"
+    export DBUS_SESSION_BUS_ADDRESS
+fi
+
 
 ###########################
 # Interactive shells only #