2

I can find the information easily for regular applications with something like:

xdotool getactivewindow getwindowname
xdotool getactivewindow getwindowpid

VLC media player

28448

However with the Flatpak I get:

xdotool getactivewindow getwindowname
xdotool getactivewindow getwindowpid

VLC media player

2

So the PID comes back as something odd like 2, 0 or nothing at all depending on the app.

I haven't been able to find a way to do this with xdotool or anything else.

5
  • I'm not really familiar with flatpak, but here's a guess: because of the sandboxing/vm, it may actually be 0 or 2. But I'm not entirely sure what's going on. Have you tried manually spotting the process with ps or pstree? – rudib Nov 20 '20 at 19:07
  • also, you could try flatpak ps - it actually should show the PID fo the wrapper process, etc... – rudib Nov 20 '20 at 19:11
  • Looking again at VLC as an example, it has a 'Name' of rcu_gp, 'PID' of 3, and 'Window Title' of VLC media player. flatpak ps shows me 'Instance' of 2707785125, 'PID' of 4603, 'Application' of org.videolan.VLC, 'Runtime' of org.kde.Platform. With the PID 3 & Name rcu_gp how do I connect this as belonging to the flatpak ps output? The Window Title is unreliable; for example with Flatseal there is no window title – Merritt Nov 20 '20 at 20:42
  • 2
    If you have multiple windows open, the PID will also remain 2. It might not be possible to possible to link it to a pid that way as they all have the same, as far as i can see. You might be seeing the PID of the sandboxed process. If you run flatpak enter $instanceid /bin/bash and run ps -aux there, you'll see that /app/bin/vlc.bin actually has PID 2. The WINDOWID in cat /proc/2/environ matches the console the flatpak command is run in (and not the vlc window). Running pstree on your console should give you an overview. – rudib Nov 20 '20 at 22:01
  • So I think that the window is being created by the console/instance you run flatpak from (but in a sandbox) and that seems to be the reason why it shows 2 (otherwise I'd expect it to show the console pid and I thnik it technically should be the console pid). This could also either be a bug or a feature of X/flatpak. – rudib Nov 20 '20 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.