Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/TinyHand/OverlayController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ final class OverlayController {
let near = f.insetBy(dx: -80, dy: 0).union(f.offsetBy(dx: 0, dy: 90)).insetBy(dx: 0, dy: -10).contains(mouse)
let needsPermission = !inputTap.isInstalled
let drawing = armView.ink.isDrawing
toolbar.setRevealed(!drawing && (near || Date() < revealUntil || needsPermission))
toolbar.setRevealed(needsPermission || (Preferences.showToolbar && !drawing && (near || Date() < revealUntil)))

let menuLikely = !menuRects.isEmpty || ownMenuOpen || Date() < menuOpeningUntil
|| Date().timeIntervalSince(lastButtonEvent) < 2
Expand Down
7 changes: 6 additions & 1 deletion Sources/TinyHand/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ enum Preferences {
set { set(newValue.rawValue, "inkChoice") }
}

static var showToolbar: Bool {
get { defaults.object(forKey: "showToolbar") as? Bool ?? true }
set { set(newValue, "showToolbar") }
}

static var showInkButton: Bool {
get { defaults.object(forKey: "showInkButton") as? Bool ?? true }
set { set(newValue, "showInkButton") }
Expand Down Expand Up @@ -182,7 +187,7 @@ enum Preferences {
static func resetAll() {
for key in ["shortcut.toggle", "shortcut.clear", "pointerSize", "showShadow", "fadeSeconds",
"sound.hands", "sound.laser", "interactKey", "interactKeepsHand", "doubleShiftClickThrough", "pinnedStyles", "pointerStyle",
"inkChoice", "showInkButton", "tapSound"] {
"inkChoice", "showInkButton", "showToolbar", "tapSound"] {
defaults.removeObject(forKey: key)
}
NotificationCenter.default.post(name: changed, object: nil)
Expand Down
17 changes: 13 additions & 4 deletions Sources/TinyHand/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ private struct PointersPage: View {
RoundedRectangle(cornerRadius: 14, style: .continuous)
.fill(Color.primary.opacity(0.045))
)
.opacity(Preferences.showToolbar ? 1 : 0.45)
.background(GeometryReader { g in
Color.clear
.onAppear { rowFrame = g.frame(in: .named("pointersPage")) }
Expand All @@ -603,6 +604,18 @@ private struct PointersPage: View {
Text(message).font(.system(size: 12)).foregroundColor(.red).padding(.horizontal, 4)
}
}
Card(title: "Toolbar") {
Row("Show the toolbar", detail: Preferences.showToolbar
? "Pops up when the pointer turns on and near the bottom of the screen."
: "Stays hidden. Press Esc to exit, or use the menu bar.") {
Toggle("", isOn: model.binding({ Preferences.showToolbar }, { Preferences.showToolbar = $0 }))
.toggleStyle(.switch).labelsHidden().focusable(false)
}
Row("Ink button", detail: "Change the colour while you present.") {
Toggle("", isOn: model.binding({ Preferences.showInkButton }, { Preferences.showInkButton = $0 }))
.toggleStyle(.switch).labelsHidden().focusable(false)
}
}
YourHands(model: model)
}
.coordinateSpace(name: "pointersPage")
Expand Down Expand Up @@ -989,10 +1002,6 @@ private struct DrawingPage: View {
.fixedSize()
.focusable(false)
}
Row("Ink button in the toolbar", detail: "Change the colour while you present.") {
Toggle("", isOn: model.binding({ Preferences.showInkButton }, { Preferences.showInkButton = $0 }))
.toggleStyle(.switch).labelsHidden().focusable(false)
}
}
}
}
Expand Down