I want to write a program that prints the current focused window name, and if it is a gnome-terminal, then prints the running program inside the current gnome-terminal tab (for example, vim if a vim session is running).
To get the current 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 the gnome-terminal (more precisely: inside the current gnome-terminal tab)? I was thinking about using dbus, but gnome-terminal does not seem to support it.
Funsi source
share