Last active
November 4, 2022 23:04
-
-
Save stef-levesque/8927e17217fe2fd3e48d to your computer and use it in GitHub Desktop.
Revisions
-
stef-levesque revised this gist
Dec 10, 2015 . 1 changed file with 70 additions and 40 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,56 +1,86 @@ ; FIND IN GOOGLE LWIN & f:: Send, ^c Sleep 50 Run, http://www.google.com/search?q=%clipboard% return ; SAVE/RESTORE WINDOW SIZE & LOCATION ;LAlt & LShift & 1:: !+1:: WinGet, ID1, ID, A WinGetPos, X1, Y1, W1, H1, ahk_id %ID1% MsgBox, The active window %ID1% is at %X1%`,%Y1%-%W1%`,%H1% return ;LAlt & 1:: !1:: WinShow, ahk_id %ID1% WinMove, ahk_id %ID1%,, X1, Y1, W1, H1 return ; VIRTUAWIN SHORTCUTS LWIN & WheelDown:: Send, ^!{Down} LWIN & WheelUp:: Send, ^!{Up} ; TOGGLE WINDOW MAXIMIZE-RESTORE LWIN & XButton1:: MouseGetPos,,,EWD_MouseWin WinRestore, ahk_id %EWD_MouseWin% return LWIN & XButton2:: MouseGetPos,,,EWD_MouseWin WinMaximize, ahk_id %EWD_MouseWin% return ; TOGGLE TITLE BAR LWIN & RButton:: MouseGetPos,,,EWD_MouseWin WinGet, Style, Style, ahk_id %EWD_MouseWin% ; A for active window if (Style & 0xC00000) WinSet, Style, -0xC00000, ahk_id %EWD_MouseWin% else WinSet, Style, +0xC00000, ahk_id %EWD_MouseWin% return ; CLOSE WINDOW LWIN & MButton:: MouseGetPos,,,EWD_MouseWin WinKill, ahk_id %EWD_MouseWin% ; A for active window return ; MOVE WINDOW LWIN & LButton:: CoordMode, Mouse ; Switch to screen/absolute coordinates. MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin% WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% if EWD_WinState = 0 ; Only if the window isn't maximized SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it. return EWD_WatchMouse: GetKeyState, EWD_LButtonState, LButton, P if EWD_LButtonState = U ; Button has been released, so drag is complete. { SetTimer, EWD_WatchMouse, off return } GetKeyState, EWD_EscapeState, Escape, P if EWD_EscapeState = D ; Escape has been pressed, so drag is cancelled. { SetTimer, EWD_WatchMouse, off WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY% return } ; Otherwise, reposition the window to match the change in mouse coordinates ; caused by the user having dragged the mouse: CoordMode, Mouse MouseGetPos, EWD_MouseX, EWD_MouseY WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin% SetWinDelay, -1 ; Makes the below move faster/smoother. WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine. EWD_MouseStartY := EWD_MouseY return -
stef-levesque revised this gist
Dec 4, 2015 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,25 @@ ; FIND IN GOOGLE LWIN & f:: Send, ^c ; Copy selection to clipboard Sleep 50 Run, http://www.google.com/search?q=%clipboard% return ; REMOVE TITLE BAR LWIN & LButton:: MouseGetPos,,,EWD_MouseWin WinSet, Style, -0xC00000, ahk_id %EWD_MouseWin% ; use A for active window return ; SHOW TITLE BAR LWIN & RButton:: MouseGetPos,,,EWD_MouseWin WinSet, Style, +0xC00000, ahk_id %EWD_MouseWin% return ; MOVE WINDOW LWIN & MButton:: CoordMode, Mouse ; Switch to screen/absolute coordinates. -
stef-levesque created this gist
Dec 4, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ ; FIND IN GOOGLE LWIN & f:: Send, ^c Sleep 50 Run, http://www.google.com/search?q=%clipboard% return ; REMOVE TITLE BAR LWIN & LButton:: MouseGetPos,,,EWD_MouseWin WinSet, Style, -0xC00000, ahk_id %EWD_MouseWin% ; A for active window return ; SHOW TITLE BAR LWIN & RButton:: ; SetTitleMatchMode, 2 ; WinGetPos, X, Y, Width, Height, A MouseGetPos,,,EWD_MouseWin WinSet, Style, +0xC00000, ahk_id %EWD_MouseWin% ; WinMove,A,,0,0,1920,1080 return ; MOVE WINDOW LWIN & MButton:: CoordMode, Mouse ; Switch to screen/absolute coordinates. MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin% WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% if EWD_WinState = 0 ; Only if the window isn't maximized SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it. return EWD_WatchMouse: GetKeyState, EWD_MButtonState, MButton, P if EWD_MButtonState = U ; Button has been released, so drag is complete. { SetTimer, EWD_WatchMouse, off return } GetKeyState, EWD_EscapeState, Escape, P if EWD_EscapeState = D ; Escape has been pressed, so drag is cancelled. { SetTimer, EWD_WatchMouse, off WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY% return } ; Otherwise, reposition the window to match the change in mouse coordinates ; caused by the user having dragged the mouse: CoordMode, Mouse MouseGetPos, EWD_MouseX, EWD_MouseY WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin% SetWinDelay, -1 ; Makes the below move faster/smoother. WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine. EWD_MouseStartY := EWD_MouseY return