diff --git a/Wox/ActionKeyword.xaml b/Wox/ActionKeyword.xaml
new file mode 100644
index 0000000000..20288b6d15
--- /dev/null
+++ b/Wox/ActionKeyword.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+ Old ActionKeyword:
+ Old ActionKeyword:
+
+ New ActionKeyword:
+
+
+
+
+
+
+
+
+
+
diff --git a/Wox/ActionKeyword.xaml.cs b/Wox/ActionKeyword.xaml.cs
new file mode 100644
index 0000000000..a2a1037434
--- /dev/null
+++ b/Wox/ActionKeyword.xaml.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Wox.Infrastructure.Storage.UserSettings;
+using Wox.Plugin;
+using Wox.PluginLoader;
+using MessageBox = System.Windows.MessageBox;
+
+namespace Wox
+{
+ public partial class ActionKeyword : Window
+ {
+ private PluginMetadata pluginMetadata;
+
+ public ActionKeyword(string pluginId)
+ {
+ InitializeComponent();
+ PluginPair plugin = Plugins.AllPlugins.FirstOrDefault(o => o.Metadata.ID == pluginId);
+ if (plugin == null)
+ {
+ MessageBox.Show("Can't find specific plugin");
+ Close();
+ return;
+ }
+
+ pluginMetadata = plugin.Metadata;
+ }
+
+ private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e)
+ {
+ tbOldActionKeyword.Text = pluginMetadata.ActionKeyword;
+ tbAction.Focus();
+ }
+
+ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+
+ private void btnDone_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrEmpty(tbAction.Text))
+ {
+ MessageBox.Show("New ActionKeyword can't be empty");
+ return;
+ }
+
+ //check new action keyword didn't used by other plugin
+ if (Plugins.AllPlugins.Exists(o => o.Metadata.ActionKeyword == tbAction.Text.Trim()))
+ {
+ MessageBox.Show("New ActionKeyword has been assigned to other plugin, please assign another new action keyword");
+ return;
+ }
+
+
+ pluginMetadata.ActionKeyword = tbAction.Text.Trim();
+ var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pluginMetadata.ID);
+ if (customizedPluginConfig == null)
+ {
+ UserSettingStorage.Instance.CustomizedPluginConfigs.Add(new CustomizedPluginConfig()
+ {
+ Disabled = false,
+ ID = pluginMetadata.ID,
+ Name = pluginMetadata.Name,
+ Actionword = tbAction.Text.Trim()
+ });
+ }
+ else
+ {
+ customizedPluginConfig.Actionword = tbAction.Text.Trim();
+ }
+ UserSettingStorage.Instance.Save();
+ MessageBox.Show("Sucessfully applied the new action keyword");
+ Close();
+ }
+
+
+ }
+}
diff --git a/Wox/PluginLoader/BasePluginLoader.cs b/Wox/PluginLoader/BasePluginLoader.cs
index e88cc41d78..6e13fec2b9 100644
--- a/Wox/PluginLoader/BasePluginLoader.cs
+++ b/Wox/PluginLoader/BasePluginLoader.cs
@@ -6,6 +6,7 @@ using System.Reflection;
using System.Windows.Forms;
using Newtonsoft.Json;
using Wox.Helper;
+using Wox.Infrastructure.Storage.UserSettings;
using Wox.Plugin;
using Wox.Plugin.SystemPlugins;
@@ -104,6 +105,13 @@ namespace Wox.PluginLoader {
return null;
}
+ var customizedPluginConfig =
+ UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadata.ID);
+ if (customizedPluginConfig != null && !string.IsNullOrEmpty(customizedPluginConfig.Actionword))
+ {
+ metadata.ActionKeyword = customizedPluginConfig.Actionword;
+ }
+
return metadata;
}
}
diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml
index d79dc85900..d852a96da6 100644
--- a/Wox/SettingWindow.xaml
+++ b/Wox/SettingWindow.xaml
@@ -124,7 +124,10 @@
-
+
+ ActionKeyword:
+
+
diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs
index 97a0375dca..5608b27397 100644
--- a/Wox/SettingWindow.xaml.cs
+++ b/Wox/SettingWindow.xaml.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using IWshRuntimeLibrary;
@@ -433,7 +434,7 @@ namespace Wox
pluginActionKeyword.Visibility = Visibility.Visible;
pluginWebsite.Visibility = Visibility.Visible;
pluginTitle.Text = pair.Metadata.Name;
- pluginActionKeyword.Text = "ActionKeyword: " + pair.Metadata.ActionKeyword;
+ pluginActionKeyword.Text = pair.Metadata.ActionKeyword;
pluginAuthor.Text = "Author: " + pair.Metadata.Author;
pluginWebsite.Text = "Website: " + pair.Metadata.Website;
pluginSubTitle.Text = pair.Metadata.Description;
@@ -532,5 +533,22 @@ namespace Wox
}
UserSettingStorage.Instance.Save();
}
+
+ private void PluginActionKeyword_OnMouseUp(object sender, MouseButtonEventArgs e)
+ {
+ if (e.ChangedButton == MouseButton.Left)
+ {
+ var pair = lbPlugins.SelectedItem as PluginPair;
+ if (pair != null)
+ {
+ //third-party plugin
+ string id = pair.Metadata.ID;
+ ActionKeyword changeKeywordWindow = new ActionKeyword(id);
+ changeKeywordWindow.ShowDialog();
+ PluginPair plugin = Plugins.AllPlugins.FirstOrDefault(o => o.Metadata.ID == id);
+ if (plugin != null) pluginActionKeyword.Text = plugin.Metadata.ActionKeyword;
+ }
+ }
+ }
}
}
diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj
index 5a7a651131..53e586e22b 100644
--- a/Wox/Wox.csproj
+++ b/Wox/Wox.csproj
@@ -105,6 +105,9 @@
MSBuild:Compile
Designer
+
+ ActionKeyword.xaml
+
@@ -152,6 +155,10 @@
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile