-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
NewCommandImageView.swift
51 lines (47 loc) · 1.32 KB
/
NewCommandImageView.swift
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
42
43
44
45
46
47
48
49
50
import Bonzai
import SwiftUI
struct NewCommandImageView: View {
let kind: NewCommandView.Kind
@ViewBuilder
var body: some View {
Group {
switch kind {
case .open:
ZStack {
image(for: "~/")
.rotationEffect(.degrees(5))
.offset(.init(width: 4, height: -2))
image(for: "~/".sanitizedPath)
}
case .url:
image(for: "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app")
case .application:
image(for: "/Applications")
case .keyboardShortcut:
KeyboardIconView("fn", size: 24)
case .shortcut:
image(for: "/System/Applications/Shortcuts.app")
case .script:
ScriptIconView(size: 24)
case .text:
TypingIconView(size: 24)
case .system:
image(for: "/System")
case .menuBar:
MenuIconView(size: 24)
case .mouse:
MouseIconView(size: 24)
case .uiElement:
UIElementIconView(size: 24)
case .windowManagement:
WindowManagementIconView(size: 24)
case .builtIn:
image(for: Bundle.main.bundlePath)
}
}
.frame(width: 24, height: 24)
}
private func image(for path: String) -> some View {
IconView(icon: .init(bundleIdentifier: path, path: path), size: .init(width: 24, height: 24))
}
}