It is currently April 20th, 2024, 1:20 am

Simple, HighDPI compliant alternative to Desktop Coral and WorkSpace Utilities. [AHK]

Share and get help with Plugins and Addons
User avatar
_3D_
Posts: 16
Joined: July 25th, 2020, 12:46 pm
Location: London, UK.

Simple, HighDPI compliant alternative to Desktop Coral and WorkSpace Utilities. [AHK]

Post by _3D_ »

I was having issues with Desktop Coral and HighDPi, as well as not being fond of it being nagware, I also found Workspace Utilities but that doesn't seem to work at all, at least for HighDPi. So Ive been hunting for an alternative method to set the work area.

After much searching i came across this post on the AutoHotkey forum, with an example that seemed to actually work, albeit not quite right since it has a message box etc.

I managed to re-shape it in to a little AutoHotkey script that draws an invisible window that seems to successfully reserve the area, and prevent other windows from overlapping it when they are maximized:

Code: Select all

;------------------------------------------------------
;Save as filename: ReserveScreenSpace.ahk
;------------------------------------------------------
;Based on code by AutoHotkey forum user "shimanov"
;Prevent 175 pixels from the bottom of the screen from being overlapped by maximised windows.
;Exit via icon in system tray.
#Persistent

w := A_ScreenWidth
h := 175

x := 0
y := A_ScreenHeight-h

Gui, +AlwaysOnTop -Caption
Gui, Show, x%x% y%y% w%w% h%h%
;Prevents the script from being shown in Alt-Tab window.
WinSet, ExStyle, ^0x80, ReserveScreenSpace.ahk
;Set it to transparent (0) - (255) Opaque.
WinSet, Transparent , 0, ReserveScreenSpace.ahk
;Uncommenting these next two lines will also hide the taskbar:
;WinHide, ahk_class Shell_TrayWnd
;WinHide, Start ahk_class Button

EncodeInteger( A_ScreenWidth, 4, &area, 8 )
EncodeInteger( A_ScreenHeight-h, 4, &area, 12 )

DllCall( "SystemParametersInfo", "uint", 0x2F, "uint", 0, "uint", &area, "uint", 0 )

EncodeInteger( p_value, p_size, p_address, p_offset )
{
	loop, %p_size%
		DllCall( "RtlFillMemory"
			, "uint", p_address+p_offset+A_Index-1
			, "uint", 1
			, "uchar", ( p_value >> ( 8*( A_Index-1 ) ) ) & 0xFF )
			DllCall( "SystemParametersInfo", "uint", 0x2F, "uint", 0, "uint", &area, "uint", 0 )
}
;------------------------------------------------------
;------------------------------------------------------
Ive been forced to start to learn AutoHotkey only today, so i don't understand the code and have only commented on the lines i added myself. Perhaps this script will be useful to some folks here, and hopefully even inspire some improvements from those that know how.
Yellow on white is seldom a good idea.
My DeviantArt Page
ariefcfa
Posts: 18
Joined: October 7th, 2012, 3:37 pm

Re: Simple, HighDPI compliant alternative to Desktop Coral and WorkSpace Utilities. [AHK]

Post by ariefcfa »

Wow, thanks! This almost solve my issue with Windows Task View when using Desktop Coral. However, kindly after the script run for some minutes, Windows Task View crash again.

In my case, when the script run, a white bar appear at the bottom of the screen, and the program icon appear in the taskbar. I close the window by adding new line of code below:

Code: Select all

WinClose,<name of .ahk script file>,,2,,
(I don't know what I'm doing, but now the white bar not showing anymore, and no taskbar icon for the script)

Another issue, Windows Snap no longer suggest a window to snap at the other half of the screen.

I hope this script get attention for improvements. Thanks