TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
I am not sure about 3 monitors, but I think you'll want to give this a try:
replace the Shell_TrayWnd with Shell_SecondaryTrayWnd in the code in the quote.
replace the Shell_TrayWnd with Shell_SecondaryTrayWnd in the code in the quote.
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
-
- Posts: 23
- Joined: 26 Jul 2019, 06:41
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
I guess you need to run it for each monitor... I am not sure what you do for the 3rd monitor...
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
@10inchOfSnow
@joedf
This should work on any monitor.
@joedf
Code: Select all
TaskBar_SetAttr(accent_state := 0, gradient_color := "0x01000000")
{
static init, hTrayWnd, ver := DllCall("GetVersion") & 0xff < 10
static pad := A_PtrSize = 8 ? 4 : 0, WCA_ACCENT_POLICY := 19
accent_size := VarSetCapacity(ACCENT_POLICY, 16, 0)
NumPut((accent_state > 0 && accent_state < 4) ? accent_state : 0, ACCENT_POLICY, 0, "int")
if (accent_state >= 1) && (accent_state <= 2) && (RegExMatch(gradient_color, "0x[[:xdigit:]]{8}"))
NumPut(gradient_color, ACCENT_POLICY, 8, "int")
VarSetCapacity(WINCOMPATTRDATA, 4 + pad + A_PtrSize + 4 + pad, 0)
&& NumPut(WCA_ACCENT_POLICY, WINCOMPATTRDATA, 0, "int")
&& NumPut(&ACCENT_POLICY, WINCOMPATTRDATA, 4 + pad, "ptr")
&& NumPut(accent_size, WINCOMPATTRDATA, 4 + pad + A_PtrSize, "uint")
WinGet, hTrayWnd,, ahk_class Shell_TrayWnd
if !(DllCall("user32\SetWindowCompositionAttribute", "ptr", hTrayWnd, "ptr", &WINCOMPATTRDATA))
throw Exception("Failed to set transparency / blur", -1)
WinGet, hMultipleMonitor, List, ahk_class Shell_SecondaryTrayWnd
if(hMultipleMonitor)
{
Loop % hMultipleMonitor {
if !(DllCall("user32\SetWindowCompositionAttribute", "ptr", hMultipleMonitor%A_Index% , "ptr", &WINCOMPATTRDATA))
throw Exception("Failed to set transparency / blur 2", -1)
}
}
return true
}
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
Thanks for sharing @farse !
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
-
- Posts: 493
- Joined: 03 Dec 2018, 20:02
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
I don't really fancy the wasteful SetTimer approach for the Start Menu workaround. Without getting too complicated by listening to window events here's a really simple approach I figured:
Edit: Guys I discovered a sad truth. It looks like WinWait is also essentially polling which makes it no different than SetTimer
Code: Select all
SetBatchLines -1
UPDATE_TASKBAR()
loop {
WinWaitActive ahk_class Windows.UI.Core.CoreWindow
UPDATE_TASKBAR()
WinWaitNotActive ahk_class Windows.UI.Core.CoreWindow
UPDATE_TASKBAR()
hA := WinActive("A")
WinWaitNotActive % "ahk_id" hA
UPDATE_TASKBAR()
}
return
UPDATE_TASKBAR() {
TaskBar_SetAttr(3)
}
Last edited by william_ahk on 17 Aug 2022, 06:32, edited 2 times in total.
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
Oooouuu event based yes please.
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Re: TaskBar_SetAttr - translucent / blur / coloring Windows TaskBar
@jNizM: Thanks for sharing
Tested on Windows 11 64Bit German. Found out when use both commands successively:
No settimer-coding is needed to prevent loosing taskbar-transparency by clicking the startbutton or pressing the win-button.
Be sure the transparency under display-settings is off before.
Cheers moefr01
Tested on Windows 11 64Bit German. Found out when use both commands successively:
Code: Select all
…
TaskBar_SetAttr(1)
TaskBar_SetAttr(2)
ExitApp
…
Be sure the transparency under display-settings is off before.
Cheers moefr01