Initial commit
Signed-off-by: jolheiser <john.olheiser@gmail.com>main latest
commit
4683de4c6e
|
@ -0,0 +1 @@
|
|||
.idea/
|
|
@ -0,0 +1,30 @@
|
|||
pipeline:
|
||||
compile-main:
|
||||
image: jolheiser/woodpecker-ahk:latest
|
||||
settings:
|
||||
script: src/WindowUtils.ahk
|
||||
icon: icon.ico
|
||||
out: src/WindowUtils.exe
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
compile-installer:
|
||||
image: jolheiser/woodpecker-ahk:latest
|
||||
settings:
|
||||
script: src/WindowUtils-Install.ahk
|
||||
icon: icon.ico
|
||||
out: src/WindowUtils-Install.exe
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
release-main:
|
||||
image: jolheiser/drone-gitea-main:latest
|
||||
settings:
|
||||
base: https://git.jojodev.com
|
||||
token:
|
||||
from_secret: gitea_token
|
||||
files:
|
||||
- "src/WindowUtils-Install.exe"
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2022 John Olheiser
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,9 @@
|
|||
# WindowUtils
|
||||
|
||||
![icon](icon.ico)
|
||||
|
||||
An AHK script that enhances the mouse side buttons for dragging windows around.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
|
@ -0,0 +1,16 @@
|
|||
#Include options.ahk
|
||||
|
||||
GoSub, CheckInstall
|
||||
|
||||
return
|
||||
|
||||
CheckInstall:
|
||||
FileCreateDir, %k_base%
|
||||
FileInstall, config.ini, %k_config%, 0
|
||||
FileInstall, WindowUtils.exe, %k_base%\WindowUtils.exe, 1
|
||||
MsgBox, 36, WindowUtils, Installed successfully!`nWould you like to start WindowUtils?
|
||||
IfMsgBox, Yes
|
||||
{
|
||||
Run, %k_base%\WindowUtils.exe
|
||||
}
|
||||
return
|
|
@ -0,0 +1,103 @@
|
|||
#SingleInstance FORCE
|
||||
#Include options.ahk
|
||||
|
||||
Menu, TRAY, Tip, WindowUtils
|
||||
Menu, TRAY, NoStandard
|
||||
Menu, TRAY, add, About, About
|
||||
Menu, TRAY, add, Invert Keys, Invert
|
||||
Menu, TRAY, add
|
||||
Menu, TRAY, add, Close WindowUtils, Close
|
||||
|
||||
SetWinDelay,2
|
||||
|
||||
CoordMode,Mouse
|
||||
|
||||
k_inverted=
|
||||
|
||||
GoSub, hotkeys
|
||||
|
||||
return
|
||||
|
||||
hotkeys:
|
||||
IniRead, k_inverted, %k_config%, Settings, Inverted
|
||||
if k_inverted
|
||||
{
|
||||
Menu, TRAY, check, Invert Keys
|
||||
k_key1=XButton2
|
||||
k_key2=XButton1
|
||||
} else {
|
||||
Menu, TRAY, uncheck, Invert Keys
|
||||
k_key1=XButton1
|
||||
k_key2=XButton2
|
||||
}
|
||||
HotKey, %k_key1%, key1
|
||||
HotKey, %k_key2%, key2
|
||||
return
|
||||
|
||||
Invert:
|
||||
if k_inverted
|
||||
{
|
||||
k_inverted := false
|
||||
} else {
|
||||
k_inverted := true
|
||||
}
|
||||
IniWrite, %k_inverted%, %k_config%, Settings, Inverted
|
||||
GoSub, hotkeys
|
||||
return
|
||||
|
||||
key1:
|
||||
; Get the initial mouse position and window id, and
|
||||
; abort if the window is maximized.
|
||||
MouseGetPos,KDE_X1,KDE_Y1,KDE_id
|
||||
WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
|
||||
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 300)
|
||||
WinMinimize, ahk_id %KDE_id%
|
||||
else if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 1000)
|
||||
WinRestore, ahk_id %KDE_id%
|
||||
return
|
||||
|
||||
key2:
|
||||
|
||||
; Get the initial mouse position and window id, and
|
||||
; abort if the window is maximized.
|
||||
MouseGetPos,KDE_X1,KDE_Y1,KDE_id
|
||||
WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
|
||||
; Get the initial window position.
|
||||
WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id%
|
||||
WinActivate, ahk_id %KDE_id%
|
||||
WinRestore, ahk_id %KDE_id%
|
||||
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 500)
|
||||
{
|
||||
WinMaximize, ahk_id %KDE_id%
|
||||
return
|
||||
}
|
||||
Loop
|
||||
{
|
||||
GetKeyState,KDE_Button,%k_key2%,P ; Break if button has been released.
|
||||
If KDE_Button = U
|
||||
{
|
||||
If KDE_Win
|
||||
{
|
||||
WinMaximize, ahk_id %KDE_id%
|
||||
}
|
||||
break
|
||||
}
|
||||
MouseGetPos,KDE_X2,KDE_Y2 ; Get the current mouse position.
|
||||
KDE_X2 -= KDE_X1 ; Obtain an offset from the initial mouse position.
|
||||
KDE_Y2 -= KDE_Y1
|
||||
KDE_WinX2 := (KDE_WinX1 + KDE_X2) ; Apply this offset to the window position.
|
||||
KDE_WinY2 := (KDE_WinY1 + KDE_Y2)
|
||||
WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% ; Move the window to the new position.
|
||||
}
|
||||
return
|
||||
|
||||
|
||||
Close:
|
||||
MsgBox, 52, WindowUtils, Are you sure you want to close WindowUtils?
|
||||
IfMsgBox, YES
|
||||
ExitApp
|
||||
return
|
||||
|
||||
About:
|
||||
MsgBox,, WindowUtils, WindowUtils is designed to make moving windows easier.`nNOTE: WindowUtils will change the window to a box for easier moving, but will remember if it was full-screen to start with and restore it after.`n`nButtons Used -`nFirst extra mouse button (generally a shortcut for 'back')`nSecond extra mouse button (generally a shortcut for 'forward')`n`nFunction 1: By holding the first extra button on your mouse, you can move a window from anywhere inside its' border.`n`nFunction 2: By double-clicking the first extra mouse button, you can maximize a window.`n`nFunction 3: By slowly double clicking the second extra button on your mouse, you can 'box' a window.`n`nFunction 4: By quickly double clicking the second extra button on your mouse, you can minimize a window.`n`n`nGive it a try with this window!
|
||||
return
|
|
@ -0,0 +1,2 @@
|
|||
[Settings]
|
||||
inverted=false
|
|
@ -0,0 +1,2 @@
|
|||
k_base=C:\Applications\WindowUtils
|
||||
k_config=%k_base%\config.ini
|
Loading…
Reference in New Issue