forked from CodeEditApp/CodeEdit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStartTaskToolbarButton.swift
More file actions
41 lines (35 loc) · 1.22 KB
/
StartTaskToolbarButton.swift
File metadata and controls
41 lines (35 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// StartTaskToolbarButton.swift
// CodeEdit
//
// Created by Austin Condiff on 8/4/24.
//
import SwiftUI
struct StartTaskToolbarButton: View {
@Environment(\.controlActiveState)
private var activeState
@UpdatingWindowController var windowController: CodeEditWindowController?
@ObservedObject var taskManager: TaskManager
@EnvironmentObject var workspace: WorkspaceDocument
var utilityAreaCollapsed: Bool {
windowController?.workspace?.utilityAreaModel?.isCollapsed ?? true
}
var body: some View {
Button {
taskManager.executeActiveTask()
if utilityAreaCollapsed {
CommandManager.shared.executeCommand("open.drawer")
}
workspace.utilityAreaModel?.selectedTab = .debugConsole
taskManager.taskShowingOutput = taskManager.selectedTaskID
} label: {
Label("Start", systemImage: "play.fill")
.labelStyle(.iconOnly)
.opacity(activeState == .inactive ? 0.5 : 1.0)
.font(.system(size: 18, weight: .regular))
.help("Start selected task")
.frame(width: 28)
.offset(CGSize(width: 0, height: 2.5))
}
}
}