Skip to content

topbar: ITaskbarList works again; a window its app took off the taskbar gets no button - #163

Closed
Tkyoxx wants to merge 1 commit into
Lemxy:mainfrom
Tkyoxx:pr/18-taskbar-list
Closed

Tkyoxx wants to merge 1 commit into
Lemxy:mainfrom
Tkyoxx:pr/18-taskbar-list

Conversation

@Tkyoxx

@Tkyoxx Tkyoxx commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What

While topbar runs, ITaskbarList::HrInit fails with E_NOTIMPL (0x80004001) for every app on the PC.

HrInit reads the task band from the TaskbandHWND property of the first Shell_TrayWnd it finds. That window is topbar's tray host, which is topmost so that Shell_NotifyIcon finds it first, and it had no such property. As a result DeleteTab, AddTab and the rest did nothing.

So a window that its app took off the taskbar still got a button on the bar. I saw it with a Tauri app whose full-screen overlay window has skipTaskbar: true and the styles WS_EX_TOOLWINDOW | WS_EX_APPWINDOW: it showed up as a button.

How ITaskbarList reaches the taskbar

I checked this with a probe: a fake Shell_TrayWnd, then HrInit, DeleteTab and AddTab on a test window.

  • Without the property, HrInit returns E_NOTIMPL and nothing is sent.
  • With TaskbandHWND set, HrInit succeeds. DeleteTab sends the registered SHELLHOOK message to that window, with wParam 2 (HSHELL_WINDOWDESTROYED) and the window in lParam. AddTab sends the same message with wParam 1.

Fix

  • The tray host sets TaskbandHWND to itself and lets SHELLHOOK through UIPI, since the bar may run elevated.
  • tray_proc keeps the windows that were taken off in SKIP. AddTab gives a window its button back, and closed windows are forgotten. collect() leaves the windows in SKIP out.
  • If the bar starts after the app, it still finds out: the bar already broadcasts TaskbarCreated when it starts, and Tauri (tao) calls DeleteTab again when it gets that message.

Test

  • cargo test -p topbar passes, including the new delete_tab_hides_and_add_tab_brings_back.
  • On Windows 10 21H2, with this change on top of my other open topbar PRs:
    • Before: HrInit from any process returned 0x80004001, and the Tauri overlay had a button.
    • After updating topbar: HrInit returns S_OK, the button is gone, and the app keeps running.

…ar gets no button

ITaskbarList::HrInit finds the task band through the TaskbandHWND property of
the first Shell_TrayWnd. That is the bar's own (hidden, topmost) tray host,
which had no such property, so HrInit failed with E_NOTIMPL for every app
while the bar ran. DeleteTab, AddTab and the rest then did nothing, and a
window an app hid from the taskbar (Tauri's skipTaskbar, for example) still
got a button on the bar.

The tray host now names itself as the task band. DeleteTab and AddTab arrive
there as SHELLHOOK messages (HSHELL_WINDOWDESTROYED / HSHELL_WINDOWCREATED for
a window that lives on), and collect() leaves those windows out.
Lemxy added a commit that referenced this pull request Nov 26, 2026
@Lemxy

Lemxy commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, @Tkyoxx! Your change is in main (squashed, credited in the commit message) and released in v0.5.9.

@Lemxy Lemxy closed this Nov 26, 2026
Lemxy added a commit that referenced this pull request Nov 26, 2026
…#182

Co-authored-by: 2sulraw <2sulraw@gmail.com>
Co-authored-by: Tkyo0x <240800669+Tkyoxx@users.noreply.github.com>
Co-authored-by: GuilhermeLima <guilhermelimamp2020@gmail.com>
RexxColder pushed a commit to RexxColder/WinRust that referenced this pull request Nov 26, 2026
…gets no button (upstream Lemxy#163)

Ported from upstream 09ef3d0 (Lemxy#163 by @Tkyoxx): ITaskbarList::HrInit reads the task band from a "TaskbandHWND"
property of the first Shell_TrayWnd, which is ours, so HrInit failed (E_NOTIMPL) for every app while the bar ran. The
host window now carries that property, and DeleteTab / AddTab (HSHELL_WINDOWDESTROYED / CREATED) add the window to a
skip list the button collector honours: an app that hides its own taskbar button (Tauri, some launchers) now really
loses it, and AddTab gives it back. Closed windows are forgotten.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants