Is there a way to get the icon of a running X program? When you switch between windows, you could see the icon of it, e.g through xfwm4.
This works for me. Might not work with all applications and all window managers. The
(and click on the window you want to get the icon from, see also xprop's
The idea is to use xprop to get the property as a list of 32 bit decimal integers and use perl to convert that into a graphics format (pam chosen here for simplicity though I had to reorder the bytes since _NET_WM_ICON is ARGB while pam is RGBA.
(a note about the pam format. It's a netpbm format, netpbm being a venerable Unix image manipulation toolbox. However, due to various issues, mostly licensing ones, newer netpbm versions are not packages by debian and as a result its derivatives like ubuntu as well, which means that most of the pam conversion utilities are not present there. On other systems that have newer netpbm, you can pipe the output above to