Mutter api under X11 and Wayland

The documentation for meta_window_get_pid() mentions the _NET_WM_PID property, which is part of the EWMH—an X11 specification. Wayland does not have anything of the sort.

GNOME Shell does not really use the PID to match a window with an application, as it’s not possible to match a PID to a desktop file, which is the canonical source for things like the application’s description, icon, and command line/DBus activation name. GNOME Shell uses the application id, if available; failing that, it’ll use the WM_CLASS property; and failing that, it’ll use the PID. Only old X11 applications will not have an application id and/or an WM_CLASS property set, so _NET_WM_PID support is mostly for legacy stuff.

Additionally, you won’t be able to use the Meta API from an application: you can only use it from within the compositor.