Skip to content

Adopt kanso 0.1.0: kinetic scrolling + widget/theme unification#14

Merged
jondkinney merged 16 commits into
mainfrom
kanso-adoption
Jun 3, 2026
Merged

Adopt kanso 0.1.0: kinetic scrolling + widget/theme unification#14
jondkinney merged 16 commits into
mainfrom
kanso-adoption

Conversation

@jondkinney

Copy link
Copy Markdown
Owner

Routes both egui surfaces (prefs + review) through the shared kanso design
system, now consumed from crates.io (kanso = "0.1") instead of a path dep.

Highlights

  • Widgets/theme — fonts, palette, controls, sidebar, about pane, dirty
    footer, app-picker (searchable combo), info_icon, editable_combo, etc. all
    delegated to kanso; review popup brought under the kanso theme.
  • Kinetic scrollingkanso::scroll::scroll_view (macOS-style fling +
    rubber-band over-scroll, tuned on-device) replaces ScrollArea; reset-to-top
    on section change.
  • UI polish — "Quit" label, stale-daemon relaunch overlay, footer spacing,
    content padding.
  • Touchpad touch-to-stop — the prebuilt (hyprcorrect-bin) builds against
    vendored winit/egui-winit forks (release.yml inject) so a finger-rest stops
    kinetic scroll; source/crates.io builds degrade gracefully. Upstreaming:
    winit-wayland: add hold gesture support rust-windowing/winit#4585, Expose touchpad "hold" gesture to stop kinetic scrolling emilk/egui#8223.

Release notes

  • Depends on the freshly published kanso 0.1.0; lock references stock
    winit/egui-winit (the fork patch is prebuilt-only, never in the published
    manifest).
  • Merging this to main triggers release-plz → the hyprcorrect release PR.

jondkinney and others added 16 commits May 31, 2026 11:04
Wire kanso (path dep) into hyprcorrect-ui and delegate the helper bodies
to kanso behind their existing signatures (call sites unchanged):
- sidebar_item   → kanso::widgets::nav_item
- field_label    → kanso::widgets::field_label   (15→14px, canonical)
- caption        → kanso::widgets::caption       (now also gets backtick pills)
- caption_with_code → kanso::widgets::caption     (was a ~90-line glyph-pill
  painter, byte-for-byte vernier's — deleted)

Net −131 lines in hyprcorrect-ui. Builds + clippy -D warnings clean.
Deferred (needs reconciliation): theme/font swap (hyprcorrect applies the
control border GLOBALLY at gray-72 vs kanso's scoped invisible-at-rest +
the solid-scrollbar tweak), input helpers, and the Save/Cancel footer →
kanso::widgets::dirty_footer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace hyprcorrect's hand-rolled control border (always-visible gray-72
at rest, radius 4) with kanso::theme::control_visuals applied globally:
color-matched/invisible at rest, BORDER on hover, ACCENT on press, radius
6. Keeps hyprcorrect's text-styles, spacing, CONTROL_HEIGHT(30), and the
solid-scrollbar tweak. Builds + clippy -D warnings clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(a) apply_style now sources type scale, spacing, the solid scrollbar, and
    radius from kanso::theme::apply_styles + control_visuals — drops the
    duplicated style block (incl. hyprcorrect's own scrollbar copy).
(b) install_glyph_fonts sources AdwaitaSans from kanso::fonts::ADWAITA_SANS;
    deleted the bundled crates/hyprcorrect-ui/assets/AdwaitaSans-Regular.ttf
    (still shared with the review popup, so the fn stays).
(c) the Save/Cancel action bar is now kanso::widgets::DirtyFooter
    (from_dirty(self.dirty()).revert_label("Cancel")), mapping the
    multi-source dirty()/save()/cancel() onto FooterAction.

Builds (app + review popup) + clippy -D warnings clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Route prefs.rs through the kanso design system:
- fonts: delete hand-rolled install_glyph_fonts + chord_glyphs/chord_chip/
  shortcut_font + OMARCHY consts; install via kanso::fonts::install
  (shortcut_family) and render the hotkey capture chip with
  kanso::widgets::shortcut_capture_chip. review.rs installs fonts the same
  way and reads kanso::fonts::SHORTCUT_FAMILY, so it no longer depends on
  prefs::install_glyph_fonts.
- palette: replace byte-identical Color32 literals with palette::{ERROR,
  WARN,TEXT_MUTED,OK} tokens.
- inputs: padded_text_edit/padded_password_edit delegate to kanso's
  padded_text_edit/password_field.
- pickers: Word-definitions selectable_value row -> widgets::segmented;
  provider_radio -> radio_group_horizontal; pause-per-backspace egui
  Slider -> widgets::Slider.
- buttons: Download/Install/Save-provider CTAs -> primary_button (teal),
  enabled-gated via add_enabled_ui so they still gray out.
- toggles: Start-at-login / Review-popup / Provider-fallback blocks ->
  widgets::labeled_toggle.
- about: about_panel -> widgets::about_pane (logo hero + links).
- sidebar: hand-painted logo+heading -> widgets::sidebar_header.
- progress: ngram download -> widgets::progress / ProgressBar::indeterminate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
review.rs rendered on egui's raw default Visuals; now it shares the cohort
look:
- theme: apply kanso::theme::apply_styles + control_visuals at the top of
  update(), so the popup gets the shared type scale, solid scrollbar,
  corner radius, and the input/button control border (the neutral footer
  buttons inherit it automatically).
- palette: alias CARD_BG/TEXT_FG/SQUIGGLE_BLUE to palette::CARD/TEXT/INFO
  and swap inline gray170/gray150 to palette::TEXT_MUTED/TEXT_FAINT.
- card: the card() helper delegates to kanso::widgets::card (bordered,
  10px). The vim 'Corrected' editor surface stays bespoke (deferred).
- footer: Apply uses the kanso primary teal (selection fill) instead of a
  bespoke green, keeping its ↵ glyph.

vim-edit and word-diff rendering remain deferred for a future
vim-capabilities crate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete the local hand-painted info_icon; both call sites
(field_label_with_info, provider_radio) now use the shared widget.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete the local editable_combo + combo_arrow_button; the three LLM
backend/model combos now use kanso::widgets::editable_combo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the bespoke ComboBox + hand-painted icon rows with
kanso::widgets::app_picker (now icon-capable): hyprcorrect maps each
running-app candidate to an AppEntry carrying its resolved .desktop icon
texture id. The picker is now the always-visible searchable list (kanso's
standard) instead of a collapsed combo. The .desktop/icon resolution stays
in apps.rs/icon.rs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drive the prefs content with kanso::scroll::scroll_view (kinetic fling +
rubber-band over-scroll) and call scroll_momentum for the popup areas.
Collapse the blocklist app picker to app_picker_combo so it stays one row
tall until opened instead of an always-visible list.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Call kanso::scroll::scroll_momentum so the review popup's scroll areas
coast like the rest of the cohort.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The central panel's bottom inner margin was 18px against the 20px sides,
leaving the content a touch short at the bottom; even them up at 20.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…overlay

Shorten the "Quit hyprcorrect" button to just "Quit". When the on-disk binary
is newer than the running daemon, the relaunch is the thing to do first:
instead of an inline button competing with Save/Cancel, overlay it across the
right of the footer on an opaque backdrop that covers and blocks those actions,
so it presents as the required step before any other footer operation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A single scroll_view renders every section, so its offset carried across
section switches — scroll Behavior to the bottom, click Privacy, and the
shorter section rendered off-screen until nudged. Track the shown section in
egui memory and call kanso::scroll::scroll_view_reset when it changes, so each
section opens at the top.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Linux prebuilt jobs (feeding hyprcorrect-bin) append a [patch.crates-io]
pinning the vendored winit + egui-winit forks that add the Wayland hold gesture,
so the GitHub-release binary stops kinetic scroll on a finger-rest. Source
builds and crates.io / cargo install omit the patch and degrade gracefully —
kanso reads a flag that's simply never written. macOS is left unpatched (the
gesture is Wayland-only). Pinned by rev for reproducibility; drop once
upstreamed (rust-windowing/winit#4585, emilk/egui#8223).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kanso is now on crates.io, so swap the adoption-trial path dependency for a
version requirement. Builds against the registry crate; the lock references
stock winit/egui-winit — the touch-to-stop fork patch stays prebuilt-only
(release.yml) and local-dev, never in the published manifest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cargo fmt on the hand-written relaunch_overlay (and any sibling drift) so the
Format CI job passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jondkinney jondkinney merged commit a3d1c1d into main Jun 3, 2026
4 checks passed
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