Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8fdb9a9
add some space to the end of the scrollviewer
taooceros Jul 19, 2021
5fcef84
Merge pull request #579 from Flow-Launcher/setting_window_extra_space
jjw24 Jul 19, 2021
69d1d83
Update Slovak translation
kubalav Jul 20, 2021
72be2bc
Merge pull request #583 from kubalav/translation-sk
jjw24 Jul 20, 2021
edff774
add WinGet update CD
jjw24 Jul 21, 2021
5a55273
run on master branch only
jjw24 Jul 21, 2021
d71d188
reduce magnifying glass icon size
jjw24 Jul 22, 2021
19aa45d
Merge pull request #582 from Flow-Launcher/ci_winget_update
jjw24 Jul 22, 2021
421ca33
fix logic
taooceros Jul 24, 2021
3a8cd8c
save setting after startup (#594)
taooceros Jul 24, 2021
6ed83aa
add portable release
jjw24 Jul 24, 2021
be7179d
use AppVeyor environment variable
jjw24 Jul 24, 2021
cc09f33
change portable release with out appending the version
jjw24 Jul 24, 2021
462ba21
Merge pull request #595 from Flow-Launcher/fixAnimationAfterTogger
jjw24 Jul 24, 2021
387c550
Merge pull request #590 from Flow-Launcher/reduce_magnifying_icon
jjw24 Jul 24, 2021
44d8666
add warning for Windows Search service not turned on
jjw24 Jul 25, 2021
86fe664
add option to remove warning msg and install Everything plugin
jjw24 Jul 25, 2021
8df4bb2
version bump for Explorer plugin
jjw24 Jul 25, 2021
10a30f4
move exception result into its own method
jjw24 Jul 25, 2021
0f9fd94
handle future scenario where PluginsManager's action keyword increased
jjw24 Jul 25, 2021
f588f2a
fix typo
jjw24 Jul 25, 2021
8330dd3
Add a MemoryStream buffer to ReadStream first
taooceros Jul 26, 2021
311b83c
Merge pull request #596 from Flow-Launcher/add_portable_release
jjw24 Jul 26, 2021
2818b02
version bump
jjw24 Jul 26, 2021
755a687
fix portable readme download link
jjw24 Jul 26, 2021
268cde1
fix WinGet deployment to only occur for non-pr master branch build
jjw24 Jul 26, 2021
3e0ac6d
switch to publish WinGet on master branch tag build
jjw24 Jul 26, 2021
4e3746f
Don't rethrow OperationCanceledException
taooceros Jul 27, 2021
220db44
Manually kill process when token is canceled
taooceros Jul 27, 2021
d7c037d
fix dispose issue by manually dispose
taooceros Jul 27, 2021
bd15aa7
pass query helper object
jjw24 Jul 27, 2021
7a355d4
Merge pull request #599 from Flow-Launcher/fix_indexing_notrunning
taooceros Jul 27, 2021
466b825
fix comment formatting
jjw24 Jul 27, 2021
2777795
Merge pull request #603 from Flow-Launcher/FixJsonRPCBufferExceed
jjw24 Jul 27, 2021
cfb2ca1
fix PluginsManager context menu crashing
jjw24 Jul 27, 2021
2155602
update per suggestion
jjw24 Jul 27, 2021
8f5848f
Merge pull request #609 from Flow-Launcher/fix_pluginsmanager_context…
jjw24 Jul 27, 2021
7f1c735
set nuget publish on tag only
jjw24 Jul 27, 2021
1fb4598
fix to string
jjw24 Jul 27, 2021
995d78b
Merge pull request #606 from Flow-Launcher/fix_readme_ci
jjw24 Jul 28, 2021
3e01411
Merge pull request #605 from Flow-Launcher/version_bump_release
jjw24 Jul 28, 2021
98be93c
Add Slovak translation for Explorer plugin
kubalav Jul 28, 2021
41a72fb
Version bump for Explorer plugin
kubalav Jul 28, 2021
309ee29
Merge pull request #614 from kubalav/translation-sk
jjw24 Jul 28, 2021
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
1 change: 1 addition & 0 deletions Flow.Launcher.Core/Flow.Launcher.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<ItemGroup>
<PackageReference Include="Droplex" Version="1.3.1" />
<PackageReference Include="FSharp.Core" Version="4.7.1" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.1.3" />
<PackageReference Include="squirrel.windows" Version="1.5.2" />
</ItemGroup>

Expand Down
81 changes: 67 additions & 14 deletions Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
using System.Windows.Forms;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin;
using ICSharpCode.SharpZipLib.Zip;
using JetBrains.Annotations;
using Microsoft.IO;

namespace Flow.Launcher.Core.Plugin
{
Expand All @@ -33,9 +35,11 @@ internal abstract class JsonRPCPlugin : IAsyncPlugin, IContextMenu
protected abstract string ExecuteCallback(JsonRPCRequestModel rpcRequest);
protected abstract string ExecuteContextMenu(Result selectedResult);

private static readonly RecyclableMemoryStreamManager BufferManager = new();

public List<Result> LoadContextMenus(Result selectedResult)
{
string output = ExecuteContextMenu(selectedResult);
var output = ExecuteContextMenu(selectedResult);
try
{
return DeserializedResult(output);
Expand All @@ -61,12 +65,23 @@ private async Task<List<Result>> DeserializedResultAsync(Stream output)
{
if (output == Stream.Null) return null;

var queryResponseModel = await
JsonSerializer.DeserializeAsync<JsonRPCQueryResponseModel>(output, options);
try
{
var queryResponseModel =
await JsonSerializer.DeserializeAsync<JsonRPCQueryResponseModel>(output, options);

await output.DisposeAsync();

return ParseResults(queryResponseModel);
return ParseResults(queryResponseModel);
}
catch (JsonException e)
{
Log.Exception(GetType().FullName, "Unexpected Json Input", e);
}
finally
{
await output.DisposeAsync();
}

return null;
}

private List<Result> DeserializedResult(string output)
Expand All @@ -81,15 +96,14 @@ private List<Result> DeserializedResult(string output)

private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
{
var results = new List<Result>();
if (queryResponseModel.Result == null) return null;

if (!string.IsNullOrEmpty(queryResponseModel.DebugMessage))
{
context.API.ShowMsg(queryResponseModel.DebugMessage);
}

foreach (JsonRPCResult result in queryResponseModel.Result)
foreach (var result in queryResponseModel.Result)
{
result.Action = c =>
{
Expand All @@ -114,7 +128,8 @@ private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)
return !result.JsonRPCAction.DontHideAfterAction;
}

var jsonRpcRequestModel = JsonSerializer.Deserialize<JsonRPCRequestModel>(actionResponse, options);
var jsonRpcRequestModel =
JsonSerializer.Deserialize<JsonRPCRequestModel>(actionResponse, options);

if (jsonRpcRequestModel?.Method?.StartsWith("Flow.Launcher.") ?? false)
{
Expand All @@ -125,9 +140,12 @@ private List<Result> ParseResults(JsonRPCQueryResponseModel queryResponseModel)

return !result.JsonRPCAction.DontHideAfterAction;
};
results.Add(result);
}

var results = new List<Result>();

results.AddRange(queryResponseModel.Result);

return results;
}

Expand Down Expand Up @@ -217,16 +235,42 @@ protected string Execute(ProcessStartInfo startInfo)

protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token = default)
{
Process process = null;
bool disposed = false;
try
{
using var process = Process.Start(startInfo);
process = Process.Start(startInfo);
if (process == null)
{
Log.Error("|JsonRPCPlugin.ExecuteAsync|Can't start new process");
return Stream.Null;
}

var result = process.StandardOutput.BaseStream;
await using var source = process.StandardOutput.BaseStream;

var buffer = BufferManager.GetStream();

token.Register(() =>
{
// ReSharper disable once AccessToModifiedClosure
// Manually Check whether disposed
if (!disposed && !process.HasExited)
process.Kill();
});

try
{
// token expire won't instantly trigger the exception,
// manually kill process at before
await source.CopyToAsync(buffer, token);
}
catch (OperationCanceledException)
{
await buffer.DisposeAsync();
return Stream.Null;
}

buffer.Seek(0, SeekOrigin.Begin);

token.ThrowIfCancellationRequested();

Expand All @@ -245,7 +289,7 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
return Stream.Null;
}

return result;
return buffer;
}
catch (Exception e)
{
Expand All @@ -254,15 +298,24 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
e);
return Stream.Null;
}
finally
{
process?.Dispose();
disposed = true;
}
}

public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
{
var output = await ExecuteQueryAsync(query, token);
try
{
var output = await ExecuteQueryAsync(query, token);
return await DeserializedResultAsync(output);
}
catch (OperationCanceledException)
{
return null;
}
catch (Exception e)
{
Log.Exception($"|JsonRPCPlugin.Query|Exception when query <{query}>", e);
Expand Down
4 changes: 3 additions & 1 deletion Flow.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>

Http.API = API;
Http.Proxy = _settings.Proxy;

await PluginManager.InitializePlugins(API);
var window = new MainWindow(_settings, _mainVM);

Expand All @@ -99,6 +99,8 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
AutoStartup();
AutoUpdates();

API.SaveAppAllSettings();

_mainVM.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible;
Log.Info("|App.OnStartup|End Flow Launcher startup ---------------------------------------------------- ");
});
Expand Down
5 changes: 5 additions & 0 deletions Flow.Launcher/Languages/sk.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignorovať klávesové skratky v režime na celú obrazovku</system:String>
<system:String x:Key="pythonDirectory">Priečinok s Pythonom</system:String>
<system:String x:Key="autoUpdates">Automatická aktualizácia</system:String>
<system:String x:Key="autoHideScrollBar">Automaticky skryť posuvník</system:String>
<system:String x:Key="autoHideScrollBarToolTip">Automaticky skrývať posuvník v okne nastavení a zobraziť ho, keď naň prejdete myšou</system:String>
<system:String x:Key="selectPythonDirectory">Vybrať</system:String>
<system:String x:Key="hideOnStartup">Schovať Flow Launcher po spustení</system:String>
<system:String x:Key="hideNotifyIcon">Schovať ikonu z oblasti oznámení</system:String>
<system:String x:Key="querySearchPrecision">Presnosť vyhľadávania</system:String>
<system:String x:Key="ShouldUsePinyin">Použiť Pinyin</system:String>
<system:String x:Key="ShouldUsePinyinToolTip">Umožňuje vyhľadávanie pomocou Pinyin. Pinyin je štandardný systém romanizovaného pravopisu pre transliteráciu čínštiny</system:String>
<system:String x:Key="shadowEffectNotAllowed">Efekt tieňa nie je povolený, kým má aktuálny motív povolený efekt rozostrenia</system:String>

<!--Setting Plugin-->
<system:String x:Key="plugin">Plugin</system:String>
Expand All @@ -48,6 +51,7 @@
<system:String x:Key="newActionKeyword">Nová akcia skratky:</system:String>
<system:String x:Key="currentPriority">Aktuálna priorita:</system:String>
<system:String x:Key="newPriority">Nová priorita:</system:String>
<system:String x:Key="priority">Priorita:</system:String>
<system:String x:Key="pluginDirectory">Priečinok s pluginmi</system:String>
<system:String x:Key="author">Autor</system:String>
<system:String x:Key="plugin_init_time">Príprava:</system:String>
Expand All @@ -70,6 +74,7 @@
<system:String x:Key="openResultModifiers">Modifikáčné klávesy na otvorenie výsledkov</system:String>
<system:String x:Key="showOpenResultHotkey">Zobraziť klávesovú skratku</system:String>
<system:String x:Key="customQueryHotkey">Vlastná klávesová skratka na vyhľadávanie</system:String>
<system:String x:Key="customQuery">Dopyt</system:String>
<system:String x:Key="delete">Odstrániť</system:String>
<system:String x:Key="edit">Upraviť</system:String>
<system:String x:Key="add">Pridať</system:String>
Expand Down
4 changes: 2 additions & 2 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window x:Class="Flow.Launcher.MainWindow"
<Window x:Class="Flow.Launcher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
Expand Down Expand Up @@ -93,7 +93,7 @@
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
<svgc:SvgControl Source="{Binding Image}" HorizontalAlignment="Right" Width="48" Height="48"
<svgc:SvgControl Source="{Binding Image}" HorizontalAlignment="Right" Width="42" Height="42"
Background="Transparent"/>
</Grid>
<Line x:Name="ProgressBar" HorizontalAlignment="Right"
Expand Down
81 changes: 40 additions & 41 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,54 +77,53 @@ private void OnLoaded(object sender, RoutedEventArgs _)
switch (e.PropertyName)
{
case nameof(MainViewModel.MainWindowVisibility):
{
if (_viewModel.MainWindowVisibility == Visibility.Visible)
{
Activate();
QueryTextBox.Focus();
UpdatePosition();
_settings.ActivateTimes++;
if (!_viewModel.LastQuerySelected)
if (_viewModel.MainWindowVisibility == Visibility.Visible)
{
QueryTextBox.SelectAll();
_viewModel.LastQuerySelected = true;
Activate();
QueryTextBox.Focus();
UpdatePosition();
_settings.ActivateTimes++;
if (!_viewModel.LastQuerySelected)
{
QueryTextBox.SelectAll();
_viewModel.LastQuerySelected = true;
}

if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused)
{
_progressBarStoryboard.Begin(ProgressBar, true);
isProgressBarStoryboardPaused = false;
}
}

if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused)
else if (!isProgressBarStoryboardPaused)
{
_progressBarStoryboard.Begin(ProgressBar, true);
isProgressBarStoryboardPaused = false;
_progressBarStoryboard.Stop(ProgressBar);
isProgressBarStoryboardPaused = true;
}
}

if (!isProgressBarStoryboardPaused)
{
_progressBarStoryboard.Stop(ProgressBar);
isProgressBarStoryboardPaused = true;
break;
}

break;
}
case nameof(MainViewModel.ProgressBarVisibility):
{
Dispatcher.Invoke(async () =>
{
if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused)
Dispatcher.Invoke(async () =>
{
await Task.Delay(50);
_progressBarStoryboard.Stop(ProgressBar);
isProgressBarStoryboardPaused = true;
}
else if (_viewModel.MainWindowVisibility == Visibility.Visible &&
isProgressBarStoryboardPaused)
{
_progressBarStoryboard.Begin(ProgressBar, true);
isProgressBarStoryboardPaused = false;
}
}, System.Windows.Threading.DispatcherPriority.Render);

break;
}
if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused)
{
await Task.Delay(50);
_progressBarStoryboard.Stop(ProgressBar);
isProgressBarStoryboardPaused = true;
}
else if (_viewModel.MainWindowVisibility == Visibility.Visible &&
isProgressBarStoryboardPaused)
{
_progressBarStoryboard.Begin(ProgressBar, true);
isProgressBarStoryboardPaused = false;
}
}, System.Windows.Threading.DispatcherPriority.Render);

break;
}
case nameof(MainViewModel.QueryTextCursorMovedToEnd):
if (_viewModel.QueryTextCursorMovedToEnd)
{
Expand Down Expand Up @@ -230,10 +229,10 @@ private void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e)
{
if (sender != null && e.OriginalSource != null)
{
var r = (ResultListBox) sender;
var d = (DependencyObject) e.OriginalSource;
var r = (ResultListBox)sender;
var d = (DependencyObject)e.OriginalSource;
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
var result = (ResultViewModel) item?.DataContext;
var result = (ResultViewModel)item?.DataContext;
if (result != null)
{
if (e.ChangedButton == MouseButton.Left)
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<TabControl Height="auto" SelectedIndex="0">
<TabItem Header="{DynamicResource general}">
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}" Margin="60,0,0,0">
<StackPanel Orientation="Vertical" Margin="0,30,0,0">
<StackPanel Orientation="Vertical" Margin="0,30,0,30">
<ui:ToggleSwitch Margin="10" IsOn="{Binding PortableMode}">
<TextBlock Text="{DynamicResource portableMode}" />
</ui:ToggleSwitch>
Expand Down
4 changes: 4 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<system:String x:Key="plugin_explorer_deletefilefoldersuccess">Deletion successful</system:String>
<system:String x:Key="plugin_explorer_deletefilefoldersuccess_detail">Successfully deleted the {0}</system:String>
<system:String x:Key="plugin_explorer_globalActionKeywordInvalid">Assigning the global action keyword could bring up too many results during search. Please choose a specific action keyword</system:String>
<system:String x:Key="plugin_explorer_windowsSearchServiceNotRunning">The required service for Windows Index Search does not appear to be running</system:String>
<system:String x:Key="plugin_explorer_windowsSearchServiceFix">To fix this, start the Windows Search service. Select here to remove this warning</system:String>
<system:String x:Key="plugin_explorer_alternative">The warning message has been switched off. As an alternative for searching files and folders, would you like to install Everything plugin?{0}{0}Select 'Yes' to install Everything plugin, or 'No' to return</system:String>
<system:String x:Key="plugin_explorer_alternative_title">Explorer Alternative</system:String>

<!--Controls-->
<system:String x:Key="plugin_explorer_delete">Delete</system:String>
Expand Down
Loading