Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support args for workbench.action.selectTheme #100861

Closed
wants to merge 1 commit into from

Conversation

yume-chan
Copy link
Contributor

Fixes #100460

This PR adds optional args support for the workbench.action.selectTheme command, allowing users to define keybindings that directly switch to a specified theme (instead of opening the theme picker).

Such a keybinding can only be defined by directly editing keybindings.json because there is no GUI support for args.

Some examples:

[
    {
        "key": "ctrl+t ctrl+l",
        "command": "workbench.action.selectTheme",
        "args": {
            "id": "Default Light+"
        }
    },
    {
        "key": "ctrl+t ctrl+d",
        "command": "workbench.action.selectTheme",
        "args": {
            "id": "Default Dark+"
        }
    }
]

Values of the id field should match the "workbench.colorTheme" setting in settings.json. However theme's ids are not exposed anywhere in GUI, so users can only get them by switching to the desired theme, then copying from the "workbench.colorTheme" setting (or checking package.json of the theme extension).

A keybinding without args or args.id will continue opening the theme picker, without breaking existing use cases. A keybinding with invalid args.id will show an error when invoked.


A side effect is that now the command palette may display one of the keybindings containing args as Preferences: Color Theme command's shortcut (despite that invoking from command palette will always open the theme picker, while the displayed shortcut will directly switch to some theme). I have filed #100830 for it. But since that issue is categorized into "Backlog Candidates", I assume it's low priority and won't block this PR.

@joaomoreno joaomoreno changed the base branch from master to main February 15, 2021 08:51
@yume-chan yume-chan closed this Oct 1, 2021
@yume-chan yume-chan deleted the master branch October 1, 2021 00:56
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[themes] Add command to switch to a specific theme.
3 participants