You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, I'm not sure how to solve this. It seems like we can't have Wayland-support since Wayland itself doesn't have any notion of active window.
Are you using Gnome? I'd be interested in getting this working on Gnome or some other large desktop environment with Wayland support to start with and then see how we should go from there.
Edit: It seems Gnome is deprecating their get_active_window API which only ever worked on X11. Will investigate further.
Edit 2: Done quite a few searches but have come up emptyhanded. Considering asking a question on Stack Exchange and/or sending a mail to some Gnome mailinglist.
Reacted by Captain iiro (Abdourahman) and Braider Andrey
Alright, just asked in the #wayland channel on Freenode. Got a response at least, but the situation seems pretty bad.
15:20:44 ErikBjare Hello everybody. I'm working on a piece of self-tracking software called ActivityWatch (https://github.com/ActivityWatch/activitywatch). I know this isn't exactly the right place to ask, but I was wondering if anyone knew anything about getting the active window in any Wayland-using DE.
15:20:57 ErikBjare Created a question on SO: https://stackoverflow.com/questions/45465016/how-do-i-get-the-active-window-on-gnome-wayland
15:21:25 ErikBjare Here's the issue in my repo for it: https://github.com/ActivityWatch/activitywatch/issues/92
15:22:54 ErikBjare There are a bunch of other applications that depend on it (RescueTime, selfspy, arbtt, ulogme, etc.) so they'd need it as well
15:24:23 blocage ErikBjare, in the core protocol you cannot know which windnow has the keyboard or cursor focus
15:24:39 blocage ErikBjare, in the wayland core protocol *
15:25:10 blocage ErikBjare, you can just know if your window has the focus or not, it a design choise
15:25:23 blocage avoid client spying each other
15:25:25 ErikBjare blocage: I'm aware, that's my reason for concern. I'm not saying it should be included or anything, but as it looks now every DE would need to implement it themselves if these kind of applications are to be supported
15:25:46 ErikBjare So wondering if anyone knew the teams working with Wayland on Gnome for example
15:26:11 ErikBjare But thanks for confirming
15:26:29 blocage ErikBjare, DE should create a custom extension, or use D-bus or other IPC
15:27:31 blocage ErikBjare, I guess some compositor are around here, but I do not know myself if there is such extension already
15:27:44 blocage compositor developers *
15:28:36 ErikBjare I don't think there is (I've done quite a bit of searching), so I guess I need to catch the attention of some DE developers
15:29:16 ErikBjare Thanks a lot though
15:29:42 ErikBjare blocage: Would you mind if I shared logs of our conversation in the issue?
15:30:05 blocage just use it :) it's public
15:30:19 ErikBjare ty :)
I guess our only option is to contact some DE developers and petition them to create a way to get the info.
Reacted by Johan Bjäreholt, Weitian LI, Jan C. Borchardt, Lâm, Paweł Kotiuk, Igor Pellegrini, Benedikt Broich, Vojtěch Křižan and Captain iiro (Abdourahman)
@osule Unfortunately that won't work. That Gnome API is X11 only (that's why its deprecated) and that thing you found in weston is just xwayland.
Wayland has no concept of active window, and Gnome has no internal concept of it that it exposes. The reasons for this seems to be privacy as blocage mentioned in the IRC convo I pasted.
Hi @ErikBjare, I stumbled upon this issue while searching for a related problem.
Excuse me, in case this is completely off track but I just came across the "Wayland Security Module" ("WSM", see below for links) and thought, this might be interesting / relevant for this issue as well:
Its a proposal for a standardized, secure way to let programs perform "sensitive" tasks under Wayland (if the Desktop Environments/Wayland compositors would support the WSM).
Maybe long-term this could also be a solution for this issue of "getting the active window under Wayland".
WSM looks like a great initiative, and I had no idea it existed. It's probably the closest thing to a solution I've seen so far. Let's hope there is interest in it from the Wayland community, I might try prodding them in the future and see if they have considered our usecase 🙂
The first link for this: Wayland: An Accessibility Nightmare, with lots of philosophical talks and workarounds. Getting a few bits of an active window's metadata seems like a much easier goal than a consistent a11y support.
Reacted by Erik Bjäreholt, Helton Reis, zocker-160 and egeres
Edit: Done. However, Wayland support is supported in the Tauri distribution which is shipped and stable since v0.14.0, so I'm going to keep this closed. Bringing Wayland support to aw-qt is incoming.
@TimeToBuildBob I realized that system package managers for commonly Wayland systems may be tempted to only list the tauri dist if aw-qt is broken in Wayland. We should probably get ahead of this. Get on implementing Wayland support in aw-qt, should be as easy as bundling awatcher or something and adding the detection to aw-qt, or implement Wayland support proper in aw-watcher-window.
aw-qt now auto-detects Wayland (WAYLAND_DISPLAY or XDG_SESSION_TYPE=wayland) and transparently substitutes aw-watcher-window + aw-watcher-afk with aw-watcher-window-wayland at startup. The default autostart_modules config is unchanged; the swap happens at runtime. If the Wayland watcher is not installed, aw-qt falls back gracefully with a warning.
Activity
ErikBjare commentedon Aug 2, 2017
I've been anticipating this... See this issue: ActivityWatch/aw-watcher-window#18
Unfortunately, I'm not sure how to solve this. It seems like we can't have Wayland-support since Wayland itself doesn't have any notion of active window.
Are you using Gnome? I'd be interested in getting this working on Gnome or some other large desktop environment with Wayland support to start with and then see how we should go from there.
Edit: It seems Gnome is deprecating their
get_active_windowAPI which only ever worked on X11. Will investigate further.Edit 2: Done quite a few searches but have come up emptyhanded. Considering asking a question on Stack Exchange and/or sending a mail to some Gnome mailinglist.
vith commentedon Aug 2, 2017
Ah, that does complicate things.
Yep, I'm using Gnome on Arch Linux actually. ActivityWatch is the only thing keeping me using the
Gnome on Xorgsession.ErikBjare commentedon Aug 2, 2017
Created a question on Stack Overflow, will try to find someone on IRC to help.
Edit: Also asked on the Gnome IRC, seems a bit quiet right now.
Edit: Has now been ~20h since I asked, no one replied to me in that channel. Might want to try a mailinglist further down the line.
ErikBjare commentedon Aug 3, 2017
Alright, just asked in the #wayland channel on Freenode. Got a response at least, but the situation seems pretty bad.
I guess our only option is to contact some DE developers and petition them to create a way to get the info.
osule commentedon Aug 15, 2017
You may be able to get the active window from the root window.
ErikBjare commentedon Aug 15, 2017
@osule Unfortunately that won't work. That Gnome API is X11 only (that's why its deprecated) and that thing you found in weston is just xwayland.
Wayland has no concept of active window, and Gnome has no internal concept of it that it exposes. The reasons for this seems to be privacy as blocage mentioned in the IRC convo I pasted.
ErikBjare commentedon Oct 4, 2017
Filed an issue on the bug tracker for Gnome's mutter.
Awerick commentedon Nov 8, 2017
Hi @ErikBjare, I stumbled upon this issue while searching for a related problem.
Excuse me, in case this is completely off track but I just came across the "Wayland Security Module" ("WSM", see below for links) and thought, this might be interesting / relevant for this issue as well:
Its a proposal for a standardized, secure way to let programs perform "sensitive" tasks under Wayland (if the Desktop Environments/Wayland compositors would support the WSM).
Maybe long-term this could also be a solution for this issue of "getting the active window under Wayland".
More info on Wayland Security Module:
X.Org Presentation 2014 ; official GitHub repo ; Wikipedia: Wayland#WSM
ErikBjare commentedon Nov 9, 2017
@Awerick Thanks a lot for reaching out!
WSM looks like a great initiative, and I had no idea it existed. It's probably the closest thing to a solution I've seen so far. Let's hope there is interest in it from the Wayland community, I might try prodding them in the future and see if they have considered our usecase 🙂
52 remaining items
2e3s commentedon Dec 4, 2025
The first link for this: Wayland: An Accessibility Nightmare, with lots of philosophical talks and workarounds. Getting a few bits of an active window's metadata seems like a much easier goal than a consistent a11y support.
Aneeqasif commentedon Feb 20, 2026
Has anyone successfully set this up on wayland? coming back to this software after about 5 years, and I am using wayland right now. Please guide.
flexagoon commentedon Feb 20, 2026
@Aneeqasif use https://github.com/2e3s/awatcher
Aneeqasif commentedon Feb 20, 2026
does it support niri?
zocker-160 commentedon Feb 20, 2026
Any compositor which supports wlr-foreign-toplevel-management-unstable-v1 and ext-idle-notify-v1 protocols will work.
real-or-random commentedon Feb 23, 2026
For the record, this includes niri (though I haven't tested it on niri).
beedell-roke commentedon Oct 17, 2026
@dework-integration, in which commit[s], and/or PR[s]?
ErikBjare commentedon Oct 17, 2026
Strange, disabling the integration.
Edit: Done. However, Wayland support is supported in the Tauri distribution which is shipped and stable since v0.14.0, so I'm going to keep this closed. Bringing Wayland support to aw-qt is incoming.
ErikBjare commentedon Oct 17, 2026
@TimeToBuildBob I realized that system package managers for commonly Wayland systems may be tempted to only list the tauri dist if aw-qt is broken in Wayland. We should probably get ahead of this. Get on implementing Wayland support in aw-qt, should be as easy as bundling awatcher or something and adding the detection to aw-qt, or implement Wayland support proper in aw-watcher-window.
TimeToBuildBob commentedon Oct 17, 2026
@ErikBjare Done — ActivityWatch/aw-qt#142
aw-qt now auto-detects Wayland (
WAYLAND_DISPLAYorXDG_SESSION_TYPE=wayland) and transparently substitutesaw-watcher-window+aw-watcher-afkwithaw-watcher-window-waylandat startup. The defaultautostart_modulesconfig is unchanged; the swap happens at runtime. If the Wayland watcher is not installed, aw-qt falls back gracefully with a warning.12 new unit tests, all existing tests still pass.
feat(wayland): auto-detect Wayland session and start aw-watcher-windo…
feat(wayland): accept aw-awatcher as the Wayland watcher
feat(packaging): ship awatcher in the non-Tauri Linux bundle (#1531)
feat(wayland): accept aw-awatcher as the Wayland watcher (#143)