Created
July 20, 2013 08:24
-
-
Save budRich/6044306 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
MaxPin | |
budRich 2013 | |
Pin maximized windows to desktop. | |
Makes sure only one window is maximized at the same time. | |
Changes transparency for predefined windows. | |
*/ | |
#Persistent | |
; Windows in this list will be transparent when maximized. | |
MaxTransClass := "Notepad,ConsoleWindowClass" | |
; Amount of transparency | |
MaxTrans := 195 | |
; Lets make sure there is no more than one window maximized before we start. | |
MinimizeMaximized() | |
SetTimer, ActiveWindowTimer, 500 | |
Return | |
ActiveWindowTimer: | |
WinGet, awID, ID, A | |
WinGetClass, awC, ahk_id %awID% | |
WinGet, awMaxed , MinMax, ahk_id %awID% | |
WinGet, mpMaxed , MinMax, ahk_id %MaxPowers% | |
if (mpMaxed != 1) { | |
if (MaxPowers != "") { | |
Sleep, 22 | |
WinGet, mpMaxed , MinMax, ahk_id %MaxPowers% | |
if (mpMaxed != 1) { | |
WinSet, Trans, Off, ahk_id %MaxPowers% | |
MaxPowers := "" | |
} | |
} | |
} | |
if (awMaxed = 1) { | |
WinGetClass, mpC, ahk_id %MaxPowers% | |
WinSet, Bottom,, ahk_id %MaxPowers% | |
WinSet, AlwaysOnTop, Off, ahk_id %MaxPowers% | |
if (awID != MaxPowers){ | |
WinSet, AlwaysOnTop, Off, ahk_id %MaxPowers% | |
if awC in %MaxTransClass% | |
{ | |
WinSet, Trans, %MaxTrans%, ahk_id %awID% | |
} | |
WinMinimize, ahk_id %MaxPowers% | |
MaxPowers := awID | |
WinMaximize, ahk_id %nAId% | |
WinSet, AlwaysOnTop, Off, ahk_id %nAId% | |
;WinSet, bottom,, ahk_id %nAId% | |
} | |
} | |
return | |
MinimizeMaximized() { | |
hw := A_DetectHiddenWindows | |
rid:="" | |
DetectHiddenWindows, On | |
mmchk=0 | |
WinGet, list, list | |
loop, %list% | |
{ | |
wid := list%A_Index% | |
WinGet, es, ExStyle, ahk_id %wid% | |
WinGet, nAX , MinMax, ahk_id %wid% | |
; -1: The window is minimized (WinRestore can unminimize it). | |
; 1: The window is maximized (WinRestore can unmaximize it). | |
; 0: The window is neither minimized nor maximized. | |
WinGetClass, ttlMaxChk, ahk_id %wid% | |
if ((nAX=1) and ! DllCall( "GetWindow", "uint", aId, "uint", GW_OWNER ) and ! ( es & WS_EX_TOOLWINDOW )) or ((nAX=1) and ( es & WS_EX_APPWINDOW )) | |
{ | |
;~ If ttlMaxChk not in %lstAmc% | |
mmchk++ | |
if (mmchk>1) { | |
WinMinimize, ahk_id %wid% | |
} | |
rid := wid | |
} | |
} | |
DetectHiddenWindows, %hw% | |
Return, %rid% | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good