Skip to content

fastframe 0.19.0

Latest

Choose a tag to compare

@crmne crmne released this 05 Dec 12:26
v0.19.0
f90acaa

fastframe 0.19.0 brings fastframe-ui, themed egui components that ZapFast, Spotifast, Solco and TonePush are moving onto, with three crates beside it for docked panels, diffs and code. It moves to egui 0.38, lets apps in the tray sleep instead of waking 400 times a minute, keeps busy indicators to a frame budget, and fixes names and messages in Tai Le, Limbu, Bengali and other scripts that drew as boxes or broken.

Move every fastframe crate to tag = "v0.19.0". What an app must do:

  • Move to egui and eframe 0.38 (and egui_table 0.12 and egui_dock 0.23 if it uses them). An app that patches egui and winit moves both forks together: crmne/egui's apps-0.38 branch at f10a3930 and crmne/winit's apps-0.30 branch at 87de1de06e4561e7a77a1f05ab337fbaac4adbb9. The getting-started guide has the whole [patch.crates-io] section.
  • Drop .idle(fastframe_tray::idle). Shell::idle and fastframe_tray::idle are removed: the shell's own sleep now serves AppKit's loop on macOS and the thread's window messages on Windows. Work a headless tick notices only by reading the clock now runs up to 30 s late (HEADLESS_SLEEP) instead of within 150 ms, so ask for a repaint at its deadline in the tick (ctx.request_repaint_after(left)) or wake the shell's Waker from the thread that delivers it.
  • Match the new notification events. Event::Activated is Event::Activated { activation_token } and Event::Action(id) is Event::Action { id, activation_token }.
  • Add a wildcard arm (_ => {}) to matches on the enums the crates hand back. They are #[non_exhaustive] now, so a later case is not a breaking change: notifications' Error and Event, power's and tray's Event, now-playing's Command, audio's OpenError and Reason, FontError, IconError, update's Kind, PackageManager and DownloadState, autostart's State, dirs' Mode and instance's Claim.
  • Pass the theme catalogue a closure. catalog.start(dir, selected, move || waker.wake()), without fastframe_theme::Waker::new.
  • Use the one copy of two duplicated helpers. fastframe_desktop::macos_notifications_allowed() is gone: use fastframe_notifications::Client::permission. fastframe_now_playing::desktop_entry is gone: call fastframe_desktop::desktop_entry.
  • Stop reading fastframe_text::portal, fastframe_text::fontconfig and fastframe_fonts::system::Fallback::y_offset_factor. The readers are private, and egui 0.38 puts every fallback face on the primary face's baseline, so the offset is gone.
  • On the apps' winit fork with macos-quit-as-close, set FASTFRAME_WINIT_QUIT_REPLY = "1" under [env] in .cargo/config.toml, so a declined quit answers its sender (see Fixed). Apps without that feature leave it unset; setting it there, or on stock winit, fails to build.
  • Check two new warnings in -D warnings builds. The event drains (Power::events, Tray::events, Dock::events, NowPlaying::commands, audio's take_errors), the getters beside them and the notification builders are #[must_use], and fastframe_audio::OutputError and output_device_names are deprecated in favour of StreamError and output_devices.
  • Pick Inter yourself if you want it. FontSetup now draws with the platform's interface face by default (see New); Primary::Inter keeps the bundled face.

Apps that built fastframe-ui from main before this release also follow Upgrading from a pre-release fastframe-ui below.

New

  • fastframe-ui: themed components for egui apps. Buttons, fields, pickers, menus, dialogs, lists, tables, trees, sidebars, settings pages, calendars, notifications, avatars, badges, chat bubbles and more. As in SwiftUI, a component says what it is and a style draws it, and how it looks is two choices made apart: a look (shape, spacing, type, motion, shadows) and a theme (colour). Four looks come with it: shadcn (the default), fastframe, Signal and Studio, a denser, darker one for pro tools. 21 themes are bundled, theme files load as JSON, and the components follow the system's light or dark appearance by themselves. Each component has a page on fastframe.dev that runs it in the browser.

    The same music mock-up drawn by fastframe-ui in its four looks: fastframe light, Signal dark, shadcn light and Studio dark

  • The four apps are moving onto it. fastframe-ui grew from what ZapFast, Spotifast, Solco and TonePush each drew by hand, and their ports shaped it: the pill and bare icon buttons ZapFast and Spotifast shared, a table for Spotifast's playlists, Solco's library and TonePush's tone library (app-kept selection, scrolling to a row, rows loaded before a scroll reaches them, row drags carrying the app's payload, column widths the app decides, disabled rows, one Tab stop for the whole table), menus with headers, colour swatches and keycaps, and settings rows. In those ports:

    • TonePush draws its library of 2,000 tones in 0.63 ms a frame instead of 7.4 to 9.4 ms, and starts with it in 0.30 s instead of 2.3 s.
    • Solco shows its first page of rows in about 38 ms instead of about 280 ms, and at rest takes 6% CPU and about 295 wakeups a second instead of 10% and about 890.
  • A table for libraries of any size. Table lays out with egui_table and paints in the look's own way: a sticky header, fixed columns, sorting, column moving and hiding, row drags and drops, overlay scrollbars whose thumbs float over the rows, keyboard selection and screen-reader names for every row. Column::painted draws a column's cells without a Ui each, and Button::show_in_cell draws a button sized to its cell.

  • fastframe-ui-dock, fastframe-ui-diff and fastframe-ui-editor. Dockable tabbed panels (drag a tab to move, split or float it) on egui_dock, a diff view (unified or side by side, word highlights, folded unchanged lines), and a code editor (line numbers, syntax colours, the current line, find), each drawn in the look.

  • Right-to-left labels read in order in every component on the apps' egui fork, with FASTFRAME_EGUI_BIDI = "1" set; stock egui draws them as before.

  • The platform's own interface face by default. FontSetup now draws with San Francisco on macOS, Segoe UI on Windows and fontconfig's system-ui on Linux, with Inter where none is found. Inter, when chosen, draws at its display optical size, whose tighter spacing reads better in an interface.

  • Notification clicks hand the app GNOME's activation token (activation_token on Event::Activated and Event::Action), so the app can create its window with it, which ends GNOME's busy spinner. Reported in crmne/zapfast#1072 by @alex3137.

  • Middle-click autoscroll in fastframe-scroll. Middle-click a list and move the pointer away to scroll, as in browsers. Opt-in on Linux and FreeBSD, where middle click pastes the primary selection; off on macOS. By @Felitendo in #44.

  • The playback rate over MPRIS. State::rate tells Linux desktops how fast playback runs, so their position bars no longer drift at other speeds. Asked for in #86 by @mdmrk.

  • Dracula and Alucard presets in fastframe-theme. By @farheinheigt in #37.

  • A gallery of eight made-up test apps (mail, settings, music, tracker, code, chat, admin, notes) that combine the components as real applications do, in every look, light and dark, and a frame bench that measures what each one costs a frame.

Fixed

  • Apps in the tray no longer wake 400 times a minute. A hidden app ran its headless tick every 150 ms. The shell now sleeps until the soonest repaint the tick asked for, at most 30 s, and a wake from any thread or a menu item chosen anywhere in the app ends the sleep at once. A hidden ZapFast now wakes 4 times a minute.
  • Busy indicators no longer take a frame every 33 ms. Spinners, bars, shimmers, skeletons and typing dots step on a shared grid (10 frames a second for one that steps, 30 at most for one that moves smoothly) and hold still while the window is in the background. TonePush's busy indicator draws 10.5 frames a second instead of 60, about 7.3 ms of CPU a second instead of about 41, and ZapFast's typing indicator draws 600 frames a minute instead of 1,800.
  • A logout or shutdown no longer stops at a Mac app that keeps running in the background. With macos-quit-as-close, the sender of a quit Apple Event (the Dock's Quit, Activity Monitor, a logout) read "User canceled" at once, even when the app then quit. On the apps' winit fork the shell now answers with the app's real decision.
  • A click on a custom macOS app menu or Dock menu item is read at once while a window is open, rather than at the next repaint (2.0 s in a check on macOS 27; now 0.4 to 5.3 ms).
  • Names in Tai Le, Limbu and other scripts no longer draw as boxes. Tibetan, Mongolian, Thaana, Syriac, Odia, Ol Chiki, Chakma, Meetei Mayek, New Tai Lue, N'Ko, Tifinagh, Vai, Adlam, Canadian syllabics, Osage and Lisu also find a face, Windows' own where it ships one. Reported in crmne/zapfast#1159 by @rigues.
  • Bengali conjuncts join on Windows, and every script is shaped by the face chosen for it, not by an earlier face that also maps it. Windows' own interface faces now draw Armenian, Georgian, Hebrew and Hangul, rather than Comic Sans MS, Lucida Sans Unicode or Arial Unicode MS. Reported in crmne/zapfast#1264 by @wkazisan.
  • COLR emoji fonts draw in colour on Linux (Fedora's Noto Color Emoji COLRv1, Fluent Emoji, Segoe UI Emoji) and as bundled fonts. Reported in #81 by @Striffly.
  • The tray icon shows in bars that read the icon file, such as Omarchy's, even when the app's icon was installed after the bar started.
  • Wayland touchpads scroll as far as in GTK 4 on the apps' egui fork, and fastframe-scroll no longer scales them a second time.
  • A maximised window's top-right pixel is Close on Windows, as in native apps, and a restored window has no dead strip between its caption buttons and the resize border. By @Espaye in #61.

Known limitations

  • Spotifast's playlist is still a little slower a frame than before fastframe-ui: about 7% at rest and 4% scrolling on the apps' egui fork (0.112 ms against 0.105 ms at rest; at the 95th percentile, scrolling is faster than before), and about 12% on stock egui 0.38, where egui still does accessibility bookkeeping with no screen reader listening (emilk/egui#9014). Its Home page is as fast as before, or faster.
  • Solco's cleanup confirmation dialog takes a slower frame as it opens (p95 2.11 to 2.63 ms), and its memory settles a few MB higher.
  • On stock egui 0.38, Wayland touchpads scroll slower than before. fastframe-scroll's own touchpad scale is 1 now that the egui fork's egui-winit scales like GTK 4 (emilk/egui#8985); without the fork, FASTFRAME_TOUCHPAD_SCALE or Scrolling::set_touchpad_scale sets one.
  • The playback rate reaches only MPRIS. souvlaki, which the Windows and macOS controls go through, cannot pass it on, so those assume normal speed.
  • winit 0.30 cannot raise a window that is already open with an activation token, so a notification click raises only a window created with it.
  • fastframe-ui's API may still change as the apps finish their ports; each change will be named in the notes.

Upgrading from a pre-release fastframe-ui

fastframe-ui is new in this release, but the four apps built it from main while it grew. An app that pinned an earlier commit makes these changes:

  • The default look is fastframe. An app that never calls set_look draws in Look::fastframe() (its shapes, styles and theme) instead of shadcn, and Tokens::light(), Tokens::dark() and Tokens::default() are the fastframe look's tokens. To keep the old appearance, call fastframe_ui::set_look(ctx, Look::shadcn()). The dock crate keeps its own default style: pair Look::fastframe().replace(dock_styles::Standard, dock_styles::Fastframe) as the gallery does.
  • Control sizes come from the look. Size::height(), padding(), text_size() and icon_size() are gone: read tokens(ctx).shape.controls.heights[size] and the like. InputStyle::padding takes &ControlSizes. The per-size fields are PerSize<T> (PerSize::new(..), PerSize::all(..), indexed by Size), and ControlSizes::height and the other getters, TableMetrics::at and header_height are gone.
  • One interaction state. ButtonState, ToggleState, PickerState, DisclosureState, TabItemState and MenuItemState are one ControlState; button.state.loading is button.loading, a picker trigger's state.open is trigger.open, a menu item's state.highlighted and state.open are item.highlighted and item.open. Control::show's closure takes (painter, rect, state). ButtonColors is { background, foreground, hover_background, hover_foreground }.
  • theme(ctx) is tokens(ctx), and TextStyle, TextStyles and shape.text_styles are TypeStyle, TypeScale and shape.type_scale.
  • One setter. set_tokens, apply and set_look_keeping_visuals are gone: set_look(ctx, look) follows the appearance by itself, and look.egui_visuals(true) styles egui too. A Look has one shape: Look::new(name, shape), look.with_shape(|s| ..), and name(), theme() and shape() in place of the fields.
  • Depth. Shape::shadow and Shape::font_size are gone; Shape::elevation is an Elevation (Elevation::uniform(..), Elevation::NONE) of ShadowShapes, and shadow colours are the theme's Colors::shadows. tokens.popover_shadow(..) and dialog_shadow(..) are tokens.shadows().
  • Colours. Colors::from_base_colors(name, dark, |name| ..) is Colors::from_base(name, dark, &BaseColors { .. }), whose overlay and shadow fields are popover and scrim. Component colours are grouped: link, group_box, description_list_label, list, table, controls, tab, sidebar, bars, scrollbar and chart (colors.table.hover for colors.table_hover).
  • Theme files. Theme::from_file and Colors::parse_file are Theme::from_json and Colors::from_json, returning a ThemeError; presets::themes() returns &'static [Theme], and Theme::all() is Theme::built_in() chained with the presets.
  • look.replace(button_styles::Standard, Pill) names the built-in style and takes the style itself, without a key or Arc.
  • One name per builder concept. accessible_label and accessible_name are accessibility_label; Input and NumberInput's prefix, suffix, prefix_text and suffix_text are start, end, start_text and end_text; Image::sticky("cover") is .sticky(true).id_salt("cover"); Tooltip::show_ui is show_with_body. Flags that took no argument take a bool: Toolbar::bordered, Breadcrumb::clickable, Notification::clickable, Combobox::cleanable and highlight_matches, Picker::searchable, highlight_matches and cleanable, vertical on Carousel, ButtonGroup, DescriptionList, Stepper and Slider, Slider::reverse and Column::text_center.
  • Notifications. Notification::id_salt is gone: make a NotificationId once and pass it to .id(..) and to action_clicked(..).
  • Tables. Table::new(&mut state, &columns).show(ui, &mut delegate) takes the state in new. ListResponse::confirmed and TreeResponse::confirmed are activated, and TableResponse::edit_cancelled is cancelled. TableDelegate::row_overlay takes one &TableRowOverlay, and prefetch takes a &TablePrefetch (.visible is the old range; .prefetch_rows(0) keeps it). A TableCell or TableRows literal or pattern adds the new fields (or ..), and TableResponse can no longer be built with a literal.
  • Return shapes. Empty::show returns InnerResponse<R>, AttachmentGroup::show returns InnerResponse<R>, and MenuUi::submenu returns an InnerResponse whose .inner is what it returned before.
  • Text. Labels, menu rows, tabs, columns and screen-reader names borrow (impl Into<Cow<str>>), so Label, Kbd, Column, Control, Clipboard, IconWidget, ResizeHandle, StatusBar, Toolbar, Tooltip and Link have a lifetime (Column<'static>). Other shown text takes impl Into<WidgetText>: a helper that passes its own impl Into<String> through adds .into(), a custom PickerStyle or DatePickerStyle reads its label, description or placeholder as &WidgetText, and ListSection is no longer PartialEq.
  • Smaller ones. TITLE_BAR_HEIGHT is gone (read shape.metrics.title_bar.height) and LOAD_MORE_DISTANCE is private (load_more_within takes another). MenuItem::paint_content takes MenuItemColors. button_styles::FramelessIcon has no size: the button's icon_size sizes the icon. KeycapStyle literals add ..KeycapStyle::default(). DiffDocument::old is old_text, and FindLabels borrows its words. Pill and bare icon buttons keep the arrow pointer: a style of the app's that wants the hand returns it from ButtonStyle::cursor.

Upstream

What this release needed from egui and winit, proposed upstream and carried in the apps' forks until a release includes it:

  • emilk/egui#8969: a Wayland connection the compositor closed is an error, not a panic. Open.
  • emilk/egui#8985: Wayland touchpads scroll as far as in GTK 4. Open.
  • emilk/egui#8990: one glyph per character when a cluster shapes into more glyphs, so carets, clicks and selection stay on character edges. Open.
  • emilk/egui#9014: no accessibility bookkeeping while no screen reader listens, so no context lock per widget for an empty node. Open.
  • emilk/egui#9015: a scroll target lands on the frame it is asked, not one frame later. Open.
  • emilk/egui#9008: always-hidden scroll bars no longer animate a hover fade. Open; fastframe-ui's Scrollable does without it, so the fork doesn't carry it.
  • emilk/egui#8911: text at a new size no longer re-analyses an auto-hinted font, about 40% faster first layout. Merged after 0.38.0.
  • rust-windowing/winit#4692: macOS Quit through close requests, which the fork extends to tell a Quit from a close click and keep a quit Apple Event's sender waiting for the app's answer. Open.
  • rust-windowing/winit#4867: Wayland outputs and seats announced at runtime are bound after a round trip. Open.
  • rust-windowing/winit#4868: Windows keeps a window's minimum size when the system moves it. Open.

Thanks

@Felitendo, @Espaye and @farheinheigt for their pull requests, and @alex3137, @rigues, @wkazisan, @Striffly and @mdmrk for their reports and requests.

Full changelog: all changes since 0.18.0.