Skip to content

feat(ui): configurable floating transcription bar (single-line + multi-line)#122

Merged
joewongjc merged 1 commit intojoewongjc:mainfrom
MangoWAY:feat/floating-transcription-bar-layout
Apr 13, 2026
Merged

feat(ui): configurable floating transcription bar (single-line + multi-line)#122
joewongjc merged 1 commit intojoewongjc:mainfrom
MangoWAY:feat/floating-transcription-bar-layout

Conversation

@MangoWAY
Copy link
Copy Markdown
Contributor

Summary

Adds user-configurable layout modes for the bottom floating live transcription bar (the non-activating panel shown while recording). Reviewers can see what this looks like in the screenshot below—no need to infer behavior from SwiftUI alone.

Motivation

During long dictation, the previous single-line bar only showed a short tail of text. Users asked for wider single-line and multi-line options so they can still read what they said earlier without relying only on history after the fact.

What’s new

Settings (General → Speech recognition behavior)

New dropdown “Transcription bar” / 「识别悬浮条」 (UserDefaults key tf_floatingBarLayout):

Mode Behavior
Single line · default width Same spirit as before (~400pt max width), trailing tail with optional left fade when capped
Single line · wide Larger max width (~640pt)
Multi-line · 2 / 3 / 4 rows Taller bar, leading-aligned text, vertical scroll to the latest content when it overflows; max width per preset (520–680pt)

Implementation notes

  • FloatingBarLayoutMode: centralizes presets, dimensions, and settings labels (EN/ZH).
  • Width: Bar grows with transcript width up to the mode’s max (multi-line no longer jumped to full width on first token).
  • Shape: Replaced unconditional Capsule() clip with rounded rectangle and capped corner radius (TF.floatingBarMaxCornerRadius) so wide bars don’t use stadium ends that clip text; small square “preparing” state stays circular.
  • Multi-line UX: Left-aligned text, dimmed AudioRipple behind text, recording dot vertically centered to the text block; panel resizes on layout change (Notification.Name.floatingBarLayoutDidChange), with an NSObject selector bridge to satisfy Swift initialization rules for observers.

Screenshot

Multi-line mode (4 visible rows) — real capture from local testing:

Floating transcription bar — multi-line, four rows visible

(Image file in repo: docs/images/floating-bar-multiline-4rows.png)

Testing

  • swift build -c release
  • swift test
  • Manual: switch each layout in Settings, start/stop recording, confirm bar size, alignment, and panel resize.

Files touched (high level)

  • Type4Me/UI/FloatingBar/FloatingBarLayoutMode.swift (new)
  • Type4Me/UI/FloatingBar/FloatingBarView.swift, FloatingBarPanel.swift
  • Type4Me/UI/Settings/GeneralSettingsTab.swift
  • Type4Me/UI/DesignSystem.swift (floating bar corner cap token)
  • docs/images/floating-bar-multiline-4rows.png (documentation / PR illustration)

- Add layout presets (General settings): single-line default/wide, multi-line 2–4 rows
- Grow bar width with transcript until max width; multiline wraps/scrolls inside
- Replace full Capsule clip with capped corner radius to reduce text clipping on wide bars
- Multiline: leading-aligned copy, scroll-to-latest, dimmed AudioRipple, centered record dot
- Resize NSPanel when layout changes; layout screenshot in docs/images/

Made-with: Cursor
@joewongjc
Copy link
Copy Markdown
Owner

Merged into main — conflicts with our hover preview feature resolved in favor of our implementation. Thanks for the contribution @MangoWAY! Your commit is preserved in history.

@joewongjc joewongjc merged commit 0705e73 into joewongjc:main Apr 13, 2026
@joewongjc
Copy link
Copy Markdown
Owner

我给你优化了一下,Hover出完整文本,也可以完全关闭。

@MangoWAY
Copy link
Copy Markdown
Contributor Author

我给你优化了一下,Hover出完整文本,也可以完全关闭。

👍

joewongjc added a commit that referenced this pull request Apr 13, 2026
Contributed by @MangoWAY — batch selection/delete for history records,
transactional multi-row SQLite delete, selection helpers with tests.

Additional fix: VStack → LazyVStack for proper infinite scroll pagination.
Reverted PR #122 auto-merged floating bar changes (layout mode, corner radius).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants