-
-
Notifications
You must be signed in to change notification settings - Fork 858
Description
Running ActivityWatch on GNOME Wayland (Ubuntu 25.10) by replacing default watchers with aw-awatcher
Summary
On an Acer Predator PT315-52 running Ubuntu 25.10, GNOME Shell 49.0, Wayland, and Linux 6.17.0-19-generic, the standard ActivityWatch Linux setup worked partially: the web UI came up, but the default Linux watchers failed repeatedly with X11 display authorization errors.
The workaround that succeeded was:
- Install ActivityWatch normally.
- Confirm that the desktop session is Wayland.
- Stop using the default watchers (
aw-watcher-windowandaw-watcher-afk). - Keep
aw-serveras the backend. - Install the GNOME extension Focused Window D-Bus.
- Install
aw-awatcheras the Wayland-compatible replacement. - Use custom
start.sh/kill.shscripts and a GNOME autostart entry.
Environment
Static hostname: PT315-52
Icon name: computer-laptop
Chassis: laptop 💻
Machine ID: ****
Boot ID: ****
Operating System: Ubuntu 25.10
Kernel: Linux 6.17.0-19-generic
Architecture: x86-64
Hardware Vendor: Acer
Hardware Model: Predator PT315-52
Firmware Version: V1.09
Firmware Date: Mon 2021-01-04
Firmware Age: 5y 2month 1w 6d
Desktop: GNOME Shell 49.0
Session type: Wayland
Original problem
After installing ActivityWatch and launching it, the web UI was available at http://localhost:5600, but aw-watcher-window kept failing with this error:
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'
Later, when trying a script-based startup with aw-watcher-afk, that watcher also failed with the same X11 authorization problem.
So the core pattern was:
aw-serverworked.- the web UI worked.
- the default watchers failed on GNOME + Wayland.
What we verified first
We confirmed the session type:
echo "$XDG_SESSION_TYPE"Output:
wayland
We also checked the GNOME version:
gnome-shell --versionOutput:
GNOME Shell 49.0
Step 1 - Install ActivityWatch normally
We first installed the regular Linux build exactly as recommended for Linux ZIP installs.
sudo apt update
sudo apt install -y wget unzip
mkdir -p ~/.local/opt
cd ~/.local/opt
wget -O activitywatch.zip https://github.com/ActivityWatch/activitywatch/releases/download/v0.13.2/activitywatch-v0.13.2-linux-x86_64.zip
unzip -q activitywatch.zip
rm activitywatch.zip
cd activitywatch
./aw-qtAt this stage, the web UI became available, but the default watchers were not usable in this GNOME Wayland setup.
Step 2 - Stop the failing default watchers
We stopped the watchers that were flooding the terminal/logs:
pkill -f aw-watcher-window
pkill -f aw-watcher-window-wayland
ps aux | grep aw-watcherThis confirmed that aw-watcher-window was no longer running.
Step 3 - Inspect how ActivityWatch was configured
We looked for ActivityWatch-related autostart entries and config files.
Search autostart-related entries
grep -RniE '^(Exec|Name|Hidden|X-GNOME-Autostart-enabled)=|aw-qt|aw-watcher-window|aw-watcher-afk|start.sh' \
~/.config/autostart ~/.local/share/applications 2>/dev/nullCheck config directory
ls -R ~/.config/activitywatch 2>/dev/nullInspect aw-qt.toml
sed -n '1,120p' ~/.config/activitywatch/aw-qt/aw-qt.tomlThe file contained only commented defaults:
[aw-qt]
#autostart_modules = ["aw-server", "aw-watcher-afk", "aw-watcher-window"]
[aw-qt-testing]
#autostart_modules = ["aw-server", "aw-watcher-afk", "aw-watcher-window"]Step 4 - Remove the default watchers from aw-qt
We replaced the commented defaults with an explicit configuration.
First, we tried keeping only aw-server and aw-watcher-afk:
cp ~/.config/activitywatch/aw-qt/aw-qt.toml ~/.config/activitywatch/aw-qt/aw-qt.toml.bak
cat > ~/.config/activitywatch/aw-qt/aw-qt.toml <<'EOF2'
[aw-qt]
autostart_modules = ["aw-server", "aw-watcher-afk"]
[aw-qt-testing]
autostart_modules = ["aw-server", "aw-watcher-afk"]
EOF2But aw-watcher-afk also failed under this environment.
So we reduced the configuration to aw-server only:
cat > ~/.config/activitywatch/aw-qt/aw-qt.toml <<'EOF2'
[aw-qt]
autostart_modules = ["aw-server"]
[aw-qt-testing]
autostart_modules = ["aw-server"]
EOF2Step 5 - Try GNOME-style script-based startup
Because GNOME/Wayland is a special case, we switched to a script-based startup model.
First version of start.sh
cat > ~/.local/opt/activitywatch/start.sh <<'EOF2'
#!/bin/bash
cd ~/.local/opt/activitywatch
pkill -f aw-watcher-window 2>/dev/null
pkill -f aw-watcher-afk 2>/dev/null
pkill -f '/aw-server/aw-server' 2>/dev/null
./aw-server/aw-server >/tmp/aw-server.log 2>&1 &
EOF2First version of kill.sh
cat > ~/.local/opt/activitywatch/kill.sh <<'EOF2'
#!/bin/bash
pkill -f aw-watcher-window
pkill -f aw-watcher-afk
pkill -f '/aw-server/aw-server'
EOF2
chmod +x ~/.local/opt/activitywatch/start.sh ~/.local/opt/activitywatch/kill.shTest
~/.local/opt/activitywatch/kill.sh
~/.local/opt/activitywatch/start.sh
sleep 2
ps aux | grep -E 'aw-server|aw-watcher-afk|aw-watcher-window' | grep -v grepResult: aw-server stayed up, but the default watchers remained unusable.
Step 6 - Confirm aw-watcher-afk also fails on this setup
When we tried starting aw-watcher-afk, we inspected its log:
cat /tmp/aw-watcher-afk.log 2>/dev/null || echo "no hay log"The relevant error was again an X11 display connection problem:
ImportError: this platform is not supported: ('failed to acquire X connection: Can\'t connect to display ":0": b\'Authorization required, but no authorization protocol specified\\n\'', DisplayConnectionError(':0', b'Authorization required, but no authorization protocol specified\n'))
At that point we concluded that, in this particular GNOME Wayland setup, the stable path was:
- keep
aw-server - replace the default watchers entirely
Step 7 - Install the required GNOME extension
We installed the Focused Window D-Bus GNOME extension, then verified that it was present.
gnome-extensions listRelevant output:
focused-window-dbus@flexagoon.com
This extension is required by awatcher for GNOME Wayland focused-window reporting.
Step 8 - Install aw-awatcher
We downloaded and installed the ActivityWatch-compatible watcher replacement:
cd /tmp
wget -O aw-awatcher.zip https://github.com/2e3s/awatcher/releases/download/v0.3.3/aw-awatcher.zip
sudo unzip -o aw-awatcher.zip -d /usr/local/bin
ls -l /usr/local/bin/aw-awatcher*Expected result:
-rwxr-xr-x 1 root root ... /usr/local/bin/aw-awatcher
Step 9 - Test aw-awatcher manually
We launched it manually first, while keeping aw-server running:
/usr/local/bin/aw-awatcher >/tmp/aw-awatcher.log 2>&1 &
sleep 3
ps aux | grep -E 'aw-awatcher|aw-server' | grep -v grepThen we checked the log:
cat /tmp/aw-awatcher.logThe log was empty, and the process stayed running, which indicated a clean start.
Step 10 - Update the startup scripts to use aw-awatcher
We then updated start.sh so it would:
- kill the old default watchers
- kill any previous
aw-awatcherinstance - start
aw-server - wait briefly
- start
aw-awatcher
Final start.sh
cat > ~/.local/opt/activitywatch/start.sh <<'EOF2'
#!/bin/bash
cd ~/.local/opt/activitywatch
pkill -f aw-watcher-window 2>/dev/null
pkill -f aw-watcher-afk 2>/dev/null
pkill -f aw-awatcher 2>/dev/null
pkill -f '/aw-server/aw-server' 2>/dev/null
./aw-server/aw-server >/tmp/aw-server.log 2>&1 &
sleep 2
/usr/local/bin/aw-awatcher >/tmp/aw-awatcher.log 2>&1 &
EOF2
chmod +x ~/.local/opt/activitywatch/start.shFinal kill.sh
cat > ~/.local/opt/activitywatch/kill.sh <<'EOF2'
#!/bin/bash
pkill -f aw-watcher-window
pkill -f aw-watcher-afk
pkill -f aw-awatcher
pkill -f '/aw-server/aw-server'
EOF2
chmod +x ~/.local/opt/activitywatch/kill.shFinal test
~/.local/opt/activitywatch/kill.sh
~/.local/opt/activitywatch/start.sh
sleep 3
ps aux | grep -E 'aw-server|aw-awatcher|aw-watcher-afk|aw-watcher-window' | grep -v grepExpected result:
aw-serveris runningaw-awatcheris runningaw-watcher-afkis not runningaw-watcher-windowis not running
Step 11 - Enable autostart on GNOME
Finally, we created a desktop autostart entry:
mkdir -p ~/.config/autostart
cat > ~/.config/autostart/activitywatch-wayland.desktop <<'EOF2'
[Desktop Entry]
Type=Application
Name=ActivityWatch Wayland
Exec=/home/mateo/.local/opt/activitywatch/start.sh
X-GNOME-Autostart-enabled=true
Terminal=false
EOF2After logout/login or reboot, ActivityWatch should start through start.sh and avoid relaunching the unsupported default watchers.
Final state
The stable working configuration on this machine was:
- ActivityWatch installed normally
aw-serverkept as backend- default watchers disabled for autostart
- GNOME extension
focused-window-dbus@flexagoon.cominstalled aw-awatcherinstalled to/usr/local/bin- custom
start.sh/kill.shused instead of the default watcher startup flow - GNOME autostart entry pointing to
start.sh
Why this worked
The root cause appears to be that the default ActivityWatch Linux watchers depend on mechanisms that do not work reliably in this GNOME Wayland setup, while awatcher uses a GNOME Wayland-compatible path when the required extension is installed.
In short:
aw-serveritself was fine.- the issue was with the default watchers.
- replacing them with
aw-awatchersolved the problem.
Sources consulted
- ActivityWatch docs - Getting started
https://docs.activitywatch.net/en/latest/getting-started.html - ActivityWatch docs - Running on GNOME
https://docs.activitywatch.net/en/latest/running-on-gnome.html - ActivityWatch docs - FAQ
https://docs.activitywatch.net/en/latest/faq.html - ActivityWatch docs - Watchers
https://docs.activitywatch.net/en/latest/watchers.html - ActivityWatch docs - Configuration
https://docs.activitywatch.net/en/latest/configuration.html - Focused Window D-Bus GNOME extension
https://extensions.gnome.org/extension/5592/focused-window-d-bus/ awatcherrepository
https://github.com/2e3s/awatcher
This was posible by the use of OpenAI ChatGPT 5.4 Thinking