27

I've been trying out Spotify for the past few days, and have been annoyed that clicking the X button in the top right of the window just minimizes it instead of closing it. In fact, even right-clicking it in the task bar and then selecting "close window" won't close it. Neither will Alt-F4.

The only two ways I know of to close it (short of killing it from the task manager) are using File → Exit or right-clicking on the tray icon and selecting Exit. Unfortunately, there don't seem to be any options to change its behavior either.

I've also noticed this behavior in other programs like Google Talk and Skype, but it makes more sense to me there since people typically want them to keep running in the background. However, I don't see why anyone would want Spotify always running even if they weren't listening to music.

Is there a way in Windows 7 to override this behavior so that clicking the X will force the program to exit? I suppose I could write an AutoHotKey script to make a keyboard shortcut that would exit it, but that seems like a hack.

Brandon
  • 664

9 Answers9

4

You can use Alt+f, x instead of Alt+F4 as a temporary solution to quickly close Spotify.

3

You can actually right click on the icon in the notification area and choose the open that says 'Hide from Taskbar when closed.' Then the [x] will actually close the program, not just minimize it.

Source: http://www.youtube.com/watch?v=X5reA9E7IjA

Jacob
  • 55
  • 2
3

The current version of Spotify now implements this behavior. Simply closing the window will close the entire application and stop music from playing in the background.

2

The AHK script from cx348 seems to catch someone hitting Alt-F4 to close the window, but (at least for me) doesn't catch someone closing Spotify by clicking the "X" in the top right corner to close the window.

I created the following AutoHotKey script to also catch if someone clicks on the "X" in the top right corner of the window:

#IfWinActive ahk_class SpotifyMainWindow
LButton::Click Down
LButton Up::
WinGetActiveStats, Title, WindowWidth, WindowHeight, X, Y
MouseGetPos, MouseX, MouseY
    if ((WindowWidth - MouseX) > 6 && (WindowWidth - MouseX) < 54 && MouseY < 20) {
        Run, taskkill /F /IM spotify.exe,, Hide
    }
    Click Up
return

From my (limited) understanding of how this works (as I hacked this together from a number of examples, am not an AHK expert), the script basically:

  • Applies only on the Spotify window
  • Waits for a left mouse click (down/up) action
  • When that occurs, it grabs the Active (Spotify) window size and also grabs where your mouse position was when it was clicked
  • It checks to make sure that the click was done where the X button is by computing the boundaries on the fly
  • If you did click in the area where the X is it sends a silent command to kill Spotify
  • The click action is released
  • And the script returns

Hope this is helpful to someone!

1

Spotify keeps itself running in the background because it uses your computer to keep the rest of the network running (see here).

In answer to your question, the best thing I can think of that hasn't already been mentioned involves having another app or scheduled task running in the background that periodically (every minute or so) checks to see if the Spotify window is visible. If it's not visible then it can send the close command.

Windows Scheduled tasks should be capable of this, but it depends how much of a problem it is.

0

In Spotify Advanced Settings there is an option to change the close button behaviour:

enter image description here

Mr Rubix
  • 199
0

I do not have that application, so this is general advice. Most browsers and many other programs also have this feature. In the vast majority of them, there is an option in settings such as a checkbox for "minimize on close" or "hide in tray", or even "accelerate startup" since the app is then already open. The verbiage varies, but they all mean the same thing.

If needed, you could create a shortcut to taskkill.exe to terminate the program. But, to be gentler with it and close it instead, you could put close.exe (in zip archive) in your System32 folder and then create a shortcut using that. The command needs the name of the window that opens when Spotify runs. It can use wildcards, too. So, if the window's name (upper left corner) is "Spotify", your shortcut could be something like this:

close.exe Spot*

That would close all windows with "Spot" as the first 4 letters of their name. Close.exe is also useful for scheduling things. It is easy to start programs with the Task Scheduler, and you can schedule their closing, too, by using the same syntax.

Gareth
  • 19,080
Abraxas
  • 1,265
0

Here are some facts to take away from this:

  • Spotify detects the close button, and cancels the form close, then minimizes the application
  • It differentiates between the close button and File->Exit

It is possible to program an application that detects the close button and/or minimization of the application, and send the same message that Spotify does when File->Exit is clicked.

Not the EASIEST solution, but should work. Maybe I'll program it...

0

After endless searching and since this thread here is one of the fist things that pop up at google, I will share my solution here:

I just installed AutoHotkey and wrote the following simple script:

#IfWinActive ahk_class SpotifyMainWindow
!F4::
{
Run, taskkill /F /IM spotify.exe
return
}

If Spotify is the active Window, this will redefine the normal (not working) close-command of Alt+F4 to taskkill which will forcefully terminate spotify.

Indeed this is not very gentle, but well... seems to be the only way to close spotify without using the annoying way through the menu. And so far for me it's working without problems.

cx348
  • 1