Is there a way to make the X button exit Spotify?

27

7

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

Posted 2011-07-23T09:42:26.537

Reputation: 644

"In fact, even right-clicking it in the task bar and then selecting "close window" won't close it". If you click Quit Spotify instead then it does close, although it takes a while. It works by calling Spotify via the command line and passing in the special parameters -taskbar spotify:internal:quit. I think it would be near impossible to modify Spotify to behave the way you want as it has several tamper-prevention systems and an auto updater. Perhaps you could suggest to the developers that they add an option to control this behaviour. – James P – 2011-08-25T10:49:33.120

@James Yeah, I'm guessing there's no good way to do it other than getting the Spotify developers themselves to change the code. I did submit a complaint to them about it when I posted this question, but who knows if they'll pay any attention to it. Hopefully, there are others complaining about it as well. – Brandon – 2011-08-25T19:44:11.023

Answers

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.

Bill Lynch

Posted 2011-07-23T09:42:26.537

Reputation: 267

Not for me (I'm running Windows 8.1). The X button still behaves exactly like the minimize button---it neither closes Spotify nor stops the playback. What platform are you on? – Brandon – 2015-03-11T21:11:53.880

@Brandon: Windows 7 and Windows 8.1. It is on a Spotify Premium account, but I can't imagine that it matters. – Bill Lynch – 2015-03-11T21:14:06.397

I do not have premium... Maybe that is what is causing the difference. I suppose it could be a sneaky way of trying to encourage free users to keep it open to help with their P2P network. Still seems a little weird though. It would be interesting to hear from a few other free vs premium users to see if their experience matches ours. – Brandon – 2015-03-11T21:24:55.697

Ah, now it updated and what you said in your answer is true. I'm glad they finally fixed this. – Brandon – 2015-03-11T23:57:53.297

1@BillLynch How to change this back to working as the minimize button? ;_; – user11153 – 2015-03-16T01:01:11.487

@user11153: I don't know. – Bill Lynch – 2015-03-16T02:10:33.837

4

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

onik

Posted 2011-07-23T09:42:26.537

Reputation: 745

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

Posted 2011-07-23T09:42:26.537

Reputation: 55

6+1 Because this is a good way to make Spotify not clutter up your task bar when you click the X button. However, it does not actually close the program as you claim. Rather, Spotify keeps running in the background (as the balloon that pops up in the video says). Even though it's no longer in the task bar, it still has a tray icon and still shows up under the "Processes" tab of your task manager. I'm the type of person that doesn't like having extra cruft running on my computer, so I'd like it if it would fully exit the program--not just hide it. – Brandon – 2012-04-19T01:11:44.800

4Downvote because this just hides the program. It still runs in the background. This is my main beef with Spotify. – Ben – 2014-01-29T15:55:23.717

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!

Joey DiJulio

Posted 2011-07-23T09:42:26.537

Reputation: 21

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.

Matthew Steeples

Posted 2011-07-23T09:42:26.537

Reputation: 2 130

3+1 for the added insight on why they might want us to always have Spotify open. I didn't know that it uses P2P. In my opinion, that's still not a good enough reason to disable something as standard and basic as the X button though. I'd even prefer if the X button closed the GUI and left a background process running in the tray for the P2P stuff. At least then it gives the impression that it closed and gets it out of the way. – Brandon – 2011-09-30T18:15:52.163

1Hi @Brandon. It uses P2P because that massively reduces their costs and infrastructure. If songs are popular then more people have them and Spotify themselves don't have to transfer them over the internet, it just uses other people who have listened to it. I agree that it's not a good business practice to not close the app, but I'd bet money on that being why. – Matthew Steeples – 2011-09-30T18:24:26.460

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.

Abraxas

Posted 2011-07-23T09:42:26.537

Reputation: 1 269

>

  • There's no such setting, so I doupt that a general advice would be an answer in this case. 2. How practical is it to go to the start menu/desktop to click on a shortcut when the program window that I'm trying to close is already open and in front of me?
  • < – TFM – 2011-07-23T10:19:16.910

    3You could easily put the shortcut on the Taskbar or in Quick Launch. Or "Show Desktop", or put a shortcut in the Start Menu. But using the File menu and clicking "Exit" in Spotify is only 2 clicks instead of 1 on the x. It is not very hard. You make it sound like once you open a program, you are doomed to never be able to use any other program. That is why the Taskbar exists. – Abraxas – 2011-07-23T10:51:10.007

    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...

    Mike Christiansen

    Posted 2011-07-23T09:42:26.537

    Reputation: 398

    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

    Posted 2011-07-23T09:42:26.537

    Reputation: 1