Skip to content

Commit

Permalink
split setDefaultForAppShortcut into 2 method
Browse files Browse the repository at this point in the history
  • Loading branch information
CanglongCl committed Feb 13, 2024
1 parent 53d7eec commit 27bca4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Easydict/NewApp/Feature/Shortcut/Shortcut+Default.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ import Magnet

extension Shortcut {
// set defalut for app shortcut
func setDefaultForAppShortcut() {
func setDefaultForShortcut() {
setDefaultForGlobalShortcut()
setDefaultForAppShortcut()
}

private func setDefaultForGlobalShortcut() {
Defaults[.selectionShortcut] = KeyCombo(key: .d, cocoaModifiers: .option)
Defaults[.snipShortcut] = KeyCombo(key: .s, cocoaModifiers: .option)
Defaults[.inputShortcut] = KeyCombo(key: .a, cocoaModifiers: .option)
Defaults[.screenshotOCRShortcut] = KeyCombo(key: .f, cocoaModifiers: [.option, .shift])
Defaults[.showMiniWindowShortcut] = KeyCombo(key: .s, cocoaModifiers: .option)
}

private func setDefaultForAppShortcut() {
setDefaultForGlobalShortcut()

Defaults[.clearInputShortcut] = KeyCombo(key: .k, cocoaModifiers: .command)
Defaults[.clearAllShortcut] = KeyCombo(key: .k, cocoaModifiers: [.command, .shift])
Expand Down
2 changes: 1 addition & 1 deletion Easydict/NewApp/Feature/Shortcut/Shortcut.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Shortcut: NSObject {
if Defaults[.firstLaunch] {
Defaults[.firstLaunch] = false
// set defalut for app shortcut
shortcut.setDefaultForAppShortcut()
shortcut.setDefaultForShortcut()
} else {
// do nothing
}
Expand Down

0 comments on commit 27bca4f

Please sign in to comment.