Skip to content

Instantly share code, notes, and snippets.

@subnut
Created February 7, 2022 14:01
Show Gist options
  • Save subnut/0e4a72d931c74e91087fd1481a30e023 to your computer and use it in GitHub Desktop.
Save subnut/0e4a72d931c74e91087fd1481a30e023 to your computer and use it in GitHub Desktop.
Alternative to dbus-run-session
#!/bin/sh
{ { ADDRESS=$(dbus-daemon --session --print-address 1 --print-pid 2 --fork); } 2>&1
echo $ADDRESS; } | { tr '\n' ' '; echo; } |
read DBUS_DAEMON_PID DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_ADDRESS
"$@"; EXITCODE=$?
kill $DBUS_DAEMON_PID
exit $EXITCODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment