Skip to content

Commit 2c67aa6

Browse files
authored
Merge pull request #940 from Flow-Launcher/dev
Release 1.9.1 | Plugin 2.1.1
2 parents 54e6907 + f6d8d3e commit 2c67aa6

File tree

73 files changed

+851
-648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+851
-648
lines changed

Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static Task UpdateManifestAsync()
3131
return UpdateTask = DownloadManifestAsync();
3232
}
3333

34-
private async static Task DownloadManifestAsync()
34+
private static async Task DownloadManifestAsync()
3535
{
3636
try
3737
{

Flow.Launcher.Core/Plugin/ExecutablePlugin.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Diagnostics;
1+
using System.Diagnostics;
32
using System.IO;
43
using System.Threading;
54
using System.Threading.Tasks;
@@ -22,18 +21,23 @@ public ExecutablePlugin(string filename)
2221
RedirectStandardOutput = true,
2322
RedirectStandardError = true
2423
};
24+
25+
// required initialisation for below request calls
26+
_startInfo.ArgumentList.Add(string.Empty);
2527
}
2628

2729
protected override Task<Stream> RequestAsync(JsonRPCRequestModel request, CancellationToken token = default)
2830
{
29-
_startInfo.Arguments = $"\"{request}\"";
31+
// since this is not static, request strings will build up in ArgumentList if index is not specified
32+
_startInfo.ArgumentList[0] = request.ToString();
3033
return ExecuteAsync(_startInfo, token);
3134
}
3235

3336
protected override string Request(JsonRPCRequestModel rpcRequest, CancellationToken token = default)
3437
{
35-
_startInfo.Arguments = $"\"{rpcRequest}\"";
38+
// since this is not static, request strings will build up in ArgumentList if index is not specified
39+
_startInfo.ArgumentList[0] = rpcRequest.ToString();
3640
return Execute(_startInfo);
3741
}
3842
}
39-
}
43+
}

Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ public virtual async Task InitAsync(PluginInitContext context)
354354
this.context = context;
355355
await InitSettingAsync();
356356
}
357-
private static readonly Thickness settingControlMargin = new(10);
357+
private static readonly Thickness settingControlMargin = new(10, 4, 10, 4);
358+
private static readonly Thickness settingPanelMargin = new(15, 20, 15, 20);
359+
private static readonly Thickness settingTextBlockMargin = new(10, 4, 10, 4);
358360
private JsonRpcConfigurationModel _settingsTemplate;
359361
public Control CreateSettingPanel()
360362
{
@@ -363,7 +365,7 @@ public Control CreateSettingPanel()
363365
var settingWindow = new UserControl();
364366
var mainPanel = new StackPanel
365367
{
366-
Margin = settingControlMargin,
368+
Margin = settingPanelMargin,
367369
Orientation = Orientation.Vertical
368370
};
369371
settingWindow.Content = mainPanel;
@@ -375,10 +377,13 @@ public Control CreateSettingPanel()
375377
Orientation = Orientation.Horizontal,
376378
Margin = settingControlMargin
377379
};
378-
var name = new Label()
380+
var name = new TextBlock()
379381
{
380-
Content = attribute.Label,
381-
Margin = settingControlMargin
382+
Text = attribute.Label,
383+
Width = 120,
384+
VerticalAlignment = VerticalAlignment.Center,
385+
Margin = settingControlMargin,
386+
TextWrapping = TextWrapping.WrapWithOverflow
382387
};
383388

384389
FrameworkElement contentControl;
@@ -390,8 +395,8 @@ public Control CreateSettingPanel()
390395
contentControl = new TextBlock
391396
{
392397
Text = attribute.Description.Replace("\\r\\n", "\r\n"),
393-
Margin = settingControlMargin,
394-
MaxWidth = 400,
398+
Margin = settingTextBlockMargin,
399+
MaxWidth = 500,
395400
TextWrapping = TextWrapping.WrapWithOverflow
396401
};
397402
break;

Flow.Launcher.Core/Updater.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true)
9191
catch (Exception e) when (e is HttpRequestException or WebException or SocketException || e.InnerException is TimeoutException)
9292
{
9393
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
94-
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
95-
api.GetTranslation("update_flowlauncher_check_connection"));
94+
if (!silentUpdate)
95+
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
96+
api.GetTranslation("update_flowlauncher_check_connection"));
9697
}
9798
finally
9899
{
@@ -124,7 +125,7 @@ private async Task<UpdateManager> GitHubUpdateManager(string repository)
124125
var releases = await System.Text.Json.JsonSerializer.DeserializeAsync<List<GithubRelease>>(jsonStream).ConfigureAwait(false);
125126
var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First();
126127
var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/");
127-
128+
128129
var client = new WebClient
129130
{
130131
Proxy = Http.WebProxy

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net5.0-windows</TargetFramework>
@@ -14,10 +14,10 @@
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
17-
<Version>2.1.0</Version>
18-
<PackageVersion>2.1.0</PackageVersion>
19-
<AssemblyVersion>2.1.0</AssemblyVersion>
20-
<FileVersion>2.1.0</FileVersion>
17+
<Version>2.1.1</Version>
18+
<PackageVersion>2.1.1</PackageVersion>
19+
<AssemblyVersion>2.1.1</AssemblyVersion>
20+
<FileVersion>2.1.1</FileVersion>
2121
<PackageId>Flow.Launcher.Plugin</PackageId>
2222
<Authors>Flow-Launcher</Authors>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -42,6 +42,7 @@
4242
<WarningLevel>4</WarningLevel>
4343
<PlatformTarget>AnyCPU</PlatformTarget>
4444
<Prefer32Bit>false</Prefer32Bit>
45+
<DocumentationFile>..\Output\Debug\Flow.Launcher.Plugin.xml</DocumentationFile>
4546
</PropertyGroup>
4647

4748
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

Flow.Launcher.Plugin/GlyphInfo.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@
77

88
namespace Flow.Launcher.Plugin
99
{
10+
/// <summary>
11+
/// Text with FontFamily specified
12+
/// </summary>
13+
/// <param name="FontFamily">Font Family of this Glyph</param>
14+
/// <param name="Glyph">Text/Unicode of the Glyph</param>
1015
public record GlyphInfo(string FontFamily, string Glyph);
1116
}

Flow.Launcher.Plugin/Result.cs

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Windows.Media;
@@ -10,11 +10,11 @@ public class Result
1010
{
1111

1212
private string _pluginDirectory;
13-
13+
1414
private string _icoPath;
1515

1616
/// <summary>
17-
/// Provides the title of the result. This is always required.
17+
/// The title of the result. This is always required.
1818
/// </summary>
1919
public string Title { get; set; }
2020

@@ -36,6 +36,11 @@ public class Result
3636
/// </summary>
3737
public string AutoCompleteText { get; set; }
3838

39+
/// <summary>
40+
/// Image Displayed on the result
41+
/// <value>Relative Path to the Image File</value>
42+
/// <remarks>GlyphInfo is prioritized if not null</remarks>
43+
/// </summary>
3944
public string IcoPath
4045
{
4146
get { return _icoPath; }
@@ -60,30 +65,35 @@ public string IcoPath
6065
public IconDelegate Icon;
6166

6267
/// <summary>
63-
/// Information for Glyph Icon
68+
/// Information for Glyph Icon (Prioritized than IcoPath/Icon if user enable Glyph Icons)
6469
/// </summary>
65-
public GlyphInfo Glyph { get; init; }
70+
public GlyphInfo Glyph { get; init; }
6671

6772

6873
/// <summary>
69-
/// return true to hide flowlauncher after select result
74+
/// Delegate. An action to take in the form of a function call when the result has been selected
75+
/// <returns>
76+
/// true to hide flowlauncher after select result
77+
/// </returns>
7078
/// </summary>
7179
public Func<ActionContext, bool> Action { get; set; }
7280

81+
/// <summary>
82+
/// Priority of the current result
83+
/// <value>default: 0</value>
84+
/// </summary>
7385
public int Score { get; set; }
7486

7587
/// <summary>
7688
/// A list of indexes for the characters to be highlighted in Title
7789
/// </summary>
7890
public IList<int> TitleHighlightData { get; set; }
7991

80-
/// <summary>
81-
/// A list of indexes for the characters to be highlighted in SubTitle
82-
/// </summary>
92+
[Obsolete("Deprecated as of Flow Launcher v1.9.1. Subtitle highlighting is no longer offered")]
8393
public IList<int> SubTitleHighlightData { get; set; }
8494

8595
/// <summary>
86-
/// Only results that originQuery match with current query will be displayed in the panel
96+
/// Query information associated with the result
8797
/// </summary>
8898
internal Query OriginQuery { get; set; }
8999

@@ -103,35 +113,38 @@ public string PluginDirectory
103113
}
104114
}
105115

116+
/// <inheritdoc />
106117
public override bool Equals(object obj)
107118
{
108119
var r = obj as Result;
109120

110121
var equality = string.Equals(r?.Title, Title) &&
111122
string.Equals(r?.SubTitle, SubTitle) &&
112123
string.Equals(r?.IcoPath, IcoPath) &&
113-
TitleHighlightData == r.TitleHighlightData &&
114-
SubTitleHighlightData == r.SubTitleHighlightData;
124+
TitleHighlightData == r.TitleHighlightData;
115125

116126
return equality;
117127
}
118128

129+
/// <inheritdoc />
119130
public override int GetHashCode()
120131
{
121132
var hashcode = (Title?.GetHashCode() ?? 0) ^
122133
(SubTitle?.GetHashCode() ?? 0);
123134
return hashcode;
124135
}
125136

137+
/// <inheritdoc />
126138
public override string ToString()
127139
{
128140
return Title + SubTitle;
129141
}
130142

131-
public Result() { }
132-
133143
/// <summary>
134-
/// Additional data associate with this result
144+
/// Additional data associated with this result
145+
/// <example>
146+
/// As external information for ContextMenu
147+
/// </example>
135148
/// </summary>
136149
public object ContextData { get; set; }
137150

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
6969
PluginManager.LoadPlugins(_settings.PluginSettings);
7070
_mainVM = new MainViewModel(_settings);
7171

72-
HotKeyMapper.Initialize(_mainVM);
73-
7472
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
7573

7674
Http.API = API;
@@ -83,6 +81,8 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
8381

8482
Current.MainWindow = window;
8583
Current.MainWindow.Title = Constant.FlowLauncher;
84+
85+
HotKeyMapper.Initialize(_mainVM);
8686

8787
// happlebao todo temp fix for instance code logic
8888
// load plugin before change language, because plugin language also needs be changed

Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
5353
// Check if Text will be larger then our QueryTextBox
5454
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
5555
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
56-
if (ft.Width > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
56+
57+
var offset = QueryTextBox.Padding.Right;
58+
59+
if ((ft.Width + offset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
5760
{
5861
return string.Empty;
5962
};

0 commit comments

Comments
 (0)