I have written a script that responds to a keyboard shortcut by, if it is not already open, execute the Spotify application.
If Spotify is already opened, the script uses xdotool to activate the window (bring it "to the front"). These work very well on their own -- but for one problem. If you "close" the Spotify window (hitting the X in the corner, for instance) the window goes away completely and is only accessible through the system tray. Spotify is still running, but xdotool cannot activate the window -- it does nothing.
How can I bring a "closed" Window to the front in this case? Is it just impossible because of the way Spotify is written? xdotool will actually return the window's ID properly even when it's closed.
I've tried the "windowmap" function and "windowmove 0 0", but neither effects any change, really.
EDIT: User muru suggests re-executing Spotify, in my case, which actually ends up mostly working, although it previously did not. It depends on how Spotify handles being re-opened. I'd love to hear of a generic solution if one exists.