Skip to content

topbar: smoother, centred, sharper, a clearer menu - #153

Open
Tkyoxx wants to merge 22 commits into
Lemxy:mainfrom
Tkyoxx:pr/8-topbar-polish
Open

Tkyoxx wants to merge 22 commits into
Lemxy:mainfrom
Tkyoxx:pr/8-topbar-polish

Conversation

@Tkyoxx

@Tkyoxx Tkyoxx commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Stacked on #144, #148, #151, #152. Until those are merged this branch also carries their commits, so the diff below is bigger than this PR. Its own change is 13 commits; I will rebase it as soon as #152 is in.

Found while using the bar every day on Windows 10 21H2, most of it recorded frame by frame before the fix.

What

  • Search and Task View buttons are switches; a settings page opened from the menu replaces it at once instead of fading out and in on every click.
  • The bar menu explains itself, with three ready looks on top (Classic, Modern, Minimal); transparency has its own page, down to "icons only".
  • The whole row of buttons is centred (open windows count, like Windows 11) and glides to its new place; app buttons get a rounded square highlight centred at every bar size; no empty battery slot on a PC without one.
  • Transparency fades the background, never the icons and the clock.
  • Highlights fade in on a see-through bar too: they are recorded with their strength while drawn and get an alpha in between (before, any pixel unlike the background became solid, so a hover popped up at full strength). v0.5.8's attention highlight (Notifications not highlighted in the workspace. #129) goes the same way.
  • Animations run on a millisecond clock (GetTickCount64 moves in 15.6 ms steps) and at 64 frames a second (a 16 ms timer waits two system ticks).
  • Icons: 16 px on the small bar (24 filled it); tray icons kept at exactly the size they are drawn at, resampled once (bicubic) when an app sends another size, so the hidden-icons flyout is no longer blurry.
  • The tray flyout no longer flickers, and a right click on an icon keeps it open while the app's menu is up.
  • A tray app's full-screen overlay window gets no button; a File Explorer pin opens rust-explorer when that is installed.
  • A pinned Squirrel app (Discord, Slack, GitHub Desktop: pinned as Update.exe --processStart Discord.exe, running from app-x.y.z\) lights its pin up instead of getting a second button. Pins of one app still tell browser profiles apart by AppUserModelID (Firefox profile issue #132).

Screenshot (the small bar on Windows 10 21H2: centred row, 16 px icons, the Discord pin lit, sharp tray icons; 2x, no smoothing)

The bar: centred buttons, 16 px icons, sharp tray icons

Test

cargo test -p topbar (blend of recorded highlights, a real GDI+ round trip, tray icon resampling, the Squirrel pin, layout). On the bar: hover the buttons at 0 % and 85 % opacity (fades, no pop), small / normal / large sizes, the hidden icons flyout, the three looks.

- winrust-common: Lang::Es and Lang::ALL; t!/tf! take an optional es: arm
  after zh: (or after pt: in calls without zh:), and any language left out
  shows the English text, so nothing is ever blank or a raw key.
- No lang.txt: the Windows UI language when WinRust has it, else English.
- lang() re-reads lang.txt at most once a second and set_lang broadcasts
  style::msg(), so open windows switch without a restart: topbar now listens
  for the broadcast, rust-settings rebuilds its pages and rust-explorer its
  column headers and navigation pane when the language moved. The "restart
  the programs" notes say the switch is immediate now.
- The installer list, rust-settings and the bar's language page take their
  languages from Lang::ALL (Spanish included); --lang accepts es.
- Spanish for every t!/tf! call (1,246), the installer table, the Run box
  commands and the Start button menu, plus the few strings still English-only
  in rust-explorer.
- rs-launcher's counts gave "2 registry entrys" and Portuguese had no plural
  at all: every language now spells out its singular and plural.
…a switch

rust-explorer used to be the file manager and the Explorer replacement in one
step, so it could not be installed without topbar. Now:

- Its row installs the file manager only: folder/drive verbs and the Start
  menu shortcut. Explorer stays the shell with its own desktop and taskbar; no
  service tweaks, no rs-overlay task, no AutoRestartShell change.
- "Replace Explorer" in topbar's settings panel is the shell part. Turning it
  on ticks topbar and rust-explorer; unticking either turns it off. Turning it
  off later hands the session back to Explorer and keeps the file manager.
- An installed rust-explorer whose switch moved shows "Will be changed" and is
  installed again; giving the shell back runs before anything else in the
  same run, so topbar is never removed while it is the only bar.
- Express never moves the shell; a plain update keeps the current mode.
- Uninstalling topbar while rust-explorer is the shell gives the shell back to
  Explorer first (command line included).
- Command line: install/update rust-explorer [--shell|--no-shell]; --shell
  pulls topbar in when it is missing.
- The upstream rs-overlay start (schtasks /run, shortcut as the fallback) is
  kept as is, it just lives in the shell part now.
- Win+S / Win+Q open the card through a low-level keyboard hook on its own
  thread, set again every 30 s like topbar's. Win+Shift+S stays the snip; a
  dummy key keeps Start from opening on release, and the key still goes down
  the hook chain so topbar's Start knows Win was not pressed alone. On Windows
  10 that was the missing piece: SearchHost.exe (the window that is blocked)
  is Windows 11's, so Win+S kept opening Windows Search there.
- Windows 10's own search window (SearchApp.exe / SearchUI.exe) is left
  alone on purpose. Blocked, it made Explorer wait out DCOM's activation
  timeout every time it asked for it (System log 10010, TWinUI 5961), which
  froze the desktop's right click for seconds. With WSearch off it has
  nothing to search, and Win+S no longer reaches it.
- Alt+Space and Win+S can each be switched off from a gear on rust-search's
  row (%ProgramData%\WinRust\search-keys.txt, applied live through the style
  broadcast). At least one stays on.
- A taken Alt+Space is no longer fatal (said once, off the UI thread); a
  named mutex keeps one launcher per session instead.
- The installer's settings panels are generic now: one gear per plugin with
  options, the panel sized to its switches. topbar's keeps OneDrive and
  "Replace Explorer".
Without align-left.txt the buttons were always centered, so on Windows 10 the
bar looked like a different system from the first second. Now the default
follows the build: left on Windows 10, centered on Windows 11. A choice made in
the bar menu (the file says 1 or 0) still wins either way.

common: windows_build() / win11() read CurrentBuildNumber once, natively, and
reg::get_str reads a REG_SZ without starting reg.exe.
Until the user moved an icon, every tray icon sat behind the arrow, including
the ones people had told Windows to keep in sight. Now:

- Windows 11: its per-icon "show on taskbar" choices (NotifyIconSettings,
  IsPromoted) seed the bar's list until the user makes their own.
- Windows 10 has no per-icon list that can be read, only "Always show all
  icons" (EnableAutoTray 0). That maps to a new switch, "Every tray icon on the
  bar" (style::tray_all, tray-all.txt), also in the bar menu.

common: reg::subkeys enumerates a key natively; style gets a small Flag
helper for 0/1 files with a computed default.
A see-through bar showed the windows under it sharp, which makes the clock and
the buttons hard to read. "Blur behind the bar" (Colors and transparency page,
style::bar_blur, off by default) asks Windows for the blur its own taskbar
uses, through SetWindowCompositionAttribute (looked up at run time; a Windows
without it just gets no blur).

Fading the whole layered window would fade the text too, so with the blur on
the bar is painted into a 32-bit DIB and only the pixels the background left
alone get the opacity (premultiplied); text, icons and pills stay solid. The
background copy it compares against is kept with bg_layer's key, so an
animation frame copies nothing. Switching the blur on at 100 % opacity drops
it to 85 %, since nothing shows through a solid bar.

Checked on Windows 10 19044; the same API draws it on Windows 11.
…uest

- topbar's settings panel gets the look switches, all live through the style
  broadcast: centered buttons, every tray icon on the bar, see-through bar
  (85 %), blur behind it. OneDrive and "Replace Explorer" stay where they were.
- The PowerShell profile block (cat->bat, grep->rg, ll, zoxide) was written
  into the user's profile with every topbar, unasked. It is a switch now, off
  for a fresh install; installs from before keep it. Flipping it marks topbar
  "Will be changed", and installing it again writes or removes the block.
  Command line: --ps-aliases / --no-ps-aliases. The applied state lives in
  HKLM\SOFTWARE\plugin-launcher\topbar.
- A fresh install shows the OneDrive icon (topbar.cfg is written with it on);
  installs from before keep it hidden, as the bar's default was.
- reshell is not optional: besides the desktop hotkeys it is the watchdog that
  brings the taskbar back if the bar dies, and the Win+E/D/I handler.
With no tray icon at all (a PC without tray apps, or all of them hidden) the bar broadcast TaskbarCreated to every top-level window in the session every 4 s, forever. Now every 4 s for the first minute after start, which covers apps that start late, then once a minute.
The installer's "Hide the OneDrive icon" only reached the bar the next time
OneDrive registered its icon, usually at the next sign-in. The installer now
sends the style broadcast after writing topbar.cfg, and the bar drops the icon
or asks for it again (TaskbarCreated) when the value really changed; theme and
language broadcasts leave the tray alone.
…nking

- "Search button" and "Task View button" switches (style::show_search /
  show_taskview): the slots before Start are whichever of them is on, in the
  layout, the hit test, the side bar and the tooltips.
- A settings page opened from a pick of the menu (the next page, or the same
  page with a switch flipped) replaces the menu on screen at once; it used to
  fade out and rise in again on every click.
The hover / active background of an app button filled its slot's full height
and the icon sat two pixels above the middle, so it looked tall and off-centre
on a large bar and squat on a small one. It is a rounded square around the
icon now, centred in the slot and in the bar's height, with the running-app
pill inside its bottom edge.
- The flyout repaints every 15 ms while it fades in and drew straight onto the
  window, so for a moment each frame it showed an empty panel (recorded frame
  by frame). It is drawn off screen and copied in one go now.
- A right click on an icon hid the flyout before the app's menu came up, so
  nothing in it could be used. The flyout stays while that menu is open and
  goes once the menu and the focus are gone, as in Windows.
The opacity faded the whole layered window, icons and clock included. The
per-pixel path the blur already used now serves every see-through bar: only
pixels the background left alone get the alpha. Without the blur the accent is
ACCENT_ENABLE_TRANSPARENTGRADIENT with a clear colour, which composes our own
alpha and nothing else (checked on Windows 10 19044).
- On top, one click each: Classic (like Windows 10), Modern (like Windows 11,
  glass), Minimal (no background, no search / Task View, small). The theme
  and colours stay.
- Transparency has a page of its own, down to "no background (icons only)",
  with the blur next to it; the main menu says how see-through the bar is.
- "Buttons and position": edge, size, centred buttons, the search and Task
  View buttons, every tray icon. Auto-hide is a switch on the main page,
  named for what it does. Colors keeps only the colours.
- Only the edge and the size slide the bar again; other switches repaint it
  where it is.
A tray app's full-screen layer (a topmost tool window that cannot be
activated, here with WS_EX_APPWINDOW too) showed up as an open app. Its app
takes the tab off Windows' taskbar with ITaskbarList::DeleteTab, which only
Explorer sees; a tool window that cannot be activated is left out now.
On a PC without a battery the system group kept the battery's 44 px, an empty
gap before the clock.
Only Start and the pins were centred, so with a few apps open the row hung to
the right. Every button counts now, like on Windows 11, and the row eases to
its new place over 220 ms when a button comes or goes instead of jumping.
With rust-explorer installed, a pin or shortcut to explorer.exe opens the
WinRust file manager; the pin keeps its icon.
Every pixel that differed from the background was made solid, so on a
clear bar a hover highlight popped up at full strength. Highlights are now
recorded with their strength while they are drawn and get an alpha in
between. The fades also run on a millisecond clock (GetTickCount64 moves
in 15.6 ms steps) and at 64 frames a second instead of 32.
App icons were 24 px at every bar size and filled almost the whole small
bar. There they are 16 px now, like the small Windows taskbar, and are
loaded again when the size changes. The Start menu keeps its 24 px icons.
Apps hand the tray a 16 px icon and the hidden-icons flyout stretched it to
20, so it came out blurry; an app that sends a bigger one got it squeezed
by dropping pixels. Every tray icon is now kept at exactly the size it is
drawn at, resampled once (bicubic) when the app sent another size.
…utton

Discord, Slack and GitHub Desktop are pinned as "Update.exe --processStart
Discord.exe" and run from a versioned app-x.y.z folder beside Update.exe,
so matching by path left the pin dark and gave the running app a button of
its own. "Pin" on such a window no longer pins it a second time either.
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.

1 participant