native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #169 from sbertix/sbertix/standardize-hotkeys

authored by

khoi and committed by
GitHub
db6d189b 779ed383

+55 -21
+10
supacode/App/supacodeApp.swift
··· 177 177 WorktreeCommands(store: store) 178 178 SidebarCommands() 179 179 TerminalCommands(ghosttyShortcuts: ghosttyShortcuts) 180 + WindowCommands(ghosttyShortcuts: ghosttyShortcuts) 180 181 CommandGroup(after: .textEditing) { 181 182 Button("Command Palette") { 182 183 store.send(.commandPalette(.togglePresented)) ··· 186 187 } 187 188 UpdateCommands(store: store.scope(state: \.updates, action: \.updates)) 188 189 CommandGroup(replacing: .windowArrangement) { 190 + Button("Supacode") { 191 + if let window = NSApp.windows.first(where: { $0.identifier?.rawValue == "main" }) { 192 + window.makeKeyAndOrderFront(nil) 193 + NSApp.activate(ignoringOtherApps: true) 194 + } 195 + } 196 + .keyboardShortcut("0") 197 + .help("Show main window (⌘0)") 198 + Divider() 189 199 Button("Minimize") { 190 200 NSApp.keyWindow?.miniaturize(nil) 191 201 }
+6 -16
supacode/Commands/TerminalCommands.swift
··· 18 18 } 19 19 .modifier(KeyboardShortcutModifier(shortcut: ghosttyShortcuts.keyboardShortcut(for: "new_tab"))) 20 20 .disabled(newTerminalAction == nil) 21 - Button("Close") { 21 + Button("Close Terminal") { 22 22 closeSurfaceAction?() 23 23 } 24 24 .modifier( 25 - KeyboardShortcutModifier(shortcut: ghosttyShortcuts.keyboardShortcut(for: "close_surface")) 25 + KeyboardShortcutModifier( 26 + shortcut: closeSurfaceAction == nil ? nil : ghosttyShortcuts.keyboardShortcut(for: "close_surface") 27 + ) 26 28 ) 27 29 .disabled(closeSurfaceAction == nil) 28 - Button("Close Tab") { 30 + Button("Close Terminal Tab") { 29 31 closeTabAction?() 30 32 } 31 33 .modifier( ··· 167 169 get { self[EndSearchActionKey.self] } 168 170 set { self[EndSearchActionKey.self] = newValue } 169 171 } 170 - } 171 - 172 - private struct KeyboardShortcutModifier: ViewModifier { 173 - let shortcut: KeyboardShortcut? 174 - 175 - func body(content: Content) -> some View { 176 - if let shortcut { 177 - content.keyboardShortcut(shortcut) 178 - } else { 179 - content 180 - } 181 - } 182 - } 172 + }
+34
supacode/Commands/WindowCommands.swift
··· 1 + import SwiftUI 2 + 3 + struct WindowCommands: Commands { 4 + let ghosttyShortcuts: GhosttyShortcutManager 5 + @FocusedValue(\.closeSurfaceAction) private var closeSurfaceAction 6 + 7 + var body: some Commands { 8 + let closeSurfaceHotkey = ghosttyShortcuts.keyboardShortcut(for: "close_surface") 9 + let isCloseSurfaceOverlapping = closeSurfaceHotkey?.key == "w" && closeSurfaceHotkey?.modifiers == .command 10 + 11 + CommandGroup(replacing: .saveItem) { 12 + Button("Close Window", systemImage: "xmark") { 13 + NSApplication.shared.keyWindow?.performClose(nil) 14 + } 15 + .modifier( 16 + KeyboardShortcutModifier( 17 + shortcut: !isCloseSurfaceOverlapping || closeSurfaceAction == nil ? .init("w") : nil 18 + ) 19 + ) 20 + } 21 + } 22 + } 23 + 24 + struct KeyboardShortcutModifier: ViewModifier { 25 + let shortcut: KeyboardShortcut? 26 + 27 + func body(content: Content) -> some View { 28 + if let shortcut { 29 + content.keyboardShortcut(shortcut) 30 + } else { 31 + content 32 + } 33 + } 34 + }
+1 -1
supacode/Features/Repositories/Views/ArchivedWorktreesDetailView.swift
··· 85 85 selectedArchivedWorktreeIDs = selectedArchivedWorktreeIDs.intersection(newValue) 86 86 } 87 87 .animation(.easeOut(duration: 0.2), value: archivedRowIDs) 88 - .focusedSceneValue(\.deleteWorktreeAction, deleteWorktreeAction) 88 + .focusedValue(\.deleteWorktreeAction, deleteWorktreeAction) 89 89 .focusedSceneValue(\.confirmWorktreeAction, confirmWorktreeAction) 90 90 .toolbar { 91 91 let deleteShortcut = KeyboardShortcut(.delete, modifiers: [.command, .shift]).display
+2 -2
supacode/Features/Repositories/Views/SidebarView.swift
··· 30 30 terminalManager: terminalManager 31 31 ) 32 32 .focusedSceneValue(\.confirmWorktreeAction, confirmWorktreeAction) 33 - .focusedSceneValue(\.archiveWorktreeAction, archiveWorktreeAction) 34 - .focusedSceneValue(\.deleteWorktreeAction, deleteWorktreeAction) 33 + .focusedValue(\.archiveWorktreeAction, archiveWorktreeAction) 34 + .focusedValue(\.deleteWorktreeAction, deleteWorktreeAction) 35 35 .focusedSceneValue(\.visibleHotkeyWorktreeRows, visibleHotkeyRows) 36 36 .onAppear { syncSidebarSelections(state: state, visibleWorktreeIDs: visibleWorktreeIDs) } 37 37 .onChange(of: state.selection) { _, _ in
+2 -2
supacode/Features/Repositories/Views/WorktreeDetailView.swift
··· 171 171 content 172 172 .focusedSceneValue(\.openSelectedWorktreeAction, actions.openSelectedWorktree) 173 173 .focusedSceneValue(\.newTerminalAction, actions.newTerminal) 174 - .focusedSceneValue(\.closeTabAction, actions.closeTab) 175 - .focusedSceneValue(\.closeSurfaceAction, actions.closeSurface) 174 + .focusedValue(\.closeTabAction, actions.closeTab) 175 + .focusedValue(\.closeSurfaceAction, actions.closeSurface) 176 176 .focusedSceneValue(\.startSearchAction, actions.startSearch) 177 177 .focusedSceneValue(\.searchSelectionAction, actions.searchSelection) 178 178 .focusedSceneValue(\.navigateSearchNextAction, actions.navigateSearchNext)