diff --git a/.gitignore b/.gitignore index f6adb8394..d25f19e77 100644 --- a/.gitignore +++ b/.gitignore @@ -117,3 +117,5 @@ UpgradeLog*.XML Wox/Images/websearch/Thumbs.db Wox/Images/Thumbs.db Wox/Wox.csproj + +*.sublime-* diff --git a/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs b/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs index da16cc931..8a6f8a193 100644 --- a/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs +++ b/Wox.Infrastructure/Storage/UserSettings/UserSettingStorage.cs @@ -44,6 +44,12 @@ namespace Wox.Infrastructure.Storage.UserSettings [JsonProperty] public List WebSearches { get; set; } + [JsonProperty] + public double WindowLeft { get; set; } + + [JsonProperty] + public double WindowTop { get; set; } + [JsonProperty] public List ProgramSources { get; set; } diff --git a/Wox.Plugin.SystemPlugins/BrowserBookmarks.cs b/Wox.Plugin.SystemPlugins/BrowserBookmarks.cs index 4521a6c06..59a201f15 100644 --- a/Wox.Plugin.SystemPlugins/BrowserBookmarks.cs +++ b/Wox.Plugin.SystemPlugins/BrowserBookmarks.cs @@ -19,7 +19,7 @@ namespace Wox.Plugin.SystemPlugins protected override List QueryInternal(Query query) { - if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); + if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); var fuzzyMather = FuzzyMatcher.Create(query.RawQuery); List returnList = bookmarks.Where(o => MatchProgram(o, fuzzyMather)).ToList(); diff --git a/Wox.Plugin.SystemPlugins/Calculator.cs b/Wox.Plugin.SystemPlugins/Calculator.cs index 9453851dd..7968c4b95 100644 --- a/Wox.Plugin.SystemPlugins/Calculator.cs +++ b/Wox.Plugin.SystemPlugins/Calculator.cs @@ -33,8 +33,7 @@ namespace Wox.Plugin.SystemPlugins protected override List QueryInternal(Query query) { - if (string.IsNullOrEmpty(query.RawQuery) - || query.RawQuery.Length <= 2 // don't affect when user only input "e" or "i" keyword + if (query.RawQuery.Length <= 2 // don't affect when user only input "e" or "i" keyword || !regValidExpressChar.IsMatch(query.RawQuery) || !IsBracketComplete(query.RawQuery)) return new List(); diff --git a/Wox.Plugin.SystemPlugins/Program/Programs.cs b/Wox.Plugin.SystemPlugins/Program/Programs.cs index 3d45e5364..f1906f8c5 100644 --- a/Wox.Plugin.SystemPlugins/Program/Programs.cs +++ b/Wox.Plugin.SystemPlugins/Program/Programs.cs @@ -51,7 +51,7 @@ namespace Wox.Plugin.SystemPlugins.Program protected override List QueryInternal(Query query) { - if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); + if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); var fuzzyMather = FuzzyMatcher.Create(query.RawQuery); List returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList(); diff --git a/Wox.Plugin.SystemPlugins/Sys.cs b/Wox.Plugin.SystemPlugins/Sys.cs index fd85057f2..ec48fbea7 100644 --- a/Wox.Plugin.SystemPlugins/Sys.cs +++ b/Wox.Plugin.SystemPlugins/Sys.cs @@ -25,7 +25,7 @@ namespace Wox.Plugin.SystemPlugins protected override List QueryInternal(Query query) { - if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); + if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); List results = new List(); @@ -94,7 +94,7 @@ namespace Wox.Plugin.SystemPlugins Action = (c) => { ProcessStartInfo Info = new ProcessStartInfo(); - Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\""; + Info.Arguments = "/C sleep 1 && \"" + Application.ExecutablePath + "\""; Info.WindowStyle = ProcessWindowStyle.Hidden; Info.CreateNoWindow = true; Info.FileName = "cmd.exe"; diff --git a/Wox.Plugin.SystemPlugins/ThirdpartyPluginIndicator.cs b/Wox.Plugin.SystemPlugins/ThirdpartyPluginIndicator.cs index a81cd036d..d1759b17e 100644 --- a/Wox.Plugin.SystemPlugins/ThirdpartyPluginIndicator.cs +++ b/Wox.Plugin.SystemPlugins/ThirdpartyPluginIndicator.cs @@ -16,7 +16,6 @@ namespace Wox.Plugin.SystemPlugins protected override List QueryInternal(Query query) { List results = new List(); - if (string.IsNullOrEmpty(query.RawQuery)) return results; foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata)) { diff --git a/Wox.Plugin.SystemPlugins/WebSearch/WebSearchPlugin.cs b/Wox.Plugin.SystemPlugins/WebSearch/WebSearchPlugin.cs index b4c7830ef..eeefdc360 100644 --- a/Wox.Plugin.SystemPlugins/WebSearch/WebSearchPlugin.cs +++ b/Wox.Plugin.SystemPlugins/WebSearch/WebSearchPlugin.cs @@ -18,7 +18,6 @@ namespace Wox.Plugin.SystemPlugins protected override List QueryInternal(Query query) { List results = new List(); - if (string.IsNullOrEmpty(query.ActionName)) return results; WebSearch webSearch = UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.ActionName && o.Enabled); diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index c7215905b..e48e74378 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -140,13 +140,26 @@ namespace Wox { } void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { + UserSettingStorage.Instance.WindowLeft = Left; + UserSettingStorage.Instance.WindowTop = Top; + UserSettingStorage.Instance.Save(); this.HideWox(); e.Cancel = true; } private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { - Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2; - Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3; + if (UserSettingStorage.Instance.WindowLeft == 0 + && UserSettingStorage.Instance.WindowTop == 0) + { + Left = UserSettingStorage.Instance.WindowLeft + = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2; + Top = UserSettingStorage.Instance.WindowTop + = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 5; + } + else { + Left = UserSettingStorage.Instance.WindowLeft; + Top = UserSettingStorage.Instance.WindowTop; + } Plugins.Init();