Monday, October 8, 2012

Fix Windows' Snap-To Hotkeys for Spotify AND Control Transparency!

It's irked me for a while that Windows+Right/Left hotkeys don't work with Spotify. I use them all the time to reposition applications- especially when I'm at home with 4 monitors.


However I never quite hit the tipping point to motivated action for this puzzle, until I decided to make Spotify semi transparent so Winamp's Milkdrop visualizer could shine through during a social get-together at my place last night.

I found a great little app called glass2k that enables custom transparency for any window/application - however, it caused Spotify to freeze!

After searching for a while online, I decided that nobody had solved the whole 'Spotify uses a really weird window that doesn't behave normally' thing.

I'm pleased to report that I've found a way to fix Spotify up so it will work normally with Windows' snap-to functions. And to top it off, I also found a way to make Spotify transparent :)

Credit goes to the niftiest Windows program out there called Autohotkey, and community member System Monitor for his transparency script. Head on over to Autohotkey's homepage and install the program (and maybe later spend some time creating awesome hotkeys to paste text you commonly type out, such as your email address, or control music faster/easier, etc).

Once installed, all you have to do is open a text editor/notepad, paste the following, save the file, change the extension from .txt to .ahk, then double click it and you're good to go!

Consider copying it to C:\Users\[your username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ so it will automatically start on boot.

!f::
WinGet, active_id, ID, A
WinGet, Style, Style, A
if (Style & 0x170B0000)
{
 ;MsgBox, Fixing Spotify.
 WinSet, Style, 0x17CF0000, ahk_id %active_id%
 WinSet, Transparent, OFF, ahk_id %active_id%
}
return
!w::
WinGet, active_id, ID, A
WinGet, currentWindow, ID, A
if not (%currentWindow%)
{
   %currentWindow% := 255
}
if (%currentWindow% != 255)
{
   %currentWindow% += 5
   WinSet, Transparent, % %currentWindow%, ahk_id %active_id%
}
SplashImage,,w100 x0 y0 b fs12, % %currentWindow%
SetTimer, TurnOffSI, 1000, On
Return
!s::
SplashImage, Off
WinGet, active_id, ID, A
WinGet, currentWindow, ID, A
if not (%currentWindow%)
{
   %currentWindow% := 255
}
if (%currentWindow% != 5)
{
   %currentWindow% -= 5
   WinSet, Transparent, % %currentWindow%, ahk_id %active_id%
}
SplashImage,, w100 x0 y0 b fs12, % %currentWindow%
SetTimer, TurnOffSI, 1000, On
Return

TurnOffSI:
SplashImage, off
SetTimer, TurnOffSI, 1000, Off
Return
After you fire it up, Alt+f (f stands for 'fix spotify') will fix Spotify, enabling you to use the Windows snap commands!

Alt+w and Alt+s will control transparency of any running program. I haven't gotten Spotify to be interactive while transparent, so if you want to click on it you'll have to Alt+f it again.

Enjoy!

Be sure to check out my other blog and 3D-printed tech accessories site, techneesh. Follow me @tristech for occasional but interesting tweets.

8 comments:

  1. PS - You should press Alt+f when Spotify is the active // focused window

    ReplyDelete
  2. hi, i get this error when i try to run the app.

    windows 7 / 64 bit

    ReplyDelete
  3. http://cl.ly/image/1K2f122i0k0I/spot.GIF

    ReplyDelete
  4. Fixed- the TurnOffSI function got lost while posting (see it now at the bottom of the code block)

    ReplyDelete
  5. Does this not work with the latest version? It doesn't seem to do anything for me.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Oops, I'm dumb, sorry. I didn't realize that this fix doesn't work with mouse re-positioning, only the windows+left/right shortcut. Sorry and thank you!!

      Delete