Files
gart/code/Hex-main/Hex/Features/Settings/GeneralSectionView.swift
T

111 lines
2.8 KiB
Swift
Executable File

import ComposableArchitecture
import HexCore
import Inject
import SwiftUI
struct GeneralSectionView: View {
@ObserveInjection var inject
@Bindable var store: StoreOf<SettingsFeature>
var body: some View {
Section {
Label {
Toggle("Open on Login",
isOn: Binding(
get: { store.hexSettings.openOnLogin },
set: { store.send(.toggleOpenOnLogin($0)) }
))
} icon: {
Image(systemName: "arrow.right.circle")
}
Label {
Toggle(
"Show Dock Icon",
isOn: Binding(
get: { store.hexSettings.showDockIcon },
set: { store.send(.toggleShowDockIcon($0)) }
)
)
} icon: {
Image(systemName: "dock.rectangle")
}
Label {
Toggle(
"Use clipboard to insert",
isOn: Binding(
get: { store.hexSettings.useClipboardPaste },
set: { store.send(.setUseClipboardPaste($0)) }
)
)
Text("Use clipboard to insert text. Fast but may not restore all clipboard content.\nTurn off to use simulated keypresses. Slower, but doesn't need to restore clipboard")
} icon: {
Image(systemName: "doc.on.doc.fill")
}
Label {
Toggle(
"Copy to clipboard",
isOn: Binding(
get: { store.hexSettings.copyToClipboard },
set: { store.send(.setCopyToClipboard($0)) }
)
)
Text("Copy transcription text to clipboard in addition to pasting it")
} icon: {
Image(systemName: "doc.on.clipboard")
}
Label {
Toggle(
"Prevent System Sleep while Recording",
isOn: Binding(
get: { store.hexSettings.preventSystemSleep },
set: { store.send(.togglePreventSystemSleep($0)) }
)
)
} icon: {
Image(systemName: "zzz")
}
Label {
Toggle(
"Super Fast Mode",
isOn: Binding(
get: { store.hexSettings.superFastModeEnabled },
set: { store.send(.toggleSuperFastMode($0)) }
)
)
Text("Keep the microphone warm and prepend a short in-memory buffer for near-instant capture. macOS will keep showing the microphone indicator while this mode is armed.")
} icon: {
Image(systemName: "bolt.circle")
}
Label {
HStack(alignment: .center) {
Text("Audio Behavior while Recording")
Spacer()
Picker("", selection: Binding(
get: { store.hexSettings.recordingAudioBehavior },
set: { store.send(.setRecordingAudioBehavior($0)) }
)) {
Label("Pause Media", systemImage: "pause")
.tag(RecordingAudioBehavior.pauseMedia)
Label("Mute Volume", systemImage: "speaker.slash")
.tag(RecordingAudioBehavior.mute)
Label("Do Nothing", systemImage: "hand.raised.slash")
.tag(RecordingAudioBehavior.doNothing)
}
.pickerStyle(.menu)
}
} icon: {
Image(systemName: "speaker.wave.2")
}
} header: {
Text("General")
}
.enableInjection()
}
}