It is not possible to re-bind an already registered shortcut to a new one. Instead, both get called:
extension KeyboardShortcuts.Name {
static let newFile = Self("newFile", default: .init(.n, modifiers: [.command]))
static let newFolder = Self("newFolder", default: .init(.n, modifiers: [.command]))
}
func focusOnFiles() {
KeyboardShortcuts.disable(.newFolder)
KeyboardShortcuts.enable(.newFile)
}
func focusOnFolder() {
KeyboardShortcuts.disable(.newFile)
KeyboardShortcuts.enable(.newFolder)
}
I think this is because the KeyboardShortcuts.Name is internally converted to a Shortcut that doesn't know which Name it maps to.