I have set "Away after 5 minutes" in:

  -> Preferences
    -> Status

This mostly works as expected: After 5 minutes of inactivity, my status automatically changes to "Away". When I come back and move mouse, or type on keyboard, the status changes back to "Available".

But it only works 95% of the time. Sometimes, I come back, move mouse, but status does not change to "Available".

This is extremely annoying, as I have to always check whether my status has changed every time I come back.

Why does it work sometimes, but not always? What affects this behavior? Is this simply a bug in Gajim, or is there something on my system that I can do to fix this?

I am using Debian Buster, and gajim 1.1.2-2

Why does such a simple thing not work reliably ?


I am using plain Openbox as my window manager, and slim as my login manager. I do have dbus daemon running.

But I don't have any Gnome/KDE/... desktop environment. I also don't have any screensaver

  • That is definitely a bug. I have checked the source code and the recognition that you are back is not that trivial. It will change based on the environment you are using and screensaver. There is a detection for Gnome, XScreenSaver, Windows and generic one. It would help to check the bug, what kind of setup you are using.
    – tukan
    May 22 '20 at 9:24
  • @tukan - thank you, I have updated my question. May 23 '20 at 3:10
  • I see. Well since you are using gajim you had to satisfy its dependencies (GLib, gir1.2-gtk-3.0, ...). Even thou you are not running directly Gnome you have to have the GTK/Cairo dependencies. So you are for sure running the DBusGnomeIdleMonitor branch. Please do check the logs (debug level on gajim). Try the XScreenSaver, I think this will work more reliably. The logic being that if the Dbus fails the XScreenSaver will serve as fallback.
    – tukan
    May 23 '20 at 9:23
  • It could really help to see the log messages from gajim debug mode.
    – tukan
    May 24 '20 at 9:11
  • @tukan - thanks for your help. I will run gajim in debug mode and monitor it. Unfortunately, I don't know how to trigger/reproduce the problem. So it will take me some time to gather useful data. Your feedback has been helpful enough, so i will award the bounty. May 24 '20 at 10:18

I'll try to answer your question even before you update question with the details.

The Analysis

There are these states of idle in gajim:

class IdleState(IntEnum):
    UNKNOWN = 0
    XA = 1
    AWAY = 2
    AWAKE = 3

You usually consider only AWAKE or AWAY. The UNKNOWN state is a generic state which is set when you don't get any result from _get_idle_monitor (see below). XA state is an extended away - screen is locked or you have a screen saver (Only for Windows, funny is that when you are on Gnome or using XScreenSaver you can't be on extended away (it is always false)).

This is how gajim decides if you are still idling:

def _get_idle_monitor(self):
    if sys.platform == 'win32':
        return WindowsIdleMonitor()

        return DBusGnomeIdleMonitor()
    except GLib.Error as error:
        log.info('Idle time via D-Bus not available: %s', error)

            return XssIdleMonitor()
        except OSError as error:
            log.info('Idle time via XScreenSaverInfo '
                     'not available: %s', error)

Since you are probably not using Windows I'll cover the DBusGnomeIdleMonitor and XssIdleMonitor.

If you are using Gnome then you are probably using this part of the code. I recommend using logging on debug mode so you will get all the messages from this part of the code.

If you see this message:

   except GLib.Error as error:
            'org.gnome.Mutter.IdleMonitor.GetIdletime() failed: %s',

Then gajim has problems getting idle time from your environment (hard to say a reason for that - probably DBus is not working correctly). Of course, you could also see the log.info('Idle time via D-Bus not available: %s', error) message.

Here you should see the log.info('Idle time via XScreenSaverInfo not available: %s', error) message if you are using it. This part of the code can generate OSError messages which usually happens if you r XScreenSaver or System is missing somehow a vital part of it.

The error messages you could get:

 if libX11path is None:
   raise OSError('libX11 could not be found.')
 if libXsspath is None:
   raise OSError('libXss could not be found.')
 if self.dpy_p is None:
   raise OSError('Could not open X Display.')
 if extension == 0:
    raise OSError('XScreenSaver Extension not available on display.')
 if self.xss_info_p is None:
    raise OSError('XScreenSaverAllocInfo: Out of Memory.')


If you are using Gnome and it does not always work, I would try to install XScreenSaver perhaps that would be more reliable way to detect your activity.

  • You can PR a patch to Gajim, that would fix this bug for all the users... :)
    – intika
    May 22 '20 at 12:20
  • 2
    @intika I'm guessing here quite a lot. For real solution I would need to trace that error and attach a debugger when the error happens (if that happens only 5% of time, it could be some kind of race condition or similar) . If the error is as I have described above then it is not a Gajim error but Dbus/Gnome one. While I would love to create a PR to fix such a bug it is not that simple.
    – tukan
    May 22 '20 at 13:06

I have experienced the exact same problem running a minimal Gnomeless setup! In my case, the solution was the following:

apt install dbus-X11
dbus-launch gajim

Apparently, installing dbus alone doesn't activate it unless you jump through some extra hoops, or something. To be honest, I have no idea how D-Bus works or why it's even needed ¯\_(ツ)_/¯

  • dbus-launch will start a new session for gajim
    – intika
    May 24 '20 at 0:49
  • @hedgie - I already have dbus-x11 installed, so the problem has to be somewhere else. May 24 '20 at 5:32
  • That would lead into completely non-working setup. @400theCat said it is working for him 95% of time.
    – tukan
    May 24 '20 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.