I'd like to identify which process a window belongs to in Wayland. Is there anything like xprop for X that allows the user to pick a window by clicking and outputs all window details, including PID?

  • I doubt that there is or will ever be such a command like xprop. One major goal of Wayland is to restrict access to windows of other processes.
    – mviereck
    Commented Feb 18, 2018 at 8:38
  • @mviereck Surely the superuser could see window information, even in Wayland? Commented Feb 20, 2018 at 13:12
  • @bariumbitmap: Only if the compositor provides these informations outside of its own memory, for example in a file or through an API. I am not aware of such a specification (but it may exist, though). Of course, you could fork a compositor like weston and implement that yourself, if you don't need a general solution for all compositors.
    – mviereck
    Commented Feb 20, 2018 at 15:52
  • Why not just xprop? It shows an awful lot of detail over a window via XWayland, including _NET_WM_PID(CARDINAL), which is the originator process PID.
    – istepaniuk
    Commented Apr 5, 2019 at 15:18
  • 1
    @istepaniuk because xprop doesn't have access to Wayland windows, but only to those running on X server. Commented Jan 10, 2023 at 15:54

4 Answers 4


Good news, there IS something like this built into Gnome Shell, and unlike xprop works with Xorg and Wayland. Ultimately this may fall into the realm of other tooling if you're using KDE, i3, or something else.

To begin with, type the keys "ALT+F2" on the keyboard which will bring up a menu like this:

alt ft

After that comes up, issue the command lg (for "looking glass).

This will then bring up the looking glass window, from which we can extract window information. Select "window" from the top right corner of the looking glass:

window section

From there, you'll see a list of windows, from which you can click on the name of the window you want to identify.


In this case, I chose gedit for an example:


In the top line of that output you may notice:

Inspecting object: object instance proxy GType: MetaWindowX11 ...

The "GType" will be one of MetaWindowX11 or MetaWindowWayland.

This info comes as per https://fedoraproject.org/wiki/How_to_debug_Wayland_problems

  • 10
    So does this allow to find out the PID of process running the listed window?
    – czerny
    Commented Apr 3, 2018 at 22:55
  • 5
    So how to use this from a shell in order to determine if a gui is running as wmctrl did?
    – RichieHH
    Commented Aug 14, 2020 at 8:07
  • So when I find my window, what can I do with it ? I couldn' find any commands to run, or even refering to selected window
    – smido
    Commented Feb 21 at 19:23
  • Once the window is identified you can introspect the metadata on the GObject for subsequent development of Gnome3 plugins or programmatic control of the window. Also, you can switch to the "Evaluator" and use the REPL to reference the object. Commented Feb 29 at 18:28

I realised this was something that sway in particular was lacking, so I created a gist to do it.

Behold: wlprop

Type wlprop into a terminal and click a window, it will give you the sway tree output for that particular window:

$ wlprop
# A prompt to select a window will appear
  "id": 72,
  "type": "con",
  "orientation": "none",
  "percent": 0.5002881844380404,
  "urgent": false,
  "marks": [],
  "focused": false,
  "layout": "none",
  "border": "pixel",
  "current_border_width": 2,
  "rect": {
    "x": 0,
    "y": 26,
    "width": 868,
    "height": 1130
  "deco_rect": {
    "x": 0,
    "y": 0,
    "width": 0,
    "height": 0
  "window_rect": {
    "x": 2,
    "y": 2,
    "width": 864,
    "height": 1126
  "geometry": {
    "x": 0,
    "y": 0,
    "width": 1328,
    "height": 858
  "name": "How to identify window by clicking in Wayland - Unix & Linux Stack Exchange — Mozilla Firefox",
  "window": null,
  "nodes": [],
  "floating_nodes": [],
  "focus": [],
  "fullscreen_mode": 0,
  "sticky": false,
  "pid": 47844,
  "app_id": "firefox",
  "visible": true,
  "max_render_time": 0,
  "shell": "xdg_shell",
  "inhibit_idle": false,
  "idle_inhibitors": {
    "user": "none",
    "application": "none"

You can filter by a specific element by using jq:

$ wlprop | jq -r '.name'
# The same prompt will appear
How to identify window by clicking in Wayland - Unix & Linux Stack Exchange — Mozilla Firefox

Hopefully this solution is elegant enough to fill the xprop shaped hole in everybody's hearts

  • 1
    Is it Sway only or will it work with any DE using wayland?
    – aloisdg
    Commented Apr 4 at 12:30

There is a draft of xdg-foreign protocol extension, which allows obtaining handles of wl_surface's, created by other Wayland clients. Having the handle, you can obtain from it anything you can obtain from surfaces of your client. However, this protocol still has limitations:

  • Obviously, it won't work if not implemented in clients.
  • It's targeted for clients that know each other, so it does not provide a way to trigger it: your client communicates with a foreign client in some way, not covered by the extension. Then the foreign client publishes a handle for your client via this extension.
  • It gains too much control, if compared to xprop. Actually, you can even draw on foreign surfaces!

So, this is unlikely to become a general way to get surface parameters from any client by any client. But don't lose a hope: there are a lot of examples in tech history when a technology, initially designed for some purpose, became widely used for other purposes, just like car cigarette lighters or Accessibility APIs in Android. Moreover, in the future, there may appear a protocol extension that is more suited for your task, as there is definitely a need for it (for example, for time trackers).


In Sway, you can grep for your app against swaymsg -t get_tree, which is like xprop, but for all windows at once.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .