The Computer Oracle

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

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Luau

--

Chapters
00:00 Is There A Way To Make The X Button Exit Spotify?
01:11 Answer 1 Score 4
01:21 Answer 2 Score 1
01:53 Answer 3 Score 3
02:12 Answer 4 Score 2
03:07 Thank you

--

Full question
https://superuser.com/questions/314088/i...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #spotify

#avk47



ANSWER 1

Score 4


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




ANSWER 2

Score 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




ANSWER 3

Score 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!




ANSWER 4

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