Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Home's permission marks open what their names open
Țugui Dragoș0119cdf2f865
diff --git a/Peel/Views/Home/HomePermissionsView.swift b/Peel/Views/Home/HomePermissionsView.swiftindex 082fee1d..7589f432 100644--- a/Peel/Views/Home/HomePermissionsView.swift+++ b/Peel/Views/Home/HomePermissionsView.swift@@ -6,6 +6,8 @@ struct HomePermissionsContent: View {@Environment(HomeModel.self) private var home@Environment(HelperModel.self) private var helper@Environment(ExclusionsStore.self) private var exclusions+ @Environment(\.openSettings) private var openSettings+ @AppStorage(SettingsKey.pane) private var settingsPane = SettingsPane.general.rawValue@State private var pointingAt: HomeModel.Permission?static let markSize: CGFloat = 36@@ -79,7 +81,18 @@ struct HomePermissionsContent: View {// The state sits under the name, as in System Settings, and a long name wraps instead of// shrinking. A column of its own for the state would leave a translated name almost no room.HStack(spacing: 12) {- mark(permission, state: state)+ // The mark opens the same place as the name beside it, and lights up with it. VoiceOver and the+ // keyboard reach that place through the name, so the mark is one more way in for the pointer only.+ Button { show(permission) } label: {+ mark(permission, state: state)+ .scaleEffect(pointingAt == permission ? 1.07 : 1)+ }+ .buttonStyle(.plain)+ .focusable(false)+ .pointerStyle(.link)+ .motion(.touch, .movement, value: pointingAt == permission)+ .onHover { pointingAt = $0 ? permission : nil }+ .help(help(for: permission))VStack(alignment: .leading, spacing: 1) {HStack(spacing: 5) {name(permission, state: state)@@ -103,26 +116,38 @@ struct HomePermissionsContent: View {.padding(.vertical, 6)}- @ViewBuilderprivate func name(_ permission: HomeModel.Permission, state: HomeModel.State) -> some View {- let title = Text(permission.title)- .font(.system(.body, design: .rounded, weight: .bold))- .fixedSize(horizontal: false, vertical: true)+ let isPointedAt = pointingAt == permission+ return Button { show(permission) } label: {+ // The name swells a little under the pointer, and the mark beside it with it.+ Text(permission.title)+ .font(.system(.body, design: .rounded, weight: .bold))+ .fixedSize(horizontal: false, vertical: true)+ .foregroundStyle(state.isMissing ? Album.red : isPointedAt ? Album.orangeInk : Album.ink)+ .scaleEffect(isPointedAt ? 1.04 : 1, anchor: .leading)+ .minimumTarget()+ }+ .buttonStyle(.plain)+ .pointerStyle(.link)+ .motion(.touch, .movement, value: isPointedAt)+ .onHover { pointingAt = $0 ? permission : nil }+ .help(help(for: permission))+ }++ private func help(for permission: HomeModel.Permission) -> Text {+ permission.isInSystemSettings+ ? Text("Show \(String(localized: permission.title)) in System Settings")+ : Text("Open Peel Settings")+ }++ /// Opens where the setting is kept: its place in System Settings, or, for the command, which Peel puts on the+ /// path itself, the General tab of Peel's own Settings.+ private func show(_ permission: HomeModel.Permission) {if permission.isInSystemSettings {- let isPointedAt = pointingAt == permission- Button { reveal(permission) } label: {- title- .foregroundStyle(state.isMissing ? Album.red : isPointedAt ? Album.orangeInk : Album.ink)- .underline(isPointedAt, pattern: .solid)- .minimumTarget()- }- .buttonStyle(.plain)- .pointerStyle(.link)- .motion(.touch, value: isPointedAt)- .onHover { pointingAt = $0 ? permission : nil }- .help(Text("Show \(String(localized: permission.title)) in System Settings"))+ reveal(permission)} else {- title.foregroundStyle(state.isMissing ? Album.red : Album.ink)+ settingsPane = SettingsPane.general.rawValue+ openSettings()}}diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swiftindex a4139759..a65b39ce 100644--- a/Peel/Views/Settings/SettingsView.swift+++ b/Peel/Views/Settings/SettingsView.swift@@ -4,30 +4,32 @@ import PeelCoreimport ServiceManagementimport SwiftUI+/// The tabs of Settings. The one open is remembered under `SettingsKey.pane`, which is also how another page+/// opens Settings at a tab of its choosing.+enum SettingsPane: String {+ case general+ case exclusions+ case privacy+ case helper+}+/// The Settings tabs, shared by the Settings window (Command-Comma) and the Settings page in Peel's sidebar./// The last open tab is remembered, as the Human Interface Guidelines ask of a settings window.struct SettingsTabs: View {- private enum Pane: String {- case general- case exclusions- case privacy- case helper- }-- @AppStorage("settingsPane") private var pane = Pane.general.rawValue+ @AppStorage(SettingsKey.pane) private var pane = SettingsPane.general.rawValuevar body: some View {TabView(selection: $pane) {- Tab("General", systemImage: "gearshape", value: Pane.general.rawValue) {+ Tab("General", systemImage: "gearshape", value: SettingsPane.general.rawValue) {GeneralSettingsView()}- Tab("Exclusions", systemImage: "hand.raised", value: Pane.exclusions.rawValue) {+ Tab("Exclusions", systemImage: "hand.raised", value: SettingsPane.exclusions.rawValue) {ExclusionsSettingsView()}- Tab("Privacy", systemImage: "network", value: Pane.privacy.rawValue) {+ Tab("Privacy", systemImage: "network", value: SettingsPane.privacy.rawValue) {PrivacySettingsView()}- Tab("Helper", systemImage: "lock.shield", value: Pane.helper.rawValue) {+ Tab("Helper", systemImage: "lock.shield", value: SettingsPane.helper.rawValue) {HelperSettingsView()}}@@ -44,6 +46,7 @@ struct SettingsView: View {}enum SettingsKey {+ static let pane = "settingsPane"static let checksForAppUpdates = "checksForAppUpdates"static let watchesTrash = "watchesTrash"/// The tools the sidebar leaves out (`Tool.hidden(in:)`).