I want to write a program which prints the current focused window name and if it is a gnome-terminal, then prints out the running program inside the current gnome-terminal tab (for example vim, if a vim session is running).
To get the currently focused window name, I used:
xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"
xprop -id 0x220ad5a | grep "WM_CLASS(STRING)"
If the current window is a gnome-terminal, this will return 'gnome-terminal'.
But how can I find out the program running inside gnome-terminal (more precisely: inside the current gnome-terminal tab)? I thought about using dbus but gnome-terminal does not seem to support it.