I know that
xprop | awk '/PID/ {print $3}' | xargs ps
and
xprop | awk '/COMMAND/ {print $4}' | xargs which
work great with GUI applications which are deb-packaged, AppImage'd or Snap'd.
But this method does not give executable file-name for application which is packaged as FlatPak.
See example below:
$ flatpak run org.libretro.RetroArch $ xprop _NET_WM_VISIBLE_NAME(UTF8_STRING) = "RetroArch (as superuser)" WM_NAME(STRING) = "RetroArch " _NET_WM_ICON_GEOMETRY(CARDINAL) = 446, 744, 207, 24 WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW XKLAVIER_STATE(INTEGER) = 0, -180379392 _NET_WM_STATE(ATOM) = WM_STATE(WM_STATE): window state: Normal icon window: 0x0 _NET_FRAME_EXTENTS(CARDINAL) = 3, 3, 23, 3 _NET_WM_DESKTOP(CARDINAL) = 0 _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW WM_CLIENT_MACHINE(STRING) = "norbert-UX32A" _NET_WM_PID(CARDINAL) = 2 WM_CLASS(STRING) = "retroarch", "retroarch" _NET_WM_ICON(CARDINAL) = Icon (16 x 16): ▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓ ▓▓ ▓▓▓ ▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓ ▓▓ ▓▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓
So I do not see PID- or COMMAND-related lines in xprop
output. But of course it is launched:
$ flatpak ps Instance PID Application Runtime 752290322 23857 org.libretro.RetroArch org.kde.Platform
How can I get PID of window created by FlatPak application while using xprop
, wmctrl
or something similar?
In most cases, flatpak permissions (sandboxing) do not allow for this AFAICT. Just how much of the system is exposed is configurable to some degree so which flatpak you are talking about might be germaine to the question. There's a great deal of information on this and other flatpak related topics here.
One notable section is http://docs.flatpak.org/en/latest/sandbox-permissions.html
One alternative approach to locating the executable file path of a flatpak might be checking the configuration files: Excerpt below.
flatpak can operate in system-wide or per-user mode. The system-wide data is located in $prefix/var/lib/flatpak/, and the per-user data is in $HOME/.local/share/flatpak/.
In addition to the default installation locations, more system-wide installations can be defined via configuration files /etc/flatpak/installations.d/, which must have the .conf extension and typically include the installation path in the form
Path=/location/of/installation
. See the installation documentation for more information.