Skip to content

Commit bb9682f

Browse files
committed
Move get default hotkeys to pluginmanger and make Main.Context non-static
1 parent 00457dd commit bb9682f

File tree

3 files changed

+38
-41
lines changed

3 files changed

+38
-41
lines changed

Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
1313
{
1414
public class Main : ISettingProvider, IPlugin, ISavable, IContextMenu, IPluginI18n
1515
{
16-
internal static PluginInitContext Context { get; set; }
16+
internal PluginInitContext Context { get; set; }
1717

1818
internal Settings Settings;
1919

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,43 @@ internal async Task UpdateManifest()
5050
await pluginsManifest.DownloadManifest();
5151
}
5252

53+
internal List<Result> GetDefaultHotKeys()
54+
{
55+
return new List<Result>()
56+
{
57+
new Result()
58+
{
59+
Title = Settings.HotKeyInstall,
60+
IcoPath = icoPath,
61+
Action = _ =>
62+
{
63+
Context.API.ChangeQuery("pm install ");
64+
return false;
65+
}
66+
},
67+
new Result()
68+
{
69+
Title = Settings.HotkeyUninstall,
70+
IcoPath = icoPath,
71+
Action = _ =>
72+
{
73+
Context.API.ChangeQuery("pm uninstall ");
74+
return false;
75+
}
76+
},
77+
new Result()
78+
{
79+
Title = Settings.HotkeyUpdate,
80+
IcoPath = icoPath,
81+
Action = _ =>
82+
{
83+
Context.API.ChangeQuery("pm update ");
84+
return false;
85+
}
86+
}
87+
};
88+
}
89+
5390
internal void InstallOrUpdate(UserPlugin plugin)
5491
{
5592
if (PluginExists(plugin.ID))

Plugins/Flow.Launcher.Plugin.PluginsManager/Settings.cs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,6 @@ internal class Settings
1212
internal string HotkeyUpdate { get; set; } = "update";
1313

1414
internal readonly string icoPath = "Images\\pluginsmanager.png";
15-
16-
17-
internal List<Result> HotKeys
18-
{
19-
get
20-
{
21-
return new List<Result>()
22-
{
23-
new Result()
24-
{
25-
Title = HotKeyInstall,
26-
IcoPath = icoPath,
27-
Action = _ =>
28-
{
29-
Main.Context.API.ChangeQuery("pm install ");
30-
return false;
31-
}
32-
},
33-
new Result()
34-
{
35-
Title = HotkeyUninstall,
36-
IcoPath = icoPath,
37-
Action = _ =>
38-
{
39-
Main.Context.API.ChangeQuery("pm uninstall ");
40-
return false;
41-
}
42-
},
43-
new Result()
44-
{
45-
Title = HotkeyUpdate,
46-
IcoPath = icoPath,
47-
Action = _ =>
48-
{
49-
Main.Context.API.ChangeQuery("pm update ");
50-
return false;
51-
}
52-
}
53-
};
54-
}
5515
}
5616
}
5717
}

0 commit comments

Comments
 (0)