Window Management Utility for 4K Monitors

Hello,

So, playing around with windows on my AMH A409U, I realised that I need some kind of window management software. So, I've written a tiny script for an utility called AutoHotKey, and these are the compiled executables, for both 64-bit and 32-bit systems:

4K64 for 64-bit systems only

4K32 for 32-bit systems

For some reason Chrome blocks the download and informs users these files are malicious, I assure you they're clean. But in case people are suspicious, see the post below for the source code.

What the utility does is create a few hot key combinations that will reposition and resize windows around your 4K screen in order to use all that space more efficiently.

Ctrl + Alt + 1 - first third of the horizontal space, full vertical height
Ctrl + Alt + 2 - second third of the horizontal space, full vertical height
Ctrl + Alt + 3 - last third of the horizontal space, full vertical height
Ctrl + Alt + 4 - first third of the horizontal space, top half vertical height
Ctrl + Alt + 5 - second third of the horizontal space, top half vertical height
Ctrl + Alt + 6 - third third of the horizontal space, top half vertical height
Ctrl + Alt + 7 - first third of the horizontal space, bottom half vertical height
Ctrl + Alt + 8 - second third of the horizontal space, bottom half vertical height
Ctrl + Alt + 9 - last third of the horizontal space, bottom half vertical height

And as a bonus, for people with win-keyless keyboards:

Ctrl + Alt + Spacebar - Show Desktop

The utility works with any size and any position (top, bottom, left, right) of the taskbar. I haven't tested it on multi monitors and I don't really intend to provide support for this use case. You don't necessarily need a 4K screen for this, the utility works just fine with other resolutions, but with lower ones, 2560x1600 and below, I don't see the point in using it.

For now, the utility works for landscape orientations. The only way I see that I could make it work for portrait orientations is for three stacked windows. If there are requests, I could implement any ideas that I deem valuable.

Use at your own risk, I will not be held responsible for the misuse or any problems that can be associated with this utility.

1 Like

I had a request to post the source code, here it is:

^!1::
WinWait, A
GoLMR(0)
Return

^!2::
WinWait, A
GoLMR(1)
Return

^!3::
WinWait, A
GoLMR(2)
Return

^!4::
WinWait, A
GoTopLMR(0)
Return

^!5::
WinWait, A
GoTopLMR(1)
Return

^!6::
WinWait, A
GoTopLMR(2)
Return

^!7::
WinWait, A
GoBottomLMR(0)
Return

^!8::
WinWait, A
GoBottomLMR(1)
Return

^!9::
WinWait, A
GoBottomLMR(2)
Return

^!Space::
KeyWait, Space
Send, {SC15B Down}{SC020}{SC15B Up}
Return

GoLMR(Pos) {
	TaskbarEdge := GetTaskbarEdge(TW, TH)
	If (TaskbarEdge = "bottom") {
		ScreenW := A_ScreenWidth
		ScreenH := A_ScreenHeight - TH
		WinMove, Round(Pos * (ScreenW / 3)), 0
		ResizeWin(Round(ScreenW / 3), ScreenH)
	} Else
	If (TaskbarEdge = "top") {
		ScreenW := A_ScreenWidth
		ScreenH := A_ScreenHeight - TH
		WinMove, Round(Pos * (ScreenW / 3)), TH
		ResizeWin(Round(ScreenW / 3), ScreenH)
	} Else
	If (TaskbarEdge = "left") {
		ScreenW := A_ScreenWidth - TW
		ScreenH := A_ScreenHeight
		WinMove, Round(Pos * (ScreenW / 3) + TW), 0
		ResizeWin(Round(ScreenW / 3), ScreenH)
	} Else
	If (TaskbarEdge = "right") {
		ScreenW := A_ScreenWidth - TW
		ScreenH := A_ScreenHeight
		WinMove, Round(Pos * (ScreenW / 3)), 0
		ResizeWin(Round(ScreenW / 3), ScreenH)
	}
}

GoTopLMR(Pos) {
	TaskbarEdge := GetTaskbarEdge(TW, TH)
	If (TaskbarEdge = "bottom") {
		ScreenW := A_ScreenWidth
		ScreenH := A_ScreenHeight - TH
		WinMove, Round(Pos * (ScreenW / 3)), 0
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	} Else
	If (TaskbarEdge = "top") {
		ScreenW := A_ScreenWidth
		ScreenH := A_ScreenHeight - TH
		WinMove, Round(Pos * (ScreenW / 3)), TH
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	} Else
	If (TaskbarEdge = "left") {
		ScreenW := A_ScreenWidth - TW
		ScreenH := A_ScreenHeight
		WinMove, Round(Pos * (ScreenW / 3) + TW), 0
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	} Else
	If (TaskbarEdge = "right") {
		ScreenW := A_ScreenWidth - TW
		ScreenH := A_ScreenHeight
		WinMove, Round(Pos * (ScreenW / 3)), 0
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	}
}

GoBottomLMR(Pos) {
	TaskbarEdge := GetTaskbarEdge(TW, TH)
	If (TaskbarEdge = "bottom") {
		ScreenW := A_ScreenWidth
		ScreenH := A_ScreenHeight - TH
		WinMove, Round(Pos * (ScreenW / 3)), Round(ScreenH / 2)
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	} Else
	If (TaskbarEdge = "top") {
		ScreenW := A_ScreenWidth
		ScreenH := A_ScreenHeight - TH
		WinMove, Round(Pos * (ScreenW / 3)), Round(TH + (ScreenH / 2))
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	} Else
	If (TaskbarEdge = "left") {
		ScreenW := A_ScreenWidth - TW
		ScreenH := A_ScreenHeight
		WinMove, Round(Pos * (ScreenW / 3) + TW), Round(ScreenH / 2)
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	} Else
	If (TaskbarEdge = "right") {
		ScreenW := A_ScreenWidth - TW
		ScreenH := A_ScreenHeight
		WinMove, Round(Pos * (ScreenW / 3)), Round(ScreenH / 2)
		ResizeWin(Round(ScreenW / 3), Round(ScreenH / 2))
	}
}

ResizeWin(Width, Height) {
	WinGetPos, X, Y, W, H, A
	If (Width = 0) {
		Width := W
	}
	If (Height = 0) {
		Height := H
	}
	WinMove, A, , X, Y, Width, Height
}

GetTaskbarEdge(ByRef TW, ByRef TH) {
	WinGetPos, TX, TY, TW, TH, ahk_class Shell_TrayWnd, , ,
	If (TW = A_ScreenWidth) {
		If (TY = 0) {
			Return "top"
		} Else {
			Return "bottom"
		}
	} else {
		If (TX = 0) {
			Return "left"
		} Else {
			Return "right"
		}
	}
}

You can use AutoHotKey to compile your own executables, just save this code in a text file with the extension .ahk.

reserved