3 ms·
The simplest way is 1 hotkey for specific position. For my first attempt, using my arrow cluster, I divided my screen in roughly third: - top left: win+pageup
by csdvrx 3y ago
The simplest way is 1 hotkey for specific position.
For my first attempt, using my arrow cluster, I divided my screen in roughly third:
- top left: win+pageup
- bottom left win+left
- top center: win+up
- bottom center: win+down
- top right: win+pagedown
- bottom right: win+down
Then you just remove the decorations and put windows there, using the coordinates you get.
You can also create toggles, here's a simple one:
WinGetPos, X, Y, Width, Height, A
;MsgBox, is at %X%`,%Y%
if (X == 1800-640) {
WinMove,A,, 0,0, 1800, 1200
} else {
WinMove,A,, 1800-640, 1200-480, 640, 480
}
Extend the logic to use more (or less) of the 3x2 grid.
If you prefer to keep some windows floating:
; Get window style
WinGet, S, Style, A
if (S & 0x00C00000) {
; If not borderless, toggle all:
; 0xC00000:border, 0x40000:resize border, 0x00000200:WS_EX_CLIENTEDGE
WinSet, Style, -0xC40200, A
Winset, Alwaysontop, On, A
} else {
WinSet, Style, +0xC40200, A
Winset, Alwaysontop, Off, A
}
You can automatize more by hooking to events like OnMessage(WM_DISPLAYCHANGE, "displayChange") which will trigger the function when you move from tablet to portrait mode: just adapt the dimensions.
Look on the forums and you will find plenty of such examples. I've now moved to Linux and roughly replicated some of my setting using hyprland (wayland), but there are many things I miss from AHK
BTW, for the dlls, here's an example of how on Windows 10 the taskbar could be programmatically changed to small icons, then refreshed:
DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 0, UInt,4, UInt,0)
DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 4, UInt,4, UInt,0)
DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 8, UInt,4, UInt,A_ScreenWidth)
DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 12,UInt,4, UInt,Top)
DllCall("SystemParametersInfo", UInt,0x2F, UInt,0, UInt,&area, UInt,0)
Think of that more or less like changing the CSS then sending `pkill -USR1 waybar`