-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.cs
53 lines (42 loc) · 1.85 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Flow.Launcher.Plugin.QuickLook.Helpers;
namespace Flow.Launcher.Plugin.QuickLook
{
public class Main : IAsyncPlugin, IAsyncExternalPreview, IPluginI18n
{
internal static PluginInitContext Context { get; set; }
public Task InitAsync(PluginInitContext context)
{
Context = context;
// prompt quicklook install if not found?
return Task.CompletedTask;
}
public async Task ClosePreviewAsync()
{
await QuickLookHelper.CloseQuickLookAsync().ConfigureAwait(false);
}
public async Task SwitchPreviewAsync(string path, bool sendFailToast = true)
{
await QuickLookHelper.SwitchQuickLookAsync(path, sendFailToast).ConfigureAwait(false);
}
public async Task OpenPreviewAsync(string path, bool sendFailToast = true)
{
await QuickLookHelper.OpenQuickLookAsync(path, sendFailToast).ConfigureAwait(false);
}
public async Task<List<Result>> QueryAsync(Query query, CancellationToken token) => new List<Result>();
// Due to QuickLook's size and position not persisted after hiding, and resets itself in the
// center screen position when appears, this is set to false to override the AlwaysPreview setting in flow
// so that when the query window appears QuickLook does not also appear and block the view.
public bool AllowAlwaysPreview() => false;
public string GetTranslatedPluginTitle()
{
return Context.API.GetTranslation("plugin_name");
}
public string GetTranslatedPluginDescription()
{
return Context.API.GetTranslation("plugin_description");
}
}
}