chore: remove Keyboard Shortcuts menu item and window
No real app-specific shortcuts existed - the panel only listed Return/⌘,/⌘W/⌘Q (standard macOS conventions everyone already knows, and it didn't even include the app's actual shortcuts like ⌘K for Command Palette). Removed the menu item from AccountFooter's bottom menu, the Window scene that hosted it, and KeyboardShortcutsView itself plus WindowConfigurator.swift (disablesFullScreen() had no other caller once this was gone).
This commit is contained in:
@@ -10,7 +10,6 @@ struct AccountFooter: View {
|
||||
@Environment(SessionStore.self) private var session
|
||||
@Environment(AppNavigation.self) private var navigation
|
||||
@Environment(\.openURL) private var openURL
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
@AppStorage("outpost.appearance") private var appearance: AppAppearance = .system
|
||||
@AppStorage(CachingOutlineAPIClient.offlineModeDefaultsKey) private var isOfflineModeEnabled = false
|
||||
@State private var isMenuPresented = false
|
||||
@@ -63,10 +62,6 @@ struct AccountFooter: View {
|
||||
|
||||
private var menuContent: some View {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
menuItem("Keyboard Shortcuts…") { openWindow(id: "keyboard-shortcuts") }
|
||||
|
||||
Divider()
|
||||
|
||||
menuItem("Documentation") { openURL(repositoryURL) }
|
||||
if let apiDocumentationURL {
|
||||
menuItem("API Documentation") { openURL(apiDocumentationURL) }
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#if os(macOS)
|
||||
import SwiftUI
|
||||
|
||||
struct KeyboardShortcutsView: View {
|
||||
private struct Shortcut: Identifiable {
|
||||
let id = UUID()
|
||||
let action: String
|
||||
let keys: String
|
||||
}
|
||||
|
||||
private let shortcuts: [Shortcut] = [
|
||||
Shortcut(action: "Sign In", keys: "⏎"),
|
||||
Shortcut(action: "Preferences", keys: "⌘ ,"),
|
||||
Shortcut(action: "Close Window", keys: "⌘ W"),
|
||||
Shortcut(action: "Quit Outpost", keys: "⌘ Q")
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
Text("Keyboard Shortcuts")
|
||||
.font(.title3.bold())
|
||||
|
||||
VStack(spacing: 10) {
|
||||
ForEach(shortcuts) { shortcut in
|
||||
HStack {
|
||||
Text(shortcut.action)
|
||||
Spacer()
|
||||
Text(shortcut.keys)
|
||||
.foregroundStyle(.secondary)
|
||||
.monospaced()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(24)
|
||||
.frame(width: 280)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -75,14 +75,6 @@ struct OutpostApp: App {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
Window("Keyboard Shortcuts", id: "keyboard-shortcuts") {
|
||||
KeyboardShortcutsView()
|
||||
.disablesFullScreen()
|
||||
}
|
||||
.windowResizability(.contentSize)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#if os(macOS)
|
||||
import SwiftUI
|
||||
import AppKit
|
||||
|
||||
/// Grabs the hosting `NSWindow` once it's attached to a screen, for the
|
||||
/// handful of things SwiftUI's `Window` scene doesn't expose a modifier for.
|
||||
private struct WindowConfigurator: NSViewRepresentable {
|
||||
let configure: (NSWindow) -> Void
|
||||
|
||||
func makeNSView(context: Context) -> NSView {
|
||||
let view = NSView()
|
||||
DispatchQueue.main.async {
|
||||
if let window = view.window {
|
||||
configure(window)
|
||||
}
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
func updateNSView(_ nsView: NSView, context: Context) {}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// `Window` scenes default to a full standard titlebar, fullscreen
|
||||
/// (green) button included — not appropriate for fixed-size reference
|
||||
/// panels like About or Keyboard Shortcuts, which have no reason to
|
||||
/// support fullscreen at all.
|
||||
func disablesFullScreen() -> some View {
|
||||
background(
|
||||
WindowConfigurator { window in
|
||||
window.collectionBehavior.remove(.fullScreenPrimary)
|
||||
window.collectionBehavior.insert(.fullScreenNone)
|
||||
window.standardWindowButton(.zoomButton)?.isHidden = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user