Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Transparent and/or Always On Top


  • Please log in to reply
16 replies to this topic
Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

any feedback on nordanalt's version?



sasquatch
  • Members
  • 23 posts
  • Last active: Jul 14 2016 03:45 PM
  • Joined: 05 Feb 2015

Works fine, but is more functional when you change transparency via (alt+)mouse roll:

#InstallKeybdHook
#SingleInstance force
/*
Hotkeys:
Alt-A: make window always on top

Alt-wheelup: make window less transparent
Alt-wheeldown: make window more transparent

Alt-X: make window clickthoughable
Alt-Z: make window under mouse unclickthroughable
*/
winArr := Object()
OnExit, Exit

!a::
WinGet, currentWindow, ID, A
addToWinArr(currentWindow)
WinGet, ExStyle, ExStyle, ahk_id %currentWindow%
if (ExStyle & 0x8)  ; 0x8 is WS_EX_TOPMOST.
{
    Winset, AlwaysOnTop, off, ahk_id %currentWindow%
    SplashImage,, x0 y0 b fs12, OFF always on top.
    Sleep, 1500
    SplashImage, Off
}
else
{
    WinSet, AlwaysOnTop, on, ahk_id %currentWindow%
    SplashImage,,x0 y0 b fs12, ON always on top.
    Sleep, 1500
    SplashImage, Off
}
return

!wheelup::
WinGet, currentWindow, ID, A
addToWinArr(currentWindow)
if not (%currentWindow%)
{
    %currentWindow% := 255
}
if (%currentWindow% != 255)
{
    %currentWindow% += 5
    WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
}
SplashImage,,w100 x0 y0 b fs12, % %currentWindow%
SetTimer, TurnOffSI, 1000, On
Return

!wheeldown::
SplashImage, Off
WinGet, currentWindow, ID, A
addToWinArr(currentWindow)
if not (%currentWindow%)
{
    %currentWindow% := 255
}
if (%currentWindow% != 5)
{
    %currentWindow% -= 5
    WinSet, Transparent, % %currentWindow%, ahk_id %currentWindow%
}
SplashImage,, w100 x0 y0 b fs12, % %currentWindow%
SetTimer, TurnOffSI, 1000, On
Return

!x::
WinGet, currentWindow, ID, A
addToWinArr(currentWindow)
WinSet, ExStyle, +0x80020, ahk_id %currentWindow%
return

!z::
MouseGetPos,,, MouseWin ; Gets the unique ID of the window under the mouse
addToWinArr(MouseWin)
WinSet, ExStyle, -0x80020, ahk_id %currentWindow%
Return

TurnOffSI:
SplashImage, off
SetTimer, TurnOffSI, 1000, Off
Return

addToWinArr(chwnd){
    global winArr
    if (!winArr.hasKey(chwnd))
        winArr[chwnd] := true
}

Exit:
    for currentWindow, b in winArr
    {
        WinSet, ExStyle, -0x80020, ahk_id %currentWindow%
        WinSet, Trans, 255, ahk_id %currentWindow%
        Winset, AlwaysOnTop, off, ahk_id %currentWindow%
    }
    ExitApp
return

I'd also prefere to have one combination of keys for toggle between clickthroughable/unclickthroughable, instead of using two: Alt-X and Alt-Z, but... :/ :/ ...I can't do it... :(