0

I am working on a project. I am stuck on a point where I need to know which application I am currently editing/viewing (eg. terminal, chrome, outlook etc.). After performing alt+tab I should be able to get name of next/current application. Is there any way to get this in linux?. I have worked on macos before and there is CGWindowListCopyWindowInfo(kCGWindowListOptionAll | kCGWindowListExcludeDesktopElements, kCGNullWindowID) (CG Graphics library) api call for the same. I am looking for similar solution for Linux. Thanks

  • 1
    This probably depends on which desktop environment you're using (specifically which window manager). Gnome, KDE, etc. Which one are you using? – Roger Lipscombe May 14 '18 at 15:12
  • Or are you implementing a window manager? In which case, it's up to you to maintain that list. – Roger Lipscombe May 14 '18 at 15:13
  • See this: https://stackoverflow.com/questions/252906/how-to-get-the-list-of-open-windows-from-xserver , you can do it using Xlib and work down from XQueryTree. It won't be a very pleasant programming task (Xlib never is). – FBergo May 14 '18 at 15:16
  • It isn't quite clear what you are trying to do. Can you describe the intended user experience in more detail? – n. m. could be an AI May 14 '18 at 15:27
  • @RogerLipscombe I am using CentOS. Gnome is the window manager. – Nikhil Nilawar May 15 '18 at 04:51
  • Hi, I am trying to figure out which processid/application is currently taking input from keyboard strokes/input device. I mean there must be some mapping between them and is stored somewhere – Nikhil Nilawar May 15 '18 at 05:31
  • Then that's a different question: "on Linux, how do I find out which application is receiving keyboard input?" – Roger Lipscombe May 15 '18 at 06:37

0 Answers0