Conditional keyboard shortcuts? Similar to when-clause contexts in VS Code

VS Code has contexts:

Visual Studio Code sets various context keys and specific values depending on what elements are visible and active in the VS Code UI. These contexts can be used to selectively enable or disable extension commands and UI elements, such as menus and views.

These contexts can be used by extension creators or end-users.

Personally I use them to create keyboard shortcuts, here are two examples:

    "key": "ctrl+shift+alt+cmd+t",
    "command": "",
    "when": "!terminalIsOpen"

The contexts can also be combined:

    "key": "ctrl+down",
    "command": "search.action.focusSearchList",
    "when": "hasSearchResult && searchViewletFocus"

I think this is a very useful feature to create powerful keyboard shortcuts that are focused.

I dove a bit further into the topic of keyboard shortcuts in Obsidian and it seems like it doesn’t currently expose any keybindings.json or similar file for keyboard shortcuts. Probably that feature would need to be built first.