Add linux freedesktop category argument

This commit is contained in:
Caelan Sayler
2024-03-29 11:17:34 +00:00
parent 4b45bcf5a7
commit 07b59d6468
5 changed files with 16 additions and 1 deletions

View File

@@ -88,6 +88,8 @@ public class PackTask : MSBuildAsyncTask
public string? SignTemplate { get; set; }
public string? Categories { get; set; }
protected override async Task<bool> ExecuteAsync()
{
//System.Diagnostics.Debugger.Launch();

View File

@@ -94,6 +94,7 @@
SignSkipDll="$(VelopackSignSkipDll)"
SignParallel="$(VelopackSignParallel)"
SignTemplate="$(VelopackSignTemplate)"
Categories="$(VelopackCategories)"
/>
</Target>

View File

@@ -32,6 +32,9 @@ public class LinuxPackCommandRunner : PackageBuilder<LinuxPackOptions>
var iconFilename = Options.PackId + Path.GetExtension(icon);
File.Copy(icon, Path.Combine(dir.FullName, iconFilename), true);
var categories = String.IsNullOrWhiteSpace(Options.Categories) ? "" :
$"Categories={Options.Categories.TrimEnd(';')};";
File.WriteAllText(appRunPath, $$"""
#!/bin/sh
@@ -66,7 +69,7 @@ Comment={Options.PackTitle ?? Options.PackId} {Options.PackVersion}
Icon={Options.PackId}
Exec={mainExeName}
StartupWMClass={Options.PackId}
Categories=Development;
{categories}
""");
// copy existing app files

View File

@@ -35,4 +35,6 @@ public class LinuxPackOptions : IPackOptions
public bool NoPortable { get; set; }
public bool NoInst { get; set; }
public string Categories { get; set; }
}

View File

@@ -4,12 +4,18 @@ public class LinuxPackCommand : PackCommand
{
public bool PackIsAppDir { get; private set; }
public string Categories { get; private set; }
public LinuxPackCommand()
: base("pack", "Create's a Linux .AppImage bundle from a folder containing application files.")
{
this.RemoveOption(NoPortableOption);
this.RemoveOption(NoInstOption);
var categories = AddOption<string>((v) => Categories = v, "--categories")
.SetDescription("Categories from the freedesktop.org Desktop Menu spec")
.SetArgumentHelpName("NAMES");
var appDir = AddOption<DirectoryInfo>((v) => {
var t = v.ToFullNameOrNull();
if (t != null) {
@@ -24,5 +30,6 @@ public class LinuxPackCommand : PackCommand
this.AtLeastOneRequired(PackDirectoryOption, appDir);
this.AreMutuallyExclusive(PackDirectoryOption, appDir);
this.AreMutuallyExclusive(IconOption, appDir);
this.AreMutuallyExclusive(categories, appDir);
}
}