vscode: support arbitrary profiles (#914)
vscode: support arbitrary profiles The VSCode theme is no longer only applied to any profiles by default. Closes: https://github.com/danth/stylix/issues/908 Link: https://github.com/danth/stylix/pull/914 Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
1178051794
commit
4853879264
1 changed files with 24 additions and 7 deletions
|
|
@ -26,15 +26,23 @@ let
|
|||
ln -s ${themeFile} "$out/share/vscode/extensions/$vscodeExtUniqueId/themes/stylix.json"
|
||||
'';
|
||||
|
||||
cfg = config.stylix.targets.vscode;
|
||||
|
||||
in
|
||||
{
|
||||
options.stylix.targets.vscode.enable =
|
||||
config.lib.stylix.mkEnableTarget "VSCode" true;
|
||||
options.stylix.targets.vscode = {
|
||||
enable = config.lib.stylix.mkEnableTarget "VSCode" true;
|
||||
profileNames = lib.mkOption {
|
||||
description = "The VSCode profile names to apply styling on.";
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
lib.mkIf (config.stylix.enable && config.stylix.targets.vscode.enable)
|
||||
{
|
||||
programs.vscode.profiles.default = {
|
||||
config = lib.mkIf (config.stylix.enable && cfg.enable) {
|
||||
programs.vscode.profiles = lib.mkMerge (
|
||||
map (profileName: {
|
||||
${profileName} = {
|
||||
extensions = [ themeExtension ];
|
||||
userSettings = {
|
||||
"workbench.colorTheme" = "Stylix";
|
||||
|
|
@ -62,5 +70,14 @@ in
|
|||
"screencastMode.fontSize" = sizes.terminal * 4.0 / 3.0 * 56.0 / 14.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
}) cfg.profileNames
|
||||
);
|
||||
warnings =
|
||||
lib.optional
|
||||
(
|
||||
config.programs.vscode.enable
|
||||
&& config.stylix.targets.vscode.profileNames == [ ]
|
||||
)
|
||||
''stylix: vscode: `config.stylix.targets.vscode.profileNames` is not set. Declare profile names with 'config.stylix.targets.vscode.profileNames = [ "<PROFILE_NAME>" ];'.'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue