Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'

Open
#179 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
linux, python

Research direction

The error occurs in aw_watcher_window/xlib.py when connecting to the X11 display. Start by examining the xlib.py module and the get_current_window_linux function in lib.py. Research X11 authorization methods (like xauth) and Wayland compatibility. Check if the issue is specific to Debian/Kali and whether environment variables like DISPLAY or XAUTHORITY need to be set. Testing on a Debian-based system will be necessary to reproduce and fix.

Written by the indexing model from the issue text.

Description

On debian based distros like kali I have a truoble with running tis app. Infinity output:

2026-08-29 19:07:21 [ERROR]: Exception thrown while trying to get active window  (aw_watcher_window.main:133)
Traceback (most recent call last):
  File "aw_watcher_window/main.py", line 115, in heartbeat_loop
  File "aw_watcher_window/lib.py", line 64, in get_current_window
  File "aw_watcher_window/lib.py", line 8, in get_current_window_linux
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 419, in exec_module
  File "aw_watcher_window/xlib.py", line 13, in <module>
  File "Xlib/display.py", line 89, in __init__
  File "Xlib/display.py", line 71, in __init__
  File "Xlib/protocol/display.py", line 166, in __init__
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'
2026-08-29 19:07:22 [ERROR]: Exception thrown while trying to get active window  (aw_watcher_window.main:133)
Traceback (most recent call last):
  File "aw_watcher_window/main.py", line 115, in heartbeat_loop
  File "aw_watcher_window/lib.py", line 64, in get_current_window
  File "aw_watcher_window/lib.py", line 8, in get_current_window_linux
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 419, in exec_module
  File "aw_watcher_window/xlib.py", line 13, in <module>
  File "Xlib/display.py", line 89, in __init__
  File "Xlib/display.py", line 71, in __init__
  File "Xlib/protocol/display.py", line 166, in __init__
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'

May be need to make wayland support?

Dominant language
Python
Stars
31
Forks
84
Avg merge
11h 45m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ActivityWatch/docs

All issues in ActivityWatch/docs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.