ramensoftware / windhawk-mods

The official collection of Windhawk mods
307 stars 56 forks source link

[Windows 11 Taskbar Styler] Minimize/restore malfunction on 2nd monitor #1141

Open immortalx74 opened 2 weeks ago

immortalx74 commented 2 weeks ago

@https://github.com/m417z

NOTE: This issue only happens on the taskbar of the 2nd monitor!

When the mod in enabled, the Windows feature of clicking an open app in the taskbar to minimize/restore, sometimes needs 4 or 5 clicks to work. I can't reproduce it consistently, but it seems it is triggered when you have a couple of apps open and try to minimize/restore them interchangeably a couple of times.

I made sure to stop the debug logging right after the issue was triggered. Hope that helps and thank you for this awesome mod! debug.txt

m417z commented 2 weeks ago

Does it happen when no styles are used? If not, can you find out which style causes it?

immortalx74 commented 2 weeks ago

You're right, it seems to be the style. I use a custom one based on other styles. Here it is:

{
    "controlStyles[0].target": "Rectangle#BackgroundFill",
    "controlStyles[0].styles[0]": "Fill:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0\" TintLuminosityOpacity=\"0.15\" Opacity=\"1\" FallbackColor=\"#702626AA\"/>",
    "controlStyles[1].target": "Rectangle#BackgroundStroke",
    "controlStyles[1].styles[0]": "Visibility=Collapsed",
    "controlStyles[2].target": "MenuFlyoutPresenter",
    "controlStyles[2].styles[0]": "Background:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0\" TintLuminosityOpacity=\"0.12\" Opacity=\"1\" FallbackColor=\"#A0262626\"/>",
    "controlStyles[2].styles[1]": "BorderThickness=0,0,0,0",
    "controlStyles[2].styles[2]": "CornerRadius=14",
    "controlStyles[2].styles[3]": "Padding=3,4,3,4",
    "controlStyles[3].target": "Border#OverflowFlyoutBackgroundBorder",
    "controlStyles[3].styles[0]": "Background:=<AcrylicBrush TintColor=\"Black\" TintOpacity=\"0\" TintLuminosityOpacity=\"0.12\" Opacity=\"1\" FallbackColor=\"#A0262626\"/>",
    "controlStyles[3].styles[1]": "BorderThickness=0,0,0,0",
    "controlStyles[3].styles[2]": "CornerRadius=15",
    "controlStyles[3].styles[3]": "Margin=-2,-2,-2,-2",
    "controlStyles[4].target": "Taskbar.TaskListLabeledButtonPanel@RunningIndicatorStates > Rectangle#RunningIndicator",
    "controlStyles[4].styles[0]": "Height=3",
    "controlStyles[4].styles[1]": "Width@ActiveRunningIndicator=30",
    "controlStyles[4].styles[2]": "Width@InactiveRunningIndicator=8",
    "controlStyles[4].styles[3]": "Fill@ActiveRunningIndicator=#DDDDDD",
    "controlStyles[4].styles[4]": "Fill@InactiveRunningIndicator=#DDDDDD",
    "controlStyles[5].target": "Taskbar.TaskbarFrame#TaskbarFrame > Grid#RootGrid",
    "controlStyles[5].styles[0]": "CornerRadius=18,18,18,18",
    "controlStyles[5].styles[1]": "BorderBrush:=<SolidColorBrush Color=\"{ThemeResource SurfaceStrokeColorDefault}\" />",
    "controlStyles[6].target": "Taskbar.TaskListLabeledButtonPanel@CommonStates > Border#BackgroundElement",
    "controlStyles[6].styles[0]": "Background@ActivePointerOver=#55550099",
    "controlStyles[6].styles[1]": "Background@InactivePointerOver=#55550099"
  }
m417z commented 2 weeks ago

Can you find out which one of the 7 targets causes the issue? And which style?

immortalx74 commented 2 weeks ago

I think I found it. Removing this line: "controlStyles[5].styles[1]": "BorderBrush:=<SolidColorBrush Color=\"{ThemeResource SurfaceStrokeColorDefault}\" />" or even just changing the Color with a "named" color (eg Red), instead of using ThemeResource SurfaceStrokeColorDefault, fixes the issue.

m417z commented 2 weeks ago

Interesting. The mod doesn't interpret the XAML, it uses Windows APIs to have it parsed and converted to an object. It looks like a Windows bug, perhaps the ThemeResource resolving is an extra asynchronous task which interferes with click events.

I'm not sure what can be done about it on the mod side, but let's keep this issue as a reference in case others encounter a similar problem.