wmctrl

Linux

wmctrl -l list windows
wmctrl -d list desktops
wmctrl -c close window
wmctrl -r -t move window to desktop