Skip to content

topbar: allow pinning the Start button to the far left corner - #181

Open
cute-johnny wants to merge 1 commit into
Lemxy:mainfrom
cute-johnny:feat/topbar-start-left
Open

cute-johnny wants to merge 1 commit into
Lemxy:mainfrom
cute-johnny:feat/topbar-start-left

Conversation

@cute-johnny

Copy link
Copy Markdown

Summary

Adds a "Start button on the left" (start_left) toggle to topbar so the Windows / Start button can sit maximally to the left (flush against the bottom-left screen corner), while moving the Bar settings gear icon immediately to its right and opening the Start menu flyout on the left side.

Motivation

  • Currently, the Bar settings gear icon (⚙️) occupies the far-left corner of the bar, and the Windows / Start button sits to the right of Search and Task View (either centered, or after Gear + Search + Task View when "Buttons on the left, like Windows 10" is enabled).
  • Pinning the Start button to the absolute left edge restores classic bottom-left corner ergonomics (Fitts's law: slamming the cursor into the corner always hits Start) without forcing users to give up centered app icons.
  • Previously, the Start flyout (Kind::Start) always opened centered at (sw - w) / 2 even when Start or the buttons were on the left.

Changes

1. Persistent setting (common/src/style.rs)

  • Added start_left() and set_start_left(bool) backed by %ProgramData%\WinRust\start-left.txt (same caching and 1-second refresh pattern as align_left()).
  • Reset start_left to false in reset_all().

2. Bar settings UI (plugins/topbar/src/settings.rs)

  • Added "Start button on the left" toggle under ⚙️ Bar settings → Bar → Behavior (right below "Buttons on the left, like Windows 10"), with translations for all 5 supported languages (EN, RU, JA, PT, ZH).
  • Updated match arm indices and the relook(...) condition accordingly.

3. Layout, hit-testing, painting & anchors (plugins/topbar/src/main.rs)

  • Extended Layout with gear_x, start_x, and a shared Layout::btn_pos(i) helper used across paint(), paint_vert(), min_rect(), and tip_cx().
  • When start_left() is off (default): behavior and pixel coordinates are completely unchanged.
  • When start_left() is on:
    • Start (BTNS[0]) is placed at the far left (sc(GEAR_X.0)), and hit-testing covers x < l.start_x + l.bw so clicking the extreme corner pixel (x = 0) triggers Start.
    • Gear (⚙️) shifts immediately to the right of Start (start_x + bw + gap).
    • Main group (Search, Task View, pinned/running apps) clears both Start and Gear (left_min = gear_x + sc(GEAR_X.1 + 6)) and stays centered by default (or follows immediately after Gear when align_left() is also enabled).
    • Works consistently for both horizontal bottom bars and vertical side bars (paint_vert), tooltips, right-click / Win+X menu anchoring (tip_cx), and window minimize animations (min_rect).

4. Start menu flyout position (plugins/topbar/src/fly.rs)

  • Updated Kind::Start horizontal positioning from (sw - w) / 2 to sc(8) (matching the standard 8px screen margin) whenever start_left() or align_left() is enabled, so the Start menu opens directly above the left-side Start button instead of the center of the screen.

Verification

  • cargo test -p winrust-common — 23 passed, 0 failed
  • cargo test -p topbar — 14 passed, 0 failed
  • cargo build -p topbar --release — compiled cleanly with zero warnings
  • Tested live on Windows 11 with the compiled release binary:
    • Verified toggling ⚙️ → Bar → Start button on the left on and off
    • Verified Start button sits at the far-left corner and responds to corner clicks
    • Verified Bar settings gear moves cleanly to the right of Start and opens its menu above the gear
    • Verified clicking Start opens the Start menu flyout on the left above the button

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