Skip to content
Browse files

Add a new version, some more doc, and output for the script.

Also add the xdbus file that can be useful while using crontabs.
  • Loading branch information...
1 parent 765f46d commit cfdb3b85ba3c66c2f295117681fe964ce9dd6e57 Alexis Metaireau committed
Showing with 21 additions and 0 deletions.
  1. +21 −0 xdbus
View
21 xdbus
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Get the pid of nautilus
+nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
+
+# If nautilus isn't running, just exit silently
+if [ -z "$nautilus_pid" ]; then
+exit 0
+fi
+
+# Grab the DBUS_SESSION_BUS_ADDRESS variable from nautilus's environment
+eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
+
+# Check that we actually found it
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
+echo "Failed to find bus address" >&2
+exit 1
+fi
+
+# export it so that child processes will inherit it
+export DBUS_SESSION_BUS_ADDRESS

0 comments on commit cfdb3b8

Please sign in to comment.
Something went wrong with that request. Please try again.