mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Resolve issue and add partial replacement trick
This commit is contained in:
parent
0d355bdef8
commit
2bb88124e6
4 changed files with 51 additions and 41 deletions
|
|
@ -120,8 +120,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
PrivateArg = "-private",
|
||||
EnablePrivate = false,
|
||||
Editable = false
|
||||
}
|
||||
,
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "MS Edge",
|
||||
|
|
@ -205,7 +204,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
|
||||
// This needs to be loaded last by staying at the bottom
|
||||
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
|
||||
internal List<ShortCutModel> ShortCuts { get; set; } = new List<ShortCutModel>();
|
||||
internal ObservableCollection<KeyValuePair<string, string>> ShortCuts { get; set; } = new()
|
||||
{
|
||||
new("spp", "sp play")
|
||||
};
|
||||
}
|
||||
|
||||
public enum LastQueryMode
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.UserSettings
|
||||
{
|
||||
public record ShortCutModel(string Key, string Value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ using Flow.Launcher.Plugin.SharedCommands;
|
|||
using Flow.Launcher.Storage;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using System.Text;
|
||||
using System.Threading.Channels;
|
||||
using ISavable = Flow.Launcher.Plugin.ISavable;
|
||||
using System.IO;
|
||||
|
|
@ -317,9 +318,9 @@ namespace Flow.Launcher.ViewModel
|
|||
#region ViewModel Properties
|
||||
|
||||
public ResultsViewModel Results { get; private set; }
|
||||
|
||||
|
||||
public ResultsViewModel ContextMenu { get; private set; }
|
||||
|
||||
|
||||
public ResultsViewModel History { get; private set; }
|
||||
|
||||
public bool GameModeStatus { get; set; }
|
||||
|
|
@ -553,14 +554,16 @@ namespace Flow.Launcher.ViewModel
|
|||
return;
|
||||
}
|
||||
|
||||
string query = QueryText;
|
||||
StringBuilder queryBuilder = new(QueryText);
|
||||
|
||||
foreach (var shortcut in _settings.ShortCuts)
|
||||
{
|
||||
if (QueryText == shortcut.Key)
|
||||
if (queryBuilder.Equals(shortcut.Key))
|
||||
{
|
||||
query = shortcut.Value;
|
||||
queryBuilder.Replace(shortcut.Key, shortcut.Value);
|
||||
}
|
||||
|
||||
queryBuilder.Replace('@' + shortcut.Key, shortcut.Value);
|
||||
}
|
||||
|
||||
_updateSource?.Dispose();
|
||||
|
|
@ -578,8 +581,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
if (currentCancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
var query = QueryBuilder.Build(query.Trim(), PluginManager.NonGlobalPlugins);
|
||||
|
||||
var query = QueryBuilder.Build(queryBuilder.ToString().Trim(), PluginManager.NonGlobalPlugins);
|
||||
|
||||
// handle the exclusiveness of plugin using action keyword
|
||||
RemoveOldQueryResults(query);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ using Flow.Launcher.Infrastructure.Storage;
|
|||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedModels;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -117,7 +118,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"LastQuery{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new LastQueryMode { Display = display, Value = e, };
|
||||
var m = new LastQueryMode
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
modes.Add(m);
|
||||
}
|
||||
return modes;
|
||||
|
|
@ -165,12 +169,17 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public List<string> OpenResultModifiersList => new List<string> { KeyConstant.Alt, KeyConstant.Ctrl, $"{KeyConstant.Ctrl}+{KeyConstant.Alt}" };
|
||||
public List<string> OpenResultModifiersList => new List<string>
|
||||
{
|
||||
KeyConstant.Alt,
|
||||
KeyConstant.Ctrl,
|
||||
$"{KeyConstant.Ctrl}+{KeyConstant.Alt}"
|
||||
};
|
||||
private Internationalization _translater => InternationalizationManager.Instance;
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||
|
||||
public List<ShortCutModel> ShortCuts => Settings.ShortCuts;
|
||||
public ObservableCollection<KeyValuePair<string, string>> ShortCuts => Settings.ShortCuts;
|
||||
|
||||
public string TestProxy()
|
||||
{
|
||||
|
|
@ -230,7 +239,10 @@ namespace Flow.Launcher.ViewModel
|
|||
var metadatas = PluginManager.AllPlugins
|
||||
.OrderBy(x => x.Metadata.Disabled)
|
||||
.ThenBy(y => y.Metadata.Name)
|
||||
.Select(p => new PluginViewModel { PluginPair = p })
|
||||
.Select(p => new PluginViewModel
|
||||
{
|
||||
PluginPair = p
|
||||
})
|
||||
.ToList();
|
||||
return metadatas;
|
||||
}
|
||||
|
|
@ -269,8 +281,6 @@ namespace Flow.Launcher.ViewModel
|
|||
OnPropertyChanged(nameof(ExternalPlugins));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region theme
|
||||
|
|
@ -284,7 +294,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
Settings.Theme = value;
|
||||
ThemeManager.Instance.ChangeTheme(value);
|
||||
|
||||
|
||||
if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect)
|
||||
DropShadowEffect = false;
|
||||
}
|
||||
|
|
@ -333,7 +343,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"ColorScheme{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new ColorScheme { Display = display, Value = e, };
|
||||
var m = new ColorScheme
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
modes.Add(m);
|
||||
}
|
||||
return modes;
|
||||
|
|
@ -376,7 +389,10 @@ namespace Flow.Launcher.ViewModel
|
|||
bitmap.BeginInit();
|
||||
bitmap.StreamSource = memStream;
|
||||
bitmap.EndInit();
|
||||
var brush = new ImageBrush(bitmap) { Stretch = Stretch.UniformToFill };
|
||||
var brush = new ImageBrush(bitmap)
|
||||
{
|
||||
Stretch = Stretch.UniformToFill
|
||||
};
|
||||
return brush;
|
||||
}
|
||||
else
|
||||
|
|
@ -404,19 +420,19 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
Title = "WebSearch",
|
||||
SubTitle = "Search the web with different search engine support",
|
||||
IcoPath =Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png")
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png")
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Program",
|
||||
SubTitle = "Launch programs as admin or a different user",
|
||||
IcoPath =Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.Program\Images\program.png")
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.Program\Images\program.png")
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "ProcessKiller",
|
||||
SubTitle = "Terminate unwanted processes",
|
||||
IcoPath =Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png")
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png")
|
||||
}
|
||||
};
|
||||
var vm = new ResultsViewModel(Settings);
|
||||
|
|
@ -430,8 +446,8 @@ namespace Flow.Launcher.ViewModel
|
|||
get
|
||||
{
|
||||
if (Fonts.SystemFontFamilies.Count(o =>
|
||||
o.FamilyNames.Values != null &&
|
||||
o.FamilyNames.Values.Contains(Settings.QueryBoxFont)) > 0)
|
||||
o.FamilyNames.Values != null &&
|
||||
o.FamilyNames.Values.Contains(Settings.QueryBoxFont)) > 0)
|
||||
{
|
||||
var font = new FontFamily(Settings.QueryBoxFont);
|
||||
return font;
|
||||
|
|
@ -458,7 +474,7 @@ namespace Flow.Launcher.ViewModel
|
|||
Settings.QueryBoxFontStyle,
|
||||
Settings.QueryBoxFontWeight,
|
||||
Settings.QueryBoxFontStretch
|
||||
));
|
||||
));
|
||||
return typeface;
|
||||
}
|
||||
set
|
||||
|
|
@ -475,8 +491,8 @@ namespace Flow.Launcher.ViewModel
|
|||
get
|
||||
{
|
||||
if (Fonts.SystemFontFamilies.Count(o =>
|
||||
o.FamilyNames.Values != null &&
|
||||
o.FamilyNames.Values.Contains(Settings.ResultFont)) > 0)
|
||||
o.FamilyNames.Values != null &&
|
||||
o.FamilyNames.Values.Contains(Settings.ResultFont)) > 0)
|
||||
{
|
||||
var font = new FontFamily(Settings.ResultFont);
|
||||
return font;
|
||||
|
|
@ -503,7 +519,7 @@ namespace Flow.Launcher.ViewModel
|
|||
Settings.ResultFontStyle,
|
||||
Settings.ResultFontWeight,
|
||||
Settings.ResultFontStretch
|
||||
));
|
||||
));
|
||||
return typeface;
|
||||
}
|
||||
set
|
||||
|
|
@ -534,6 +550,7 @@ namespace Flow.Launcher.ViewModel
|
|||
public string Github => Constant.GitHub;
|
||||
public static string Version => Constant.Version;
|
||||
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue