diff --git a/core/internal/distros/arch.go b/core/internal/distros/arch.go index f79e2b906..32ceffcfe 100644 --- a/core/internal/distros/arch.go +++ b/core/internal/distros/arch.go @@ -135,12 +135,7 @@ func (a *ArchDistribution) detectDanksearch() deps.Dependency { } func (a *ArchDistribution) detectDankCalendar() deps.Dependency { - dep := a.BaseDistribution.detectDankCalendar() - dep.CanToggle = true - if a.packageInstalled("dankcalendar-git") { - dep.Variant = deps.VariantGit - } - return dep + return a.detectDankCalendarVariant(a.packageInstalled("dankcalendar-git")) } func (a *ArchDistribution) detectXDGPortal() deps.Dependency { diff --git a/core/internal/distros/base.go b/core/internal/distros/base.go index 8f75df1f3..72b9600bd 100644 --- a/core/internal/distros/base.go +++ b/core/internal/distros/base.go @@ -113,6 +113,22 @@ func (b *BaseDistribution) detectDankCalendar() deps.Dependency { return b.detectOptionalPackage("dankcalendar", "Calendar application", b.commandExists("dcal") || b.commandExists("dankcalendar")) } +func (b *BaseDistribution) detectDankCalendarVariant(gitInstalled bool) deps.Dependency { + dep := b.detectDankCalendar() + dep.CanToggle = true + if gitInstalled { + dep.Variant = deps.VariantGit + } + return dep +} + +func dankCalendarMapping(variant deps.PackageVariant, repo RepositoryType, repoURL string) PackageMapping { + if variant == deps.VariantGit { + return PackageMapping{Name: "dankcalendar-git", Repository: repo, RepoURL: repoURL} + } + return PackageMapping{Name: "dankcalendar", Repository: repo, RepoURL: repoURL} +} + func (b *BaseDistribution) detectDMS() deps.Dependency { dmsPath := filepath.Join(os.Getenv("HOME"), ".config/quickshell/dms") diff --git a/core/internal/distros/debian.go b/core/internal/distros/debian.go index d790e840e..6b8590bb7 100644 --- a/core/internal/distros/debian.go +++ b/core/internal/distros/debian.go @@ -72,7 +72,7 @@ func (d *DebianDistribution) DetectDependenciesWithTerminal(ctx context.Context, dependencies = append(dependencies, d.detectMatugen()) dependencies = append(dependencies, d.detectDanksearch()) - dependencies = append(dependencies, d.detectDankCalendar()) + dependencies = append(dependencies, d.detectDankCalendarVariant(d.packageInstalled("dankcalendar-git"))) return dependencies, nil } @@ -137,7 +137,7 @@ func (d *DebianDistribution) GetPackageMappingWithVariants(wm deps.WindowManager "matugen": {Name: "matugen", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, "ghostty": {Name: "ghostty", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, "danksearch": {Name: "danksearch", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, - "dankcalendar": {Name: "dankcalendar-git", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, + "dankcalendar": dankCalendarMapping(variants["dankcalendar"], RepoTypeOBS, "home:AvengeMedia:danklinux"), } if wm == deps.WindowManagerNiri { diff --git a/core/internal/distros/fedora.go b/core/internal/distros/fedora.go index fe4f1f39d..e258bad20 100644 --- a/core/internal/distros/fedora.go +++ b/core/internal/distros/fedora.go @@ -128,7 +128,7 @@ func (f *FedoraDistribution) DetectDependenciesWithTerminal(ctx context.Context, dependencies = append(dependencies, f.detectMatugen()) dependencies = append(dependencies, f.detectDanksearch()) - dependencies = append(dependencies, f.detectDankCalendar()) + dependencies = append(dependencies, f.detectDankCalendarVariant(f.packageInstalled("dankcalendar-git"))) return dependencies, nil } @@ -163,7 +163,7 @@ func (f *FedoraDistribution) GetPackageMappingWithVariants(wm deps.WindowManager "matugen": {Name: "matugen", Repository: RepoTypeCOPR, RepoURL: "avengemedia/danklinux"}, "dms (DankMaterialShell)": f.getDmsMapping(variants["dms (DankMaterialShell)"]), "danksearch": {Name: "danksearch", Repository: RepoTypeCOPR, RepoURL: "avengemedia/danklinux"}, - "dankcalendar": {Name: "dankcalendar-git", Repository: RepoTypeCOPR, RepoURL: "avengemedia/danklinux"}, + "dankcalendar": dankCalendarMapping(variants["dankcalendar"], RepoTypeCOPR, "avengemedia/danklinux"), } switch wm { diff --git a/core/internal/distros/opensuse.go b/core/internal/distros/opensuse.go index 3c90b4ec3..5bfc7dc66 100644 --- a/core/internal/distros/opensuse.go +++ b/core/internal/distros/opensuse.go @@ -92,7 +92,7 @@ func (o *OpenSUSEDistribution) DetectDependenciesWithTerminal(ctx context.Contex dependencies = append(dependencies, o.detectMatugen()) dependencies = append(dependencies, o.detectDanksearch()) - dependencies = append(dependencies, o.detectDankCalendar()) + dependencies = append(dependencies, o.detectDankCalendarVariant(o.packageInstalled("dankcalendar-git"))) return dependencies, nil } @@ -131,7 +131,7 @@ func (o *OpenSUSEDistribution) GetPackageMappingWithVariants(wm deps.WindowManag "ghostty": {Name: "ghostty", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, "matugen": {Name: "matugen", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, "danksearch": {Name: "danksearch", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, - "dankcalendar": {Name: "dankcalendar-git", Repository: RepoTypeOBS, RepoURL: "home:AvengeMedia:danklinux"}, + "dankcalendar": dankCalendarMapping(variants["dankcalendar"], RepoTypeOBS, "home:AvengeMedia:danklinux"), } switch wm { diff --git a/core/internal/distros/ubuntu.go b/core/internal/distros/ubuntu.go index fa9a1cf68..b9bd0f7ec 100644 --- a/core/internal/distros/ubuntu.go +++ b/core/internal/distros/ubuntu.go @@ -81,7 +81,7 @@ func (u *UbuntuDistribution) DetectDependenciesWithTerminal(ctx context.Context, dependencies = append(dependencies, u.detectMatugen()) dependencies = append(dependencies, u.detectDanksearch()) - dependencies = append(dependencies, u.detectDankCalendar()) + dependencies = append(dependencies, u.detectDankCalendarVariant(u.packageInstalled("dankcalendar-git"))) return dependencies, nil } @@ -126,7 +126,7 @@ func (u *UbuntuDistribution) GetPackageMappingWithVariants(wm deps.WindowManager "matugen": {Name: "matugen", Repository: RepoTypePPA, RepoURL: "ppa:avengemedia/danklinux"}, "ghostty": {Name: "ghostty", Repository: RepoTypePPA, RepoURL: "ppa:avengemedia/danklinux"}, "danksearch": {Name: "danksearch", Repository: RepoTypePPA, RepoURL: "ppa:avengemedia/danklinux"}, - "dankcalendar": {Name: "dankcalendar-git", Repository: RepoTypePPA, RepoURL: "ppa:avengemedia/danklinux"}, + "dankcalendar": dankCalendarMapping(variants["dankcalendar"], RepoTypePPA, "ppa:avengemedia/danklinux"), } switch wm {