1

I need to know if an application is running and is visible to the user or if is running but minimized (not visible to the user)

I am able to get the pid of my application with pgrep studio but I cannot figure out how to solve the problem described above.

I tried also to get more info with ps -O -pid 5439 but it seems that I cannot get the info I need

1

There is no information in the process list, about windows. The windowing system is separate from the process management system. Process management is done by Linux (the kernel). Windowing is done by X11 or Wayland, as a normal user process.

There is a way to ask the windowing system, for a list of all windows, their name, whether visible, and other info. This will probably be what you need. (I can't remember how).

  • ok so there is no an unique way to do this and make it portable to all os – appersiano Jul 25 at 14:03
  • Did I say that. I think there will be libraries, that will abstract this for a few systems (MS, X11, Wayland, MacOS). Also I think unique and portable have exactly opposite meanings. – ctrl-alt-delor Jul 25 at 14:06
  • My fault, sorry. For other MacOS user this can be a solution gist.github.com/timpulver/4753750 – appersiano Jul 25 at 14:13

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.