diff --git a/hiro/qt/application.cpp b/hiro/qt/application.cpp index 2a4ac487a..83475d1d6 100644 --- a/hiro/qt/application.cpp +++ b/hiro/qt/application.cpp @@ -51,7 +51,20 @@ auto pApplication::quit() -> void { auto pApplication::setScreenSaver(bool screenSaver) -> void { #if defined(DISPLAY_XORG) if(state().screenSaverXDG && state().screenSaverWindow) { + //when invoking this command on Linux under Xfce, the follow message is written to the terminal: + //"org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files" + //to silence this message, stdout and stderr are redirected to /dev/null while invoking this command. + auto fd = open("/dev/null", O_NONBLOCK); + auto fo = dup(STDOUT_FILENO); + auto fe = dup(STDERR_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); invoke("xdg-screensaver", screenSaver ? "resume" : "suspend", string{"0x", hex(state().screenSaverWindow)}); + dup2(fo, STDOUT_FILENO); + dup2(fe, STDERR_FILENO); + close(fd); + close(fo); + close(fe); } #endif }