Last active
December 20, 2015 15:58
-
-
Save dimm0k/6157627 to your computer and use it in GitHub Desktop.
This file contains 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
;Linear Spoon - http://www.autohotkey.com/board/topic/96036-setting-always-on-top-via-left-mouse-button-hold/?p=604824 | |
;emulate Preme's always_on_top toggle. code began with AcidStrike@freenode#ahk, then modified by Linear Spoon | |
MoveThreshold = 30 ;# pixels the mouse can move and still toggle | |
TimeRequired = 1 ;# seconds required to toggle (can have a decimal part such as 1.5) | |
CoordMode, Mouse | |
return | |
~LButton:: | |
MouseGetPos, OutX, OutY, OutWin | |
KeyWait, LButton, U T%TimeRequired% | |
MouseGetPos, CurX, CurY, CurWin | |
If (Abs(CurX-OutX) > MoveThreshold || Abs(CurY-OutY) > MoveThreshold || CurWin != OutWin) | |
return | |
If ErrorLevel | |
{ | |
WinSet, AlwaysOnTop, Toggle, ahk_id %OutWin% | |
WinGet, ExStyle, ExStyle, ahk_id %OutWin% | |
Tooltip, % "Always-On-Top: " (ExStyle & 0x8 ? "En" : "Dis") "abled " OutWin | |
;Negative timer here means "Run only once" | |
SetTimer, RemoveToolTip, -2000 | |
} | |
Return | |
RemoveToolTip: | |
ToolTip | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment