mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Add "Edit Shortcuts" context menu to Home shortcuts
Long-press (or right-click) any Home shortcut to open the Home settings sheet for reordering and toggling shortcuts.
This commit is contained in:
@@ -382,6 +382,9 @@ struct HomeView: View {
|
||||
return LazyVGrid(columns: columns, spacing: gridSpacing) {
|
||||
ForEach(settingsManager?.visibleShortcuts() ?? HomeShortcutItem.defaultOrder) { shortcut in
|
||||
shortcutCardView(for: shortcut)
|
||||
#if !os(tvOS)
|
||||
.contextMenu { editShortcutsButton }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
@@ -404,9 +407,23 @@ struct HomeView: View {
|
||||
) {
|
||||
shortcutRowView(for: shortcut)
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.contextMenu { editShortcutsButton }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if !os(tvOS)
|
||||
/// Context menu action that opens the Home settings sheet to reorder/toggle shortcuts.
|
||||
private var editShortcutsButton: some View {
|
||||
Button {
|
||||
showingCustomizeHome = true
|
||||
} label: {
|
||||
Label(String(localized: "home.editShortcuts"), systemImage: "gear")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ViewBuilder
|
||||
private func shortcutCardView(for shortcut: HomeShortcutItem) -> some View {
|
||||
switch shortcut {
|
||||
|
||||
Reference in New Issue
Block a user