Skip to content

Commit

Permalink
Add keyboard shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
alienator88 committed Dec 18, 2024
1 parent c2d1d50 commit 3c6b396
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
38 changes: 36 additions & 2 deletions Pearcleaner/Logic/AppCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,42 @@ struct AppCommands: Commands {


}



// Window Menu
CommandGroup(after: .sidebar) {

Menu("Navigate To") {
Button
{
appState.currentPage = .applications

} label: {
Text("Applications")
}
.keyboardShortcut("1", modifiers: .command)

Button
{
appState.currentPage = .development

} label: {
Text("Development")
}
.keyboardShortcut("2", modifiers: .command)

Button
{
appState.currentPage = .orphans

} label: {
Text("Orphaned Files")
}
.keyboardShortcut("3", modifiers: .command)
}

}


// Tools Menu
CommandMenu(Text("Tools", comment: "Tools Menu")) {
Expand Down Expand Up @@ -173,4 +208,3 @@ struct AppCommands: Commands {

}
}

1 change: 1 addition & 0 deletions Pearcleaner/Logic/DeepLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class DeeplinkManager {

switch action {
case DeepLinkActions.openPearcleaner:
appState.currentPage = .applications
break
case DeepLinkActions.openSettings:
openAppSettings()
Expand Down
14 changes: 13 additions & 1 deletion Pearcleaner/Logic/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,21 @@ struct CustomPickerButton: View {
HStack {
Image(systemName: option.icon)
Text(option.title)
Spacer()
switch option.title {
case "Applications":
Text(verbatim: "⌘1").font(.footnote).opacity(0.3)
case "Development":
Text(verbatim: "⌘2").font(.footnote).opacity(0.3)
case "Orphaned Files":
Text(verbatim: "⌘3").font(.footnote).opacity(0.3)
default:
EmptyView()
}

}
.padding(.vertical, 8)
.frame(maxWidth: 125, alignment: .leading)
.frame(maxWidth: 140, alignment: .leading)
.contentShape(Rectangle())
.opacity(hoveredItem == option.title ? 0.7 : 1.0) // Change opacity on hover
.onTapGesture {
Expand Down
3 changes: 3 additions & 0 deletions Pearcleaner/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -6397,6 +6397,9 @@
}
}
}
},
"Navigate To" : {

},
"Never" : {
"extractionState" : "manual",
Expand Down

0 comments on commit 3c6b396

Please sign in to comment.