Skip to content
Open
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
13 changes: 10 additions & 3 deletions Sources/KeyboardShortcuts/RecorderCocoa.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,21 @@
// TODO: Find a better way to make it possible to dismiss the alert by pressing "Enter". How can we make the input automatically temporarily lose focus while the alert is open?
blur()

NSAlert.showModal(
let modalResponse = NSAlert.showModal(
for: window,
title: String.localizedStringWithFormat("keyboard_shortcut_used_by_menu_item".localized, menuItem.title)
title: String.localizedStringWithFormat("keyboard_shortcut_used_by_menu_item".localized, menuItem.title),
buttonTitles: [
"ok".localized,
"force_use_shortcut".localized,

Check warning on line 284 in Sources/KeyboardShortcuts/RecorderCocoa.swift

View workflow job for this annotation

GitHub Actions / lint

Trailing Comma Violation: Collection literals should not have trailing commas (trailing_comma)
]
)

focus()

return nil
// If the user has selected "Use Anyway" in the dialog (the second option), we'll continue setting the keyboard shorcut even though it's reserved by a menu item.
guard modalResponse == .alertSecondButtonReturn else {
return nil
}
}

// See: https://developer.apple.com/forums/thread/763878?answerId=804374022#804374022
Expand Down