I am building a window manager and I need to locate the icons related to a running executable for the taskbar. I found the Icon Specifications and was able to locate all the icons in `/usr/share/icons/theme_name` (I am on arch linux, if that matters). I also found the `.desktop` files (which contain the icon path and executable path) in `/usr/share/applications`.

The issue is linking the `.desktop` files with running executables. I was thinking the name of the running window would match the name of the `.desktop` file; however, the name of the running window is more specific to the window itself. E.g. calling `XGetWindowProperty` on the terminal returns name as the directory the terminal is currently in, and visual studio code returns the file name, user name, and "Visual Studio Code."

Is there any way to link the two. As in know which `.desktop` file is used by which running window. Or even directly know which icon is supposed to be used by which running window?