Skip to content

Commit 3c00c9d

Browse files
Resolve rebase conflicts and fix models.ts structure
1 parent 48ec485 commit 3c00c9d

4 files changed

Lines changed: 6 additions & 89 deletions

File tree

app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func (a *App) SaveAndApplyTheme(req SaveAndApplyThemeRequest) (*theme.ApplyResul
407407
} else if !os.IsNotExist(err) {
408408
return nil, fmt.Errorf("check theme folder: %w", err)
409409
}
410-
wallpaperDest, err := a.writer.GenerateOmarchyV4Only(state, targetDir)
410+
wallpaperDest, err := a.writer.GenerateOmarchyV4Only(state, req.Settings, targetDir)
411411
if err != nil {
412412
return nil, fmt.Errorf("save theme: %w", err)
413413
}

frontend/wailsjs/go/models.ts

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ export namespace theme {
499499
includeVscode: boolean;
500500
includeNeovim: boolean;
501501
selectedNeovimConfig: string;
502+
includedApps?: Record<string, boolean>;
502503
excludedApps?: Record<string, boolean>;
503504

504505
static createFrom(source: any = {}) {
@@ -511,6 +512,7 @@ export namespace theme {
511512
this.includeVscode = source["includeVscode"];
512513
this.includeNeovim = source["includeNeovim"];
513514
this.selectedNeovimConfig = source["selectedNeovimConfig"];
515+
this.includedApps = source["includedApps"];
514516
this.excludedApps = source["excludedApps"];
515517
}
516518
}
@@ -560,91 +562,6 @@ export namespace theme {
560562
return a;
561563
}
562564
}
563-
564-
static createFrom(source: any = {}) {
565-
return new ApplyResult(source);
566-
}
567-
568-
constructor(source: any = {}) {
569-
if ('string' === typeof source) source = JSON.parse(source);
570-
this.success = source['success'];
571-
this.isOmarchy = source['isOmarchy'];
572-
this.themePath = source['themePath'];
573-
}
574-
}
575-
export class Settings {
576-
includeZed: boolean;
577-
includeVscode: boolean;
578-
includeNeovim: boolean;
579-
selectedNeovimConfig: string;
580-
includedApps?: Record<string, boolean>;
581-
excludedApps?: Record<string, boolean>;
582-
583-
static createFrom(source: any = {}) {
584-
return new Settings(source);
585-
}
586-
587-
constructor(source: any = {}) {
588-
if ('string' === typeof source) source = JSON.parse(source);
589-
this.includeZed = source['includeZed'];
590-
this.includeVscode = source['includeVscode'];
591-
this.includeNeovim = source['includeNeovim'];
592-
this.selectedNeovimConfig = source['selectedNeovimConfig'];
593-
this.includedApps = source['includedApps'];
594-
this.excludedApps = source['excludedApps'];
595-
}
596-
}
597-
export class StateSnapshot {
598-
palette: string[];
599-
wallpaperPath: string;
600-
lightMode: boolean;
601-
lockedColors: Record<number, boolean>;
602-
colorRoles: template.ColorRoles;
603-
extendedColors: Record<string, string>;
604-
extractionMode: string;
605-
additionalImages: string[];
606-
appOverrides: Record<string, any>;
607-
608-
static createFrom(source: any = {}) {
609-
return new StateSnapshot(source);
610-
}
611-
612-
constructor(source: any = {}) {
613-
if ('string' === typeof source) source = JSON.parse(source);
614-
this.palette = source['palette'];
615-
this.wallpaperPath = source['wallpaperPath'];
616-
this.lightMode = source['lightMode'];
617-
this.lockedColors = source['lockedColors'];
618-
this.colorRoles = this.convertValues(
619-
source['colorRoles'],
620-
template.ColorRoles
621-
);
622-
this.extendedColors = source['extendedColors'];
623-
this.extractionMode = source['extractionMode'];
624-
this.additionalImages = source['additionalImages'];
625-
this.appOverrides = source['appOverrides'];
626-
}
627-
628-
convertValues(a: any, classs: any, asMap: boolean = false): any {
629-
if (!a) {
630-
return a;
631-
}
632-
if (a.slice && a.map) {
633-
return (a as any[]).map(elem =>
634-
this.convertValues(elem, classs)
635-
);
636-
} else if ('object' === typeof a) {
637-
if (asMap) {
638-
for (const key of Object.keys(a)) {
639-
a[key] = new classs(a[key]);
640-
}
641-
return a;
642-
}
643-
return new classs(a);
644-
}
645-
return a;
646-
}
647-
}
648565
}
649566

650567
export namespace wallhaven {

internal/theme/writer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (w *Writer) processOmarchyV4Templates(
262262
// GenerateOmarchyV4Only writes the files Omarchy v4 reads directly from a
263263
// reusable theme folder. Omarchy generates all other app-specific files.
264264
// Returns the wallpaper destination path ("" when no wallpaper was set).
265-
func (w *Writer) GenerateOmarchyV4Only(state *ThemeState, outputPath string) (string, error) {
265+
func (w *Writer) GenerateOmarchyV4Only(state *ThemeState, settings Settings, outputPath string) (string, error) {
266266
variables := template.BuildVariables(state.ColorRoles, state.LightMode, state.ExtendedColors)
267267
if err := validateTemplateInputs(variables, state.AppOverrides); err != nil {
268268
return "", err
@@ -271,7 +271,7 @@ func (w *Writer) GenerateOmarchyV4Only(state *ThemeState, outputPath string) (st
271271
if err != nil {
272272
return "", err
273273
}
274-
w.processOmarchyV4Templates(outputPath, variables, state.AppOverrides, state.ExtendedColors)
274+
w.processOmarchyV4Templates(outputPath, variables, settings, state.AppOverrides, state.ExtendedColors)
275275
return wallpaperDest, nil
276276
}
277277

internal/theme/writer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func TestGenerateOmarchyV4OnlyRemovesLegacyFiles(t *testing.T) {
308308
state := NewThemeState()
309309
state.ColorRoles.Background = "#1e1e2e"
310310
state.ColorRoles.Magenta = "#ff0000"
311-
if _, err := writer.GenerateOmarchyV4Only(state, themeDir); err != nil {
311+
if _, err := writer.GenerateOmarchyV4Only(state, Settings{IncludedApps: map[string]bool{"icons": true}}, themeDir); err != nil {
312312
t.Fatal(err)
313313
}
314314

0 commit comments

Comments
 (0)