@@ -58,7 +58,7 @@ export class ConfigWriter {
5858 this . _copyWallpaper ( wallpaperPath ) ;
5959 }
6060
61- const variables = this . _buildVariables ( colorRoles ) ;
61+ const variables = this . _buildVariables ( colorRoles , lightMode ) ;
6262 this . _processTemplates ( variables , settings , appOverrides ) ;
6363 this . _applyAetherThemeOverride ( variables ) ;
6464
@@ -77,6 +77,11 @@ export class ConfigWriter {
7777 this . _copyZedTheme ( ) ;
7878 }
7979
80+ // Copy VSCode theme if enabled
81+ if ( settings . includeVscode === true ) {
82+ this . _copyVscodeTheme ( variables ) ;
83+ }
84+
8085 this . _handleLightModeMarker ( this . themeDir , lightMode ) ;
8186 this . _applyOmarchyTheme ( ) ;
8287
@@ -107,14 +112,17 @@ export class ConfigWriter {
107112 return destPath ;
108113 }
109114
110- _buildVariables ( colorRoles ) {
115+ _buildVariables ( colorRoles , lightMode = false ) {
111116 const variables = { } ;
112117
113118 // Use default colors as fallback
114119 Object . keys ( DEFAULT_COLORS ) . forEach ( key => {
115120 variables [ key ] = colorRoles [ key ] || DEFAULT_COLORS [ key ] ;
116121 } ) ;
117122
123+ // Add theme type for VSCode and other templates
124+ variables . theme_type = lightMode ? 'light' : 'dark' ;
125+
118126 return variables ;
119127 }
120128
@@ -156,6 +164,25 @@ export class ConfigWriter {
156164 fileName ,
157165 ] ) ;
158166
167+ // Handle vscode.empty.json - use when VSCode is disabled
168+ if ( fileName === 'vscode.empty.json' ) {
169+ if ( settings . includeVscode === false ) {
170+ // Write empty vscode.json when disabled
171+ const vscodeOutputPath = GLib . build_filenamev ( [
172+ this . themeDir ,
173+ 'vscode.json' ,
174+ ] ) ;
175+ this . _processTemplate (
176+ templatePath ,
177+ vscodeOutputPath ,
178+ variables ,
179+ 'vscode.empty.json' ,
180+ appOverrides
181+ ) ;
182+ }
183+ return ;
184+ }
185+
159186 // If this is neovim.lua and a custom config is selected, write it directly
160187 if (
161188 fileName === 'neovim.lua' &&
@@ -305,7 +332,7 @@ export class ConfigWriter {
305332 console . log ( `Copied wallpaper to: ${ destPath } ` ) ;
306333 }
307334
308- const variables = this . _buildVariables ( colorRoles ) ;
335+ const variables = this . _buildVariables ( colorRoles , lightMode ) ;
309336 this . _processTemplatesToDirectory (
310337 variables ,
311338 exportPath ,
@@ -362,6 +389,25 @@ export class ConfigWriter {
362389
363390 const outputPath = GLib . build_filenamev ( [ exportPath , fileName ] ) ;
364391
392+ // Handle vscode.empty.json - use when VSCode is disabled
393+ if ( fileName === 'vscode.empty.json' ) {
394+ if ( settings . includeVscode === false ) {
395+ // Write empty vscode.json when disabled
396+ const vscodeOutputPath = GLib . build_filenamev ( [
397+ exportPath ,
398+ 'vscode.json' ,
399+ ] ) ;
400+ this . _processTemplate (
401+ templatePath ,
402+ vscodeOutputPath ,
403+ variables ,
404+ 'vscode.empty.json' ,
405+ appOverrides
406+ ) ;
407+ }
408+ return ;
409+ }
410+
365411 // If this is neovim.lua and a custom config is selected, write it directly
366412 if (
367413 fileName === 'neovim.lua' &&
@@ -565,6 +611,66 @@ export class ConfigWriter {
565611 }
566612 }
567613
614+ _copyVscodeTheme ( variables ) {
615+ try {
616+ const homeDir = GLib . get_home_dir ( ) ;
617+ const vscodeExtensionPath = GLib . build_filenamev ( [
618+ homeDir ,
619+ '.vscode' ,
620+ 'extensions' ,
621+ 'theme-aether' ,
622+ ] ) ;
623+
624+ // Ensure the extension directory exists
625+ ensureDirectoryExists ( vscodeExtensionPath ) ;
626+
627+ // Process the entire vscode-extension folder from templates
628+ const vscodeTemplateDir = GLib . build_filenamev ( [
629+ this . templatesDir ,
630+ 'vscode-extension' ,
631+ ] ) ;
632+
633+ // Copy and process all files from vscode-extension template
634+ this . _copyVscodeExtensionDirectory (
635+ vscodeTemplateDir ,
636+ vscodeExtensionPath ,
637+ variables
638+ ) ;
639+
640+ console . log (
641+ `Installed VSCode extension to: ${ vscodeExtensionPath } `
642+ ) ;
643+ } catch ( e ) {
644+ console . error ( 'Error copying VSCode theme:' , e . message ) ;
645+ }
646+ }
647+
648+ _copyVscodeExtensionDirectory ( sourceDir , destDir , variables ) {
649+ enumerateDirectory ( sourceDir , ( fileInfo , filePath , fileName ) => {
650+ const fileType = fileInfo . get_file_type ( ) ;
651+
652+ if ( fileType === Gio . FileType . DIRECTORY ) {
653+ // Recursively process subdirectories
654+ const subSourceDir = GLib . build_filenamev ( [
655+ sourceDir ,
656+ fileName ,
657+ ] ) ;
658+ const subDestDir = GLib . build_filenamev ( [ destDir , fileName ] ) ;
659+ ensureDirectoryExists ( subDestDir ) ;
660+ this . _copyVscodeExtensionDirectory (
661+ subSourceDir ,
662+ subDestDir ,
663+ variables
664+ ) ;
665+ } else if ( fileType === Gio . FileType . REGULAR ) {
666+ // Process and copy file
667+ const destPath = GLib . build_filenamev ( [ destDir , fileName ] ) ;
668+ this . _processTemplate ( filePath , destPath , variables , fileName ) ;
669+ console . log ( `Processed VSCode extension file: ${ fileName } ` ) ;
670+ }
671+ } ) ;
672+ }
673+
568674 _copyGtkFile ( sourcePath , destPath , label ) {
569675 try {
570676 // Remove existing file if it exists
0 commit comments