diff --git a/README.md b/README.md index c8117d6..a50d8fd 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,17 @@ For the extension to work, the only thing you need to do is to set in your VSCod { "time": "13:03", "theme": "Material Theme", + "iconTheme": "catppuccin-latte", }, { "time": "12:04", "theme": "Monokai", + "iconTheme": "catppuccin-mocha", }, { "time": "00:53", "theme": "Default Dark+", + "iconTheme": "catppuccin-mocha", }, ... ], diff --git a/src/ConfigurationManager.ts b/src/ConfigurationManager.ts index dc65c1f..6c18eed 100644 --- a/src/ConfigurationManager.ts +++ b/src/ConfigurationManager.ts @@ -1,6 +1,7 @@ import * as code from "vscode"; export interface MappingData { + iconTheme?: string, theme: string; time: string; } @@ -12,6 +13,18 @@ export default class ConfigurationManager { .get("mappings"); } + /** + * Sets the global workbench iconTheme setting + * @param iconTheme To be switched to + */ + static async switchIconTheme(iconTheme: string): Promise { + const config = code.workspace.getConfiguration("workbench"); + + if (config.get("iconTheme") !== iconTheme) { + await config.update("iconTheme", iconTheme, code.ConfigurationTarget.Global); + } + } + /** * Sets the global workbench colorTheme setting * @param theme To be switched to diff --git a/src/ThemeScheduler.ts b/src/ThemeScheduler.ts index b76c54b..e0cb659 100644 --- a/src/ThemeScheduler.ts +++ b/src/ThemeScheduler.ts @@ -72,13 +72,16 @@ export default class ThemeScheduler { * @param originTask Task which originated this task */ private async execScheduled( - { theme, time }: MappingData, + { iconTheme, theme, time }: MappingData, originTask: NodeJS.Timeout ): Promise { + if (iconTheme !== undefined) { + await ConfigurationManager.switchIconTheme(iconTheme); + } await ConfigurationManager.switchTheme(theme); this.pendingTasks = this.pendingTasks.filter((t) => t !== originTask); - this.schedule({ theme, time }, ThemeScheduler.dayMs); + this.schedule({ iconTheme, theme, time }, ThemeScheduler.dayMs); } /**