Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 7 additions & 21 deletions QuickShell.Core.Tests/RunGlobalQueryTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using QuickShell.Services;




namespace QuickShell.Core.Tests;




public sealed class RunGlobalQueryTests

{
Expand All @@ -29,9 +25,7 @@ public void TryActivate_PluginName_EntersBrowseMode(string query)
Assert.Equal(string.Empty, remaining);

}




[Fact]

public void TryActivate_PluginNameWithFilter_StripsPrefix()
Expand All @@ -43,9 +37,7 @@ public void TryActivate_PluginNameWithFilter_StripsPrefix()
Assert.Equal("api", remaining);

}




[Fact]

public void TryActivate_RawQueryFallback_ActivatesWhenSearchEmpty()
Expand All @@ -57,9 +49,7 @@ public void TryActivate_RawQueryFallback_ActivatesWhenSearchEmpty()
Assert.Equal(string.Empty, remaining);

}




[Fact]

public void TryActivate_UnrelatedQuery_DoesNotActivate()
Expand All @@ -71,9 +61,7 @@ public void TryActivate_UnrelatedQuery_DoesNotActivate()
Assert.Equal("my api project", remaining);

}




[Fact]

public void ShouldSuppressEmptyGlobalQuery_BlocksBareGlobalSearch()
Expand All @@ -85,9 +73,7 @@ public void ShouldSuppressEmptyGlobalQuery_BlocksBareGlobalSearch()
Assert.True(RunGlobalQuery.ShouldSuppressEmptyGlobalQuery(context));

}




[Fact]

public void ShouldSuppressEmptyGlobalQuery_AllowsActionKeywordBrowse()
Expand Down
3 changes: 1 addition & 2 deletions QuickShell.Core.Tests/WorkspaceTrustCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ private static (QuickShellServices Services, QuickShellLifetime Lifetime, Shortc
lifetime);
return (services, lifetime, drafts);
}



private static TerminalShortcut CreateWorkspace() =>
new()
{
Expand Down
64 changes: 16 additions & 48 deletions QuickShell.Core/Models/TerminalShortcut.cs
Original file line number Diff line number Diff line change
@@ -1,84 +1,52 @@
namespace QuickShell.Models;




internal sealed class TerminalShortcut

{

public string Id { get; set; } = string.Empty;




public string Name { get; set; } = string.Empty;




public string? Abbreviation { get; set; }




public string Directory { get; set; } = string.Empty;




public string? Command { get; set; }




// "default" means use extension-level default terminal setting.

public string Terminal { get; set; } = "default";




// Optional Windows Terminal profile name for terminal=wt/default->wt.

public string? WtProfile { get; set; }




public bool RunAsAdmin { get; set; }




public bool IsPinned { get; set; }




// Lower number means higher in the favorites section.

public int? PinOrder { get; set; }




public DateTime? LastUsedUtc { get; set; }




/// <summary>One or more terminal launches for this workspace. When empty on disk, synthesized from legacy fields on load.</summary>

public List<WorkspaceEntry> Launches { get; set; } = [];




/// <summary>Optional dev server URL opened in the browser when the workspace runs.</summary>
public string? DevServerUrl { get; set; }




/// <summary>When true, opens <see cref="DevServerUrl"/> whenever the full workspace runs.</summary>

public bool OpenDevServerOnLaunch { get; set; }




/// <summary>Optional repository URL opened from the workspace action menu.</summary>

public string? RepoUrl { get; set; }




/// <summary>
/// One or more GUI companion apps. When empty on disk, synthesized from the legacy
/// scalar companion fields on load (see <c>CompanionAppNormalization</c>).
Expand Down
68 changes: 17 additions & 51 deletions QuickShell.Core/Services/ShortcutLaunchFormJson.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using QuickShell.Core.Services;

namespace QuickShell.Services;




internal static partial class ShortcutLaunchFormJson

{
Expand All @@ -13,35 +11,23 @@ internal static partial class ShortcutLaunchFormJson
private const string ProfileColumnWidth = "2";

private const string AdminColumnWidth = "auto";




public sealed class LaunchRowDraft

{

public string Label { get; set; } = string.Empty;




public string Command { get; set; } = string.Empty;




public string LaunchTarget { get; set; } = "default";




public bool RunAsAdmin { get; set; }




public bool IsEnabled { get; set; } = true;

}




public static string BuildCommandRowsJson(
IReadOnlyList<QuickShell.Services.LaunchRowDraft> rows,
string terminalChoices,
Expand Down Expand Up @@ -124,9 +110,7 @@ public static string BuildCommandRowsJson(
return string.Join(',', blocks);

}




public static string BuildCommandsSectionHeaderJson(LaunchEditorText text) =>
$$"""
{
Expand Down Expand Up @@ -168,9 +152,7 @@ public static string BuildLaunchRowsJson(IReadOnlyList<LaunchRowDraft> launches,
return string.Empty;

}




var blocks = new List<string>();

for (var i = 0; i < launches.Count; i++)
Expand All @@ -188,9 +170,7 @@ public static string BuildLaunchRowsJson(IReadOnlyList<LaunchRowDraft> launches,
var adminValue = launch.RunAsAdmin ? "true" : "false";

var enabledValue = launch.IsEnabled ? "true" : "false";




var labelInput = $$"""

{
Expand All @@ -206,13 +186,9 @@ public static string BuildLaunchRowsJson(IReadOnlyList<LaunchRowDraft> launches,
}

""";




var commandInput = BuildCommandInputWithClear(i, literalValue: escapedCommand, removeTooltip: FormActionGlyphs.ClearCommandTooltip);




var adminInput = $$"""

{
Expand All @@ -232,9 +208,7 @@ public static string BuildLaunchRowsJson(IReadOnlyList<LaunchRowDraft> launches,
}

""";




var enabledInput = $$"""

{
Expand All @@ -254,9 +228,7 @@ public static string BuildLaunchRowsJson(IReadOnlyList<LaunchRowDraft> launches,
}

""";




blocks.Add($$"""

{
Expand Down Expand Up @@ -520,21 +492,15 @@ public static string BuildLaunchRowsJson(IReadOnlyList<LaunchRowDraft> launches,
""");

}




return string.Join(',', blocks);

}




public static string WrapLaunchRowsForTest(string launchRows) =>

$$"""{ "type": "AdaptiveCard", "version": "1.6", "body": [{{launchRows}}] }""";




private static string Escape(string? value) =>

(value ?? string.Empty).Replace("\\", "\\\\").Replace("\"", "\\\"");
Expand Down
6 changes: 2 additions & 4 deletions QuickShell.Core/Services/TerminalCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public TerminalCatalog(IWtProfilesService profiles)
{
_profiles = profiles ?? throw new ArgumentNullException(nameof(profiles));
}



string ITerminalCatalog.EncodeLaunchTargetId(TerminalShortcut shortcut) =>
EncodeLaunchTargetId(shortcut);

Expand All @@ -87,8 +86,7 @@ WorkspaceEntry ITerminalCatalog.ResolveLaunchEntry(
IReadOnlyList<WorkspaceEntry> orderedLaunches,
int index) =>
ResolveLaunchEntry(entry, orderedLaunches, index);



public IReadOnlyList<LaunchTarget> GetLaunchTargets(bool includeDefaultChoice = false)
{
var snapshot = EnsureCached();
Expand Down
Loading
Loading