Skip to content

Cannot disable a shortcut and enable another one with the same key binding. #217

@gsabran

Description

@gsabran

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions