ramensoftware / windhawk-mods

The official collection of Windhawk mods
301 stars 55 forks source link

Taskbar height and icon size: Taskbar gets pushed offscreen on reboot until restarting explorer #529

Closed superluig164 closed 3 weeks ago

superluig164 commented 8 months ago

@m417z On some of my devices (I believe this is affected by touch mode being available) when I reboot, the taskbar gets pushed down below the screen once this mod loads. It seems like it's getting set at the height of the touch mode taskbar, even though that feature is disabled. Apps and menus adhere to the correct size, but all the visual elements get pushed down. When I restart explorer, it fixes itself. I'm not sure what the bug is, I'd be happy to help test, but perhaps the mod could just restart explorer after it loads?

m417z commented 8 months ago

Perhaps similar to this issue: https://github.com/ramensoftware/windhawk-mods/issues/413

Does locking the computer (Win+L) and unlocking fix it? If it does, it can be used as a workaround until there's a better fix.

superluig164 commented 8 months ago

@m417z Unfortunately, no. Locking the computer and unlocking it does not fix it. If you need any more debug info let me know, I'll do what I can to help.

m417z commented 8 months ago

I wasn't able to reproduce the issue, but I made some improvements and it might be fixed in Taskbar height and icon size v1.2.3. Please try it and let me know whether it's fixed for you. If not, I'll reopen the issue.

superluig164 commented 7 months ago

I still have this issue after updating to the latest version. Locking and unlocking still doesn't fix it - only restarting Explorer.

m417z commented 7 months ago

@superluig164 if you have a way to reproduce it, let me know. Meanwhile, as a workaround, try adding winlogon.exe, userinit.exe to the process inclusion list in the advanced settings. It will make it more likely for the mod to be loaded at an early stage.

image

superluig164 commented 7 months ago

So far, the best way to reproduce it that I have found is to reboot the computer - but sometimes that doesn't do it. When I update Windows it almost always happens though. If there's a way I can do a debug log or something to send you when it happens I'd be happy to do that, I just can't reboot the machine constantly since I need to use it. I'd rather try to help you find the root cause of the problem than just work around it, if you know what I mean.

superluig164 commented 3 months ago

I'm still having this issue. Something I noticed, is that, after the issue presented itself, I ran the Windhawk updater, and the taskbar remained displaced off the screen despite Windhawk no longer running. This might be Windhawk exacerbating a bug already present in Windows Explorer.

superluig164 commented 3 months ago

@m417z Update to this issue: it's now consistently reproducible on my Surface Laptop Studio. I'm not sure why it doesn't act the same way on my main machine, perhaps due to a different update. When the mod is enabled, the taskbar becomes displaced below the bottom of the screen. This behaviour sticks, even after disabling the mod, until restarting Explorer. No amount of adjusting settings in Windows or the mod I've found to fix it. I use the mod primarily to shrink the height of the taskbar. Perhaps this is important. Let me know if you'd like my configuration or for me to try and record a debug log while it happens.

Here's the details on my SLS:

Windows version: Version 23H2 (OS Build 22631.3958) Windhawk 1.5.1 Taskbar height and icon size version 1.2.10

RagibHasin commented 3 months ago

I am facing similar issues here.

Device: Asus ZenBook UM462DA (Touchscreen) Windows version: Version 23H2 (OS Build 22631.3958) Windhawk 1.5.1 Taskbar height and icon size version 1.2.10

The behavior was mitigable by restarting explorer before the latest Windows update. But now with the mod active, it is not mitigable at all.

As @superluig164 said, I also think it requires a touchscreen device to show up.

superluig164 commented 3 months ago

I will update my Surface Pro 7+ and check to see if the behaviour also happens on that device, just to confirm the touchscreen idea. I'll also check with my mom's HP Pavilion desktop which also has a touchscreen.

m417z commented 2 months ago

Let me know if you'd like my configuration or for me to try and record a debug log while it happens.

Please see my comment here: https://github.com/ramensoftware/windhawk-mods/issues/859#issuecomment-2293870017.

MuscularPuky commented 1 month ago

uh actually I already met this problem a year ago and bypassed with Task Scheduler trick. every time log on disable then enable Tablet Optimized Taskbar for 1~2s. although it's not fundamental but very effective for me. now I only meet this rarely when I connecting the external monitor

m417z commented 1 month ago

If anyone here can still reproduce the problem, could you please try the following:

Let me know if the problem still occurs with this configuration.

MuscularPuky commented 1 month ago

If anyone here can still reproduce the problem, could you please try the following:

  • Install Windows 11 Taskbar Styler
  • Add the following styles in the mod settings, replace 40 with your configured taskbar height:

    • Target: Taskbar.TaskbarFrame
    • Styles: Height=40, MaxHeight=40

Let me know if the problem still occurs with this configuration.

No, it made the problem worse :( there's separatly specified ShyTablet TabletPosture keys so we'd focus on them perhaps MS started to force the tablet taskbar button size to sqaure—means no taskbar label anymore—since 23H2. but this limitation is only at the first load so we can still have a taskbar label supported tablet taskbar—means more compact sized—until restart explorer I'm testing VerticalAlignment at taskbar.TaskbarFrame but Taskbar Styler seems lazy :( it keeps loss some styles

MuscularPuky commented 1 month ago

If anyone here can still reproduce the problem, could you please try the following:

  • Install Windows 11 Taskbar Styler
  • Add the following styles in the mod settings, replace 40 with your configured taskbar height:

    • Target: Taskbar.TaskbarFrame
    • Styles: Height=40, MaxHeight=40

Let me know if the problem still occurs with this configuration.

No, it made the problem worse :( there's separatly specified ShyTablet TabletPosture keys so we'd focus on them perhaps MS started to force the tablet taskbar button size to sqaure—means no taskbar label anymore—since 23H2. but this limitation is only at the first load so we can still have a taskbar label supported tablet taskbar—means more compact sized—until restart explorer I'm testing VerticalAlignment at taskbar.TaskbarFrame but Taskbar Styler seems lazy :( it keeps loss some styles

the most problem is can't fix the state of taskbar to either desktop/tablet. when the tablet tskbar enabled first, the taskbar is desktop size. but after reload taskbar, now taskbar becomes tablet size, and it makes taskbar goes out of the screen

m417z commented 1 month ago

@MuscularPuky this issue is not about tablet mode. Try this, let me know if it helps: https://github.com/ramensoftware/windhawk-mods/issues/957#issuecomment-2364698203

MuscularPuky commented 1 month ago

Tablet

oh I'm sorry I confused the thread with same result in my case each startup taskbar (48px) and after reloaded taskbar (72px) have different height so can't apply that solution :(

m417z commented 1 month ago

@MuscularPuky try the linked version in the comment that I posted, does it improve anything? It tries to adjust the height in more cases.

superluig164 commented 3 weeks ago

I would just like to add to this that I have experienced this bug again after updating to Windows 11 24H2 (26100.2033) on my Surface Laptop Studio. Like before, the taskbar stays displaced even after the mod is disabled, until I restart Explorer. Hopefully this is a simple fix this time around. Let me know if there's anything else I can do to try and help pinpoint the issue.

m417z commented 3 weeks ago

@superluig164 if you can reproduce it, we can try various things. If no, then I'm afraid I can't do much with this information.

superluig164 commented 3 weeks ago

@m417z Yep, at least during this session, every time I enable the mod, the taskbar is displaced until I restart Explorer. If there's a log I can get or some way to debug I'm happy to go through it.

m417z commented 3 weeks ago

@superluig164 Please try this version in which I tried to improve this aspect: https://github.com/m417z/my-windhawk-mods/blob/ebb65740bab659131de307e287e97de58868976e/mods/taskbar-icon-size.wh.cpp

To try it, disable the existing mod, restart explorer just to be sure, then click the bottom right button to create a new mod, replace the code with the code below, click "Compile Mod", then "Exit Editing Mode".

Let me know if there's any difference at all.

Next, if it doesn't help, please record some information with UWPSpy as I asked here: https://github.com/ramensoftware/windhawk-mods/issues/957#issuecomment-2364776183

It's best to do it once with the official version, and once with my fix attempt. Before enabling each version, restart explorer.exe to reset all possible leftovers from the previous mod.

superluig164 commented 3 weeks ago

@m417z This version seems to work properly. No displacement observed, yet.

m417z commented 3 weeks ago

@superluig164 good to know. While we're still here and you're in this reproducible state, I'd love to collect more information since there's no other way I know of to reproduce this.

Could you edit the test mod, comment (or remove) this line: contentGrid.Height(height);, disable it, compile it, restart explorer, enable it, and see whether the issue happens with this line commented?

superluig164 commented 3 weeks ago

@m417z With that line commented out, the taskbar is now displaced until Explorer is restarted, like the published version of the mod. It looks like, at least for me, right now, that line fixes the problem.

m417z commented 3 weeks ago

Great, it was an educated guess and I'm glad that it works.

Another check I'd like to be made if you have the time: users reported similar issues with the mods Vertical Taskbar for Windows 11, Taskbar on top for Windows 11, for example:

image

Could you try both (each time restarting explorer before enabling the mods) and report back whether there are similar issues?

superluig164 commented 3 weeks ago

@m417z

Taskbar on top for Windows 11: Published version exhibits same behaviour, with the displaced taskbar. It sometimes also gets messed up on its own, without either taskbar height mod enabled (published or the test version.) Interestingly, the test version seems to fix it, replacing the taskbar where it should be. After that it works properly, even through enabling and disabling the taskbar on top mod or the test version of taskbar height.

Vertical taskbar for Windows 11: The taskbar is initially invisible. After enabling and disabling the test version of taskbar height and icon size, it becomes visible, but status icons and the clock are aligned to the left rather than the center. Other mods don't seem to affect this. After disabling the mod, the standard taskbar is not displaced, but does not have any icons. Enabling either version of height and icon size brings them back. The published version still causes a displaced taskbar, but not as bad as before enabling and disabling vertical taskbar.

I don't believe I've covered every case here, not by a long shot, but I'm interested in continuing to experiment later in the week. But it seems like some interactions between mods, even after they have been disabled, can cause undocumented behaviours in other mods. I would say this is worth investigating as a whole, because ideally, mods should leave no traces after being disabled, other than the Windhawk framework, or at least I think so.

Let me know if there are any other specific cases I can investigate, otherwise I will take another stab at all the combinations later this week.

m417z commented 3 weeks ago

@superluig164 thanks for the checks. I did some experiments with tablet mode on my computer, and I got a state which looks similar to what you describe. In this state, the taskbar's actual height is slightly larger than what's displayed:

image

While that extra height isn't visible, there are side-effect artifacts, such as the desktop selection rectangle and the right click menu:

https://github.com/user-attachments/assets/270d6cde-a60f-4beb-9f1e-b0a7ceef0857

Are you seeing the same (without any mods)?

It seems I'm able to get this state with:

Taskbar on top for Windows 11

Great, so it seems that the same around will work. I'll add it and will post a version to try.

Vertical taskbar for Windows 11

This one looks more complex. I'll experiment with the new state I was able to achieve, hopefully I'll find a workaround and will post it for testing. Generally Vertical taskbar isn't compatible with Taskbar height and icon size (Taskbar on top too but it's less likely to conflict), so the goal is really to have Vertical taskbar alone work. A common problem users reported is that it's indeed just invisible.

ideally, mods should leave no traces after being disabled, other than the Windhawk framework, or at least I think so

I agree, ideally... in practice, sometimes it requires a non-trivial amount of effort, and I prefer to focus on things that have a visible effect. Incompatibilities such as enabling and disabling mod X, then enabling conflicting mod Y without restarting explorer are low priority.

superluig164 commented 3 weeks ago

@m417z I do not experience the same thing, not with the test version nor with the published version. However, the touch-optimized taskbar does behave less incorrectly using the test version. With the published version, hovering over it still has big icons. With the test version, the icons are correctly sized. When the taskbar is displaced (by the published version) this does happen, but still at the correct (user specified) height, not at the default height.

I agree, ideally... in practice, sometimes it requires a non-trivial amount of effort, and I prefer to focus on things that have a visible effect. Incompatibilities such as enabling and disabling mod X, then enabling conflicting mod Y without restarting explorer are low priority.

Yeah, I can definitely see why it's low priority. At the end of the day you are doing most of the work on these mods (which is greatly appreciated, by the way) and I can't imagine it's the only thing you spend your time on.

m417z commented 3 weeks ago

I do not experience the same thing, not with the test version nor with the published version.

So if I understand correctly, you don't see artifacts like in the video I posted? My suspicion was that you'll see the same without having any mods running. So if you didn't check that, please:

the touch-optimized taskbar does behave less incorrectly using the test version

So any issues left with the test version?

And regarding taskbar on top, here's a test version with the same workaround, could you try it? https://github.com/m417z/my-windhawk-mods/blob/7deafd07c3e96a7d084cb983fde54c446a8abe63/mods/taskbar-on-top.wh.cpp

Thanks.

superluig164 commented 3 weeks ago

@m417z Ooooh my bad, you're right, with no height-related mods enabled, there is a space above the taskbar with the selection box. I'm not sure what causes that. Interesting that enabling the mods fixes it. Taskbar on top also exhibits the displaced behaviour without the height mods enabled. I'm almost not sure how I didn't notice before.

I think the test version is definitely an improvement over the published version - I would probably go ahead and release it for now. I have yet to notice any anomalies using it regularly.

With this test version of Taskbar on top, at first, this happens: image After enabling and disabling the test version of taskbar height and icon size, it is fixed until restarting explorer, though the status icons are displaced a bit lower than they should be (regardless of on top or not.) This is fixed if you restart explorer with the mod(s) enabled.

m417z commented 3 weeks ago

with no height-related mods enabled, there is a space above the taskbar with the selection box. I'm not sure what causes that

Great, at least my reproduction is somewhat close to what actually happens. And not all quirks are related to Windhawk :)

As to why, I assume it has something to do with tablet/touch-optimized mode.

I think the test version is definitely an improvement over the published version - I would probably go ahead and release it for now

Yeah, I'll release it soon.

With this test version of Taskbar on top, at first, this happens

Too bad, I hoped it's fixed. Just to make sure, is it after the steps I mentioned?

  • Disable all related mods
  • Restart explorer
  • Enable the test taskbar-on-top mod and see if it has quirks such as the gap between the taskbar and the top of the monitor

Does it make any difference if you first leave taskbar-on-top enabled (and the rest disabled), and then restart explorer?

What's the white bar just above Windhawk? What happens if you maximize Windhawk?

After enabling and disabling the test version of taskbar height and icon size, it is fixed until restarting explorer

That's assuring, I just need to find out what it does to fix that.

MuscularPuky commented 3 weeks ago

@superluig164 Please try this version in which I tried to improve this aspect: https://github.com/m417z/my-windhawk-mods/blob/ebb65740bab659131de307e287e97de58868976e/mods/taskbar-icon-size.wh.cpp

To try it, disable the existing mod, restart explorer just to be sure, then click the bottom right button to create a new mod, replace the code with the code below, click "Compile Mod", then "Exit Editing Mode".

Let me know if there's any difference at all.

Next, if it doesn't help, please record some information with UWPSpy as I asked here: #957 (comment)

It's best to do it once with the official version, and once with my fix attempt. Before enabling each version, restart explorer.exe to reset all possible leftovers from the previous mod.

OMG I suffered from Windows 11 Taskbar Styler with Tablet Mode for about 2y but now All things started working fine!! THX

superluig164 commented 3 weeks ago

@m417z To note, I keep touch-optimized mode disabled. I did test turning it on for the earlier tests, but currently all my tests otherwise have it off.

Too bad, I hoped it's fixed. Just to make sure, is it after the steps I mentioned?

Yes. The white bar just above Windhawk was Firefox, maximized.

Does it make any difference if you first leave taskbar-on-top enabled (and the rest disabled), and then restart explorer?

Yes, this works. It only seems to cause this error if it's enabled later. Restarting explorer with just the taskbar on top mod enabled, it works properly. Actually, I think the displaced status icons are caused by this error. If I restart explorer with only the taskbar on top mod enabled, they don't get displaced. Only if I "fix" it by enabling the taskbar height mod. (both test versions)

m417z commented 3 weeks ago

To note, I keep touch-optimized mode disabled

My guess is that it's something related to that, maybe it's not enabled but is still loaded due to the hardware and has side effects. But I don't really know.

Yes, this works. It only seems to cause this error if it's enabled later.

Good, that's an improvement. As far as I understand, with the release taskbar-on-top version, it doesn't work properly even after restart, right?

For now, I guess I'll leave it as is, with a note that an explorer restart might be required for some devices. I'd love to find a workaround, but it's quite challenging without being able to reproduce this state and being able to try various things.

superluig164 commented 3 weeks ago

Yeah, the release version doesn't work unless I also enable (or enable and disable) the test version of height and icon size. You might be able to use the same workaround temporarily.

I'm happy to keep testing anything else you think might work.

m417z commented 3 weeks ago

I thought about it, but I'd rather not bring big chunks of Taskbar height and icon size to Taskbar on top. The two seem to be compatible to some degree, I don't want to risk that.

OK, let's give it some extra testing. Could you try these variants and see if any of them behaves differently? Same procedure:

superluig164 commented 3 weeks ago

The first variant exhibits the same behaviour as before, with blank space below and above the taskbar.

The second variant is even worse! image (don't mind the alignment of Snipping Tool, it seems to have been captured during its animation)

Worse still, the bad spacing persists after disabling the mod.

m417z commented 3 weeks ago

@superluig164 thanks, I gave up for now. I released updates to both "Taskbar height and icon size" (which hopefully solves this issue) and "Taskbar on top" (which requires restarting explorer but at least then it works).

I'll look at the vertical taskbar mod soon. I hope the same workaround will work for it too. I might need your help with it as well. Thanks!

superluig164 commented 3 weeks ago

@m417z Feel free to ping me here or on any other related issues. I'll do my best to help!

m417z commented 3 weeks ago

@superluig164 thanks, I added a similar workaround to the vertical taskbar mod, please try it: https://github.com/m417z/my-windhawk-mods/blob/429cde575f9b9440e7f4306f309b360008ac6b49/mods/taskbar-vertical.wh.cpp

Please make these two checks and let me know how it behaves:

  1. Restart explorer, then load mod
  1. Restart explorer while the mod is loaded
superluig164 commented 2 weeks ago

@m417z

In both cases, the taskbar is invisible for a while, but eventually, it does appear and works. However, the status icons and clock are aligned to the left instead of the center, causing the clock to be cut off. The Start menu when opened also gets cut off, if you also use Windows 11 Start Menu Styler. It seems to be limited to the default width.

image

It looks a little weird with labels enabled but I imagine that's just because it's intended to be used without them. (taskbar labels mod is disabled, just stock Windows labels.)

m417z commented 2 weeks ago

In both cases, the taskbar is invisible for a while, but eventually, it does appear and works

That's great progress from being invisible forever!

However, the status icons and clock are aligned to the left instead of the center, causing the clock to be cut off

Not good, are you using other mods such as Windows 11 Taskbar Styler? I assume it happens in both scenarios, i.e. both restart-then-enable and enable-then-restart?

The Start menu when opened also gets cut off, if you also use Windows 11 Start Menu Styler. It seems to be limited to the default width.

That's a known limitation which has a workaround, see https://github.com/ramensoftware/windhawk-mods/issues/1013.

It looks a little weird with labels enabled but I imagine that's just because it's intended to be used without them

It's not perfect, but it was designed to be usable. configuring the taskbar to be wider should improve it. It was much less usable in earlier versions (https://github.com/ramensoftware/windhawk-mods/issues/886).

m417z commented 2 weeks ago

@superluig164 I was able to reproduce the tray area misalignment issue, and hopefully was able to fix it. Please confirm by trying this version: https://github.com/m417z/my-windhawk-mods/blob/186a81d88a70353a892de18f4317ba5c95555912/mods/taskbar-vertical.wh.cpp

superluig164 commented 2 weeks ago

@m417z Looks like it's fixed in that version. Nice!

m417z commented 2 weeks ago

@superluig164 Thanks for confirming, just released an update! I think we're good for now, hopefully all major issues related to this tablet/touch mode are now resolved.

superluig164 commented 2 weeks ago

@m417z Happy to help, feel free to ping me anytime if you need someone to test any mods, particularly in a touch environment, but I'm happy to help with development or testing any way I can.