I'm not quite sure how mine works, it's just a batch script that is made of some clips of code I took from the internet but here ya go.
:: Settings: 0) Enable, 1) Disable
@echo off
set /p setting=<"C:\Auto-hide Taskbar CLI\currentSettings.txt"
echo %setting%
if %setting%==0 (
powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=3;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
del "C:\Auto-hide Taskbar CLI\currentSettings.txt"
echo 1 1> "C:\Auto-hide Taskbar CLI\currentSettings.txt"
)
if %setting%==1 (
powershell -command "&{$p='HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3';$v=(Get-ItemProperty -Path $p).Settings;$v[8]=2;&Set-ItemProperty -Path $p -Name Settings -Value $v;&Stop-Process -f -ProcessName explorer}"
del "C:\Auto-hide Taskbar CLI\currentSettings.txt"
echo 0 1> "C:\Auto-hide Taskbar CLI\currentSettings.txt"
)
Basically it just calls up powershell and changes the settings of the registry key that is supposed to control the auto-hide settings (built on windows 10). It then keeps the current settings in a text file so I can create somekind of switch. I then use the iexpress program from System32 to create an exe of it, and so I can make a silent run of the batch. I create a shortcut of the exe (.lnk) and assign a keyboard shortcut to it. The problem I have with it is that it restarts the explorer, which hinders my work.
Update, I found a autohotkey script that does well. Here's the code
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
VarSetCapacity(APPBARDATA, A_PtrSize=4 ? 36:48)
Lctrl & MButton::
NumPut(DllCall("Shell32\SHAppBarMessage", "UInt", 4 ; ABM_GETSTATE
, "Ptr", &APPBARDATA
, "Int")
? 2:1, APPBARDATA, A_PtrSize=4 ? 32:40) ; 2 - ABS_ALWAYSONTOP, 1 - ABS_AUTOHIDE
, DllCall("Shell32\SHAppBarMessage", "UInt", 10 ; ABM_SETSTATE
, "Ptr", &APPBARDATA)
KeyWait, % A_ThisHotkey
Return
The shortcut for this is the left ctrl and the middle mouse button or the scroll button. To change the hotkey change this part "Lctrl & MButton::"
The only problem from this is that if you have virtual desktop enabled and have multiple chrome windows open on each virtual desktop, it would shuffle the virtual desktop, so you'd be teleporting, this happens sometimes only.