Skip to content

topbar & common: improve auto-hide/fullscreen wake, 200Hz animation, layout centering, window restore stability, custom Start icon, and tray/screenshot defaults - #253

Closed
ZyyXD1 wants to merge 0 commit into
Lemxy:mainfrom
ZyyXD1:main

Conversation

@ZyyXD1

@ZyyXD1 ZyyXD1 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Enhances topbar and common across auto-hide/fullscreen responsiveness, high-refresh-rate animation smoothness, symmetric layout alignment, GPU-backed window restore stability, customizable Start button icons, system tray overflow defaults, and temporary screenshot handling. 

Changes

Window Restore Stability & WebView2 EcoQoS (main.rs, common/src/eco.rs)

  • Prevent double-restore / activation race: Updated bring() to return immediately after SwitchToThisWindow(w, 1) for minimized windows rather than following up with force_fg(w) + ShowWindow(w, SW_RESTORE) while the asynchronous restore is still in flight (fixing blank/solid GPU surfaces on Electron/WebView2 apps).
  • Avoid moving minimized/hidden windows while Explorer is running: Updated hide_stub() to skip when Shell_TrayWnd (Explorer) is active or the window is invisible, preventing SetWindowPos(..., -32000, -32000, ...) races during minimize/restore transitions.
  • Exempt WebView2 from EcoQoS throttling: Added msedgewebview2.exe to KEEP in common/src/eco.rs so WebView2-backed apps are not throttled when the Game profile is active.

Auto-Hide, Fullscreen & Start Menu Visibility (main.rs, run.rs, second.rs)

  • Prevent maximized borderless/custom-chrome windows from triggering fullscreen hide: Removed the WS_CAPTION requirement in fg_covers / covers_monitor so maximized windows (IsZoomed) are never classified as fullscreen, and cleared FS_WND once a window exits fullscreen.

  • Show bar when Start or any flyout opens: Forced target = 1.0 in bar_step when fly::any_open() is true, and triggered fs_update + bar_anim immediately on WIN_START.

  • Instant cursor-edge wake, immediate auto-hide & foreground edge reveal: 

    • Added a WH_MOUSE_LL hook (mouse_hook) to post EDGE_WAKE with zero polling delay when the cursor hits a screen edge (expanded edge threshold from 1px to 2px across primary and secondary monitors).
    • Removed the 2000ms auto-hide delay in fs_update and triggered fs_update inside WM_MOUSELEAVE so the bar hides immediately once the cursor leaves the bar (when no flyout is open).
    • Added EDGE_SHOW and d3d_fullscreen() so moving the cursor to the edge raises the bar over borderless/fullscreen apps unless Windows reports an exclusive D3D fullscreen game (QUNS_RUNNING_D3D_FULL_SCREEN).
    • Reduced fallback poll interval from 250ms to 80ms.

200Hz DWM-Vsync Slide Animation (main.rs)

  • Replaced the 15ms (~64Hz) SetTimer animation loop with a DwmFlush() loop posting BAR_ANIM_MSG at the monitor's native refresh rate (with a 5ms sleep fallback).
  • Switched BAR_T from GetTickCount64 to std::time::Instant for sub-15ms frame precision, and shortened slide-in/out duration from 380ms / 240ms to 160ms.

Symmetric Start Menu, Bar & System Tray Layout (fly.rs, main.rs, second.rs)

  • Monitor-centered Start menu: Updated fly.rs to query the active monitor's rcMonitor (MonitorFromWindow / GetMonitorInfoW), clamp panel bounds to fit cleanly, and center Kind::Start horizontally at mon.left + (mw - w) / 2 (when not left-aligned).
  • Monitor-centered bar icons: Updated layout() so the entire visible center button group (group_n: Start, pins, and open windows) centers across the bar width, and vertically centered icons without an active running-window pill (pill_off = 0).
  • Right-aligned, evenly spaced system tray: Standardized right-side margins and spacing (sc(6) right margin before clock, sc(4) between clock/system pill/tray apps, sc(2) between sc(24) tray cells), balanced system pill padding (SYS_PAD = 6, SYS_WIFI = 22, SYS_GAP = 4, SYS_VOL = 22, SYS_END = 6), adjusted the battery percentage offset (x + bw + sc(7)), and updated hit(), tip_cx(), and system_group_is_as_wide_as_it_draws to match.

Custom Start Button Icon (main.rs, second.rs, settings.rs)

  • Custom icon loader & renderer: Added load_start_icon, refresh_start_icon, and draw_start_logo using GDI+ (PixelFormat32bppPARGB) + icons::from_bitmap / icons::draw to render PNG/ICO/BMP/JPG images at sc(24) (24×24 logical px) with alpha transparency, aspect-ratio preservation, hover/press scaling, and secondary-monitor support (falling back to the default 4-tile logo when unset).
  • Settings UI & persistence: Added Start icon… (file picker) and Reset Start icon to default to Bar settings (style_menu()), persisted in %APPDATA%\topbar-start-icon.txt and cleared on Reset everything.

System Tray Flyout Defaults & Temporary Screenshots (tray.rs, shot.rs, clip.rs, main.rs)

  • Tuck tray icons into the chevron flyout by default: Inverted bar_idx() so icons stay in the overflow flyout unless pinned via middle-click (topbar-tray-bar.txt), added immediate bar invalidation on middle-click, and left-aligned fly_grid_x() (sc(8)).
  • Save screenshots to %TEMP%\topbar-screenshots: Updated save_bitmap in shot.rs to write temporary files in std::env::temp_dir().join("topbar-screenshots") instead of Pictures\Screenshots while preserving CF_BITMAP clipboard pasting (Ctrl+V) for PrtSc and Win+Shift+S.

Testing & Verification

  • Updated unit tests (borderless_games_count_as_fullscreen, system_group_is_as_wide_as_it_draws) to match the updated fullscreen and tray geometry logic.
  • cargo test -p topbar: 38 passed; 0 failed
  • scripts\build-all.ps1: built topbar.exe and plugin-launcher.exe cleanly with zero compiler warnings.

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