native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #95 from supabitapp/add-split-buttons-near-new-tab

Add inline split buttons next to New Tab

authored by

khoi and committed by
GitHub
50c43408 536ea38d

+50 -4
+50 -4
supacode/Features/Terminal/TabBar/Views/TerminalTabBarTrailingAccessories.swift
··· 18 18 @State private var closeTask: Task<Void, Never>? 19 19 20 20 var body: some View { 21 + HStack(spacing: TerminalTabBarMetrics.contentTrailingSpacing) { 22 + newTabButton 23 + splitButton( 24 + title: "Split Vertically", 25 + systemImage: "square.split.2x1", 26 + shortcutBinding: "new_split:right", 27 + action: splitVertically 28 + ) 29 + .disabled(!canSplit) 30 + splitButton( 31 + title: "Split Horizontally", 32 + systemImage: "square.split.1x2", 33 + shortcutBinding: "new_split:down", 34 + action: splitHorizontally 35 + ) 36 + .disabled(!canSplit) 37 + } 38 + .frame(height: TerminalTabBarMetrics.barHeight) 39 + .padding(.trailing, 8) 40 + } 41 + 42 + private var newTabButton: some View { 21 43 Button { 22 44 createTab() 23 45 isHoverPopoverPresented = false ··· 56 78 updateHoverPopoverVisibility() 57 79 } 58 80 } 59 - .frame(height: TerminalTabBarMetrics.barHeight) 60 - .padding(.trailing, 8) 81 + } 82 + 83 + private func splitButton( 84 + title: String, 85 + systemImage: String, 86 + shortcutBinding: String, 87 + action: @escaping () -> Void 88 + ) -> some View { 89 + let shortcut = ghosttyShortcuts.display(for: shortcutBinding) 90 + 91 + return Button(action: action) { 92 + if commandKeyObserver.isPressed { 93 + HStack(spacing: TerminalTabBarMetrics.contentSpacing) { 94 + Text(title) 95 + .font(.caption) 96 + if let shortcut { 97 + ShortcutHintView(text: shortcut, color: TerminalTabBarColors.inactiveText) 98 + } 99 + } 100 + } else { 101 + Label(title, systemImage: systemImage) 102 + .labelStyle(.iconOnly) 103 + } 104 + } 105 + .buttonStyle(.borderless) 106 + .help(helpText(title, shortcut: shortcut)) 61 107 } 62 108 63 109 private var hoverPopoverContent: some View { ··· 87 133 isHoverPopoverPresented = false 88 134 } label: { 89 135 HStack(spacing: 8) { 90 - Image(systemName: "rectangle.righthalf.inset.filled") 136 + Image(systemName: "square.split.2x1") 91 137 .accessibilityHidden(true) 92 138 Text("Split Vertically") 93 139 Spacer(minLength: 0) ··· 106 152 isHoverPopoverPresented = false 107 153 } label: { 108 154 HStack(spacing: 8) { 109 - Image(systemName: "rectangle.bottomhalf.inset.filled") 155 + Image(systemName: "square.split.1x2") 110 156 .accessibilityHidden(true) 111 157 Text("Split Horizontally") 112 158 Spacer(minLength: 0)