Skip to content

feat: add pin groups for organizing pinned items#1423

Open
zyuanyuz wants to merge 4 commits into
p0deje:masterfrom
zyuanyuz:feature/pin-groups
Open

feat: add pin groups for organizing pinned items#1423
zyuanyuz wants to merge 4 commits into
p0deje:masterfrom
zyuanyuz:feature/pin-groups

Conversation

@zyuanyuz

Copy link
Copy Markdown

✨ Pin Groups — Organize Pinned Items into Collapsible Folders

Summary

This PR adds pin groups to Maccy, allowing users to organize their pinned clipboard items into named, collapsible folders. A global preference controls whether groups start expanded or collapsed.

Motivation

Pinned items accumulate over time. Without grouping, the pinned section becomes a long flat list that is hard to navigate. Groups bring structure — users can categorize pins by project, type, or any scheme that fits their workflow.

Features

Group Management

  • Create groups in Preferences → Pins → Groups section
  • Rename or delete groups (deleting a group moves its items to ungrouped — pins are preserved)
  • Groups are sorted by creation order with visual folder icons and item counts

Pinning Flow

  • When pinning an item (⌥P), a group picker overlay appears
  • Choose an existing group, create a new one on the spot, or leave ungrouped
  • The group picker is skipped when unpinning (items are removed directly)

Popup Display

  • Single group: items display inline without a header (backward compatible)
  • Multiple groups: each group gets a collapsible header — click to expand/collapse
  • Ungrouped pins display without a header below grouped ones
  • Group sort order is respected within the pinned section

Global Preference

  • "Expand groups by default" toggle in Preferences → Pins
  • When enabled (default): all groups start expanded
  • When disabled: all groups start collapsed, click to expand individually
  • Toggling the preference updates all groups in real time — no restart needed

Data Model

Model Fields
PinGroup name, sortOrder, createdAt, items (relationship)
HistoryItem pinGroup (optional relationship), pin (unchanged)

Code Changes

Area Files Purpose
Model PinGroup.swift, HistoryItem.swift, Storage.xcdatamodel PinGroup entity + relationship
Manager PinGroupsManager.swift CRUD, expand/collapse state, Defaults observer
Views PinGroupHeaderView.swift, PinGroupPickerView.swift, PinsView.swift, ContentView.swift UI for headers, picker overlay, grouped rendering
Settings PinsSettingsPane.swift Group management UI + expand preference toggle
Sorting Sorter.swift Group-aware sort priority
Config Defaults.Keys+Names.swift expandPinGroupsByDefault key
i18n PinsSettings.strings (41 languages), PinGroups.strings (41 languages) Full localization
Docs README.md Feature entries in Features + Usage sections

Backward Compatibility

  • No migration needed: all existing pinned items have pinGroup = nil and display as "ungrouped"
  • No breaking changes: the pin/unpin keyboard shortcuts work as before
  • Single-group display has no header, matching the pre-group appearance

Screenshots

image

Group picker when pinning:
image

Collapsible group headers in popup:
Group management in Preferences:
image

zyuanyuz and others added 4 commits June 20, 2026 15:53
- Add PinGroup model with SwiftData persistence
- Add PinGroupsManager for group CRUD and expand/collapse state
- Add PinGroupPickerView for assigning items to groups when pinning
- Add PinGroupHeaderView for collapsible group headers in popup
- Update PinsView to render items grouped with expand/collapse
- Add group management UI in PinsSettingsPane (create/rename/delete)
- Add Sorter with group-based sort priority
- Add localization for all group-related strings (41 languages)
- Update README with pin groups documentation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add expandPinGroupsByDefault setting (Defaults.Key<Bool>, default: true)
- PinGroupsManager.load() and createGroup() respect the preference
- Add toggle in PinsSettingsPane under Groups section
- Add English and Simplified Chinese localization

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add Defaults.observe in PinGroupsManager so that toggling
"Expand groups by default" in Preferences immediately expands
or collapses all groups instead of requiring an app restart.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
English, Simplified Chinese, and Traditional Chinese have
proper translations; other 38 languages fall back to English
text (to be translated via Weblate).

Co-Authored-By: Claude Fable 5 <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.

1 participant