I am trying to get the process name of the currently focused window with python. Right now I am working with this:
import pygetwindow as gw
print(gw.getActiveWindow().title)
The problem is that this only prints the name of the active window which is not really helpful, because sometimes the title of the application does not help at all to get it's process name (Spotify for example displays the current track and song name instead of "Spotify").
pygetwindow
has a lot of options but I don't know if there is another library that would give me the desired output of the process' name.
Thanks in advance.