From c161c8b4bbda56990972e6f3032a3639ddae3028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alcibiades=20Cabral=20D=C3=ADaz?= Date: Sat, 7 Nov 2026 12:24:57 +0000 Subject: [PATCH] Add a setting to hide the toolbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings → Appearance → Toolbar → Show the toolbar (on by default). When off, the toolbar no longer appears when the pointer turns on or when the mouse reaches the bottom of the screen. It still shows while Accessibility permission is missing, so the permission button stays reachable. Co-Authored-By: Claude Opus 5.5 --- Sources/TinyHand/OverlayController.swift | 2 +- Sources/TinyHand/Preferences.swift | 7 +++++- Sources/TinyHand/SettingsView.swift | 32 +++++++++++++++--------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Sources/TinyHand/OverlayController.swift b/Sources/TinyHand/OverlayController.swift index 4a60e95..fa438c8 100644 --- a/Sources/TinyHand/OverlayController.swift +++ b/Sources/TinyHand/OverlayController.swift @@ -328,7 +328,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 diff --git a/Sources/TinyHand/Preferences.swift b/Sources/TinyHand/Preferences.swift index 5c04cdc..4c4b7d5 100644 --- a/Sources/TinyHand/Preferences.swift +++ b/Sources/TinyHand/Preferences.swift @@ -139,6 +139,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") } @@ -177,7 +182,7 @@ enum Preferences { static func resetAll() { for key in ["shortcut.toggle", "shortcut.clear", "pointerSize", "showShadow", "fadeSeconds", "sound.hands", "sound.laser", "interactKey", "interactKeepsHand", "pinnedStyles", "pointerStyle", - "inkChoice", "showInkButton", "tapSound"] { + "inkChoice", "showInkButton", "showToolbar", "tapSound"] { defaults.removeObject(forKey: key) } NotificationCenter.default.post(name: changed, object: nil) diff --git a/Sources/TinyHand/SettingsView.swift b/Sources/TinyHand/SettingsView.swift index f2b0ddf..3d3c400 100644 --- a/Sources/TinyHand/SettingsView.swift +++ b/Sources/TinyHand/SettingsView.swift @@ -932,20 +932,28 @@ private struct AppearancePage: View { @ObservedObject var model: SettingsModel var body: some View { - Card(title: "Pointer") { - Row("Size") { - HStack(spacing: 10) { - Image(systemName: "hand.point.up.left.fill").font(.system(size: 10)).foregroundColor(.secondary) - Slider(value: model.binding({ Double(Preferences.pointerSize) }, { Preferences.pointerSize = CGFloat($0) }), - in: Double(Preferences.pointerSizeRange.lowerBound)...Double(Preferences.pointerSizeRange.upperBound)) - .frame(width: 180) - .focusable(false) - Image(systemName: "hand.point.up.left.fill").font(.system(size: 16)).foregroundColor(.secondary) + VStack(alignment: .leading, spacing: 22) { + Card(title: "Pointer") { + Row("Size") { + HStack(spacing: 10) { + Image(systemName: "hand.point.up.left.fill").font(.system(size: 10)).foregroundColor(.secondary) + Slider(value: model.binding({ Double(Preferences.pointerSize) }, { Preferences.pointerSize = CGFloat($0) }), + in: Double(Preferences.pointerSizeRange.lowerBound)...Double(Preferences.pointerSizeRange.upperBound)) + .frame(width: 180) + .focusable(false) + Image(systemName: "hand.point.up.left.fill").font(.system(size: 16)).foregroundColor(.secondary) + } + } + Row("Shadow under the pointer") { + Toggle("", isOn: model.binding({ Preferences.showShadow }, { Preferences.showShadow = $0 })) + .toggleStyle(.switch).labelsHidden().focusable(false) } } - Row("Shadow under the pointer") { - Toggle("", isOn: model.binding({ Preferences.showShadow }, { Preferences.showShadow = $0 })) - .toggleStyle(.switch).labelsHidden().focusable(false) + Card(title: "Toolbar") { + Row("Show the toolbar", detail: Preferences.showToolbar ? "Appears when the pointer turns on and when you move to the bottom of the screen." : "Hidden while you present. Turn it back on to switch pointers.") { + Toggle("", isOn: model.binding({ Preferences.showToolbar }, { Preferences.showToolbar = $0 })) + .toggleStyle(.switch).labelsHidden().focusable(false) + } } } }