Linux multiple monitor error? (with shaky workaround)


Hi there, I tried to get AW to run on my Ubuntu 18.04 (Macbook Pro hardware), but I got this error repeatedly:

2018-10-08 15:21:53 [ERROR]: Exception thrown while trying to get active window: Can't connect to display ":0": b'No protocol specified\n'  (aw_watcher_window.main:68)
Traceback (most recent call last):
  File "aw_watcher_window/", line 65, in heartbeat_loop
  File "aw_watcher_window/", line 44, in get_current_window
  File "aw_watcher_window/", line 6, in get_current_window_linux
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/PyInstaller/loader/", line 631, in exec_module
  File "aw_watcher_window/", line 11, in <module>
  File "site-packages/Xlib/", line 89, in __init__
  File "site-packages/Xlib/", line 71, in __init__
  File "site-packages/Xlib/protocol/", line 167, in __init__
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'No protocol specified\n'

…at a glance I would say it does not expect other monitors than the default one, but disconnecting them, changed nothing.

Some creative googling led me to this post ( TLDR; there is a bug in python-xlib ), that offered the workaround:

$ xhost +

So is this something that can be fixed in a more structured way by some creative additions to the AW config files?


Oh, interesting.

Definitely has nothing to do with multiple monitors, I know of multiple people who use activitywatch with multiple monitors on linux without issues.

Since “xhost +” worked I checked the man page for xhost which tells me that xhost is a tool for access control on who is allowed to connect to the X server and “xhost +” means that anyone is allowed access to it (so running that command could potentially be a security issue).

This is not a bug in python-xlib since it seems like activitywatch is denied permission to connect to the X server.

So what would be interesting to know is, what is the output if you only run “xhost” on your machine?
For me it is

access control enabled, only authorized clients can connect


Same for me:
access control enabled, only authorized clients can connect