diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c index cbc43df2e..9890b5ce8 100644 --- a/overlay_gl/overlay.c +++ b/overlay_gl/overlay.c @@ -180,7 +180,13 @@ static void newContext(Context * ctx) { } } - if (home) { + char *xdgRuntimeDir = getenv("XDG_RUNTIME_DIR"); + + if (xdgRuntimeDir != NULL) { + ctx->saName.sun_family = PF_UNIX; + strcpy(ctx->saName.sun_path, xdgRuntimeDir); + strcat(ctx->saName.sun_path, "/MumbleOverlayPipe"); + } else if (home) { ctx->saName.sun_family = PF_UNIX; strcpy(ctx->saName.sun_path, home); strcat(ctx->saName.sun_path, "/.MumbleOverlayPipe"); diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp index 3ace5ac5b..4e435c586 100644 --- a/src/mumble/Overlay.cpp +++ b/src/mumble/Overlay.cpp @@ -92,7 +92,17 @@ Overlay::Overlay() : QObject() { #ifdef Q_OS_WIN pipepath = QLatin1String("MumbleOverlayPipe"); #else - pipepath = QDir::home().absoluteFilePath(QLatin1String(".MumbleOverlayPipe")); + { + QString xdgRuntimePath = QProcessEnvironment::systemEnvironment().value(QLatin1String("XDG_RUNTIME_DIR")); + QDir xdgRuntimeDir = QDir(xdgRuntimePath); + + if (! xdgRuntimePath.isNull() && xdgRuntimeDir.exists()) { + pipepath = xdgRuntimeDir.absoluteFilePath(QLatin1String("MumbleOverlayPipe")); + } else { + pipepath = QDir::home().absoluteFilePath(QLatin1String(".MumbleOverlayPipe")); + } + } + { QFile f(pipepath); if (f.exists()) { diff --git a/src/mumble/SocketRPC.cpp b/src/mumble/SocketRPC.cpp index 3458d2fd3..f085c4d13 100644 --- a/src/mumble/SocketRPC.cpp +++ b/src/mumble/SocketRPC.cpp @@ -231,7 +231,17 @@ SocketRPC::SocketRPC(const QString &basename, QObject *p) : QObject(p) { #ifdef Q_OS_WIN pipepath = basename; #else - pipepath = QDir::home().absoluteFilePath(QLatin1String(".") + basename + QLatin1String("Socket")); + { + QString xdgRuntimePath = QProcessEnvironment::systemEnvironment().value(QLatin1String("XDG_RUNTIME_DIR")); + QDir xdgRuntimeDir = QDir(xdgRuntimePath); + + if (! xdgRuntimePath.isNull() && xdgRuntimeDir.exists()) { + pipepath = xdgRuntimeDir.absoluteFilePath(basename + QLatin1String("Socket")); + } else { + pipepath = QDir::home().absoluteFilePath(QLatin1String(".") + basename + QLatin1String("Socket")); + } + } + { QFile f(pipepath); if (f.exists()) {