mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
https://github.com/Wox-launcher/Wox/issues/1050 https://github.com/Wox-launcher/Wox/issues/1141
This commit is contained in:
@@ -216,7 +216,7 @@ namespace Wox.ViewModel
|
||||
QueryTextCursorMovedToEnd = true;
|
||||
QueryText = queryText;
|
||||
}
|
||||
public bool QueryTextSelected { get; set; }
|
||||
public bool LastQuerySelected { get; set; }
|
||||
public bool QueryTextCursorMovedToEnd { get; set; }
|
||||
|
||||
private ResultsViewModel _selectedResults;
|
||||
@@ -566,10 +566,29 @@ namespace Wox.ViewModel
|
||||
|
||||
private void OnHotkey(object sender, HotkeyEventArgs e)
|
||||
{
|
||||
if (ShouldIgnoreHotkeys()) return;
|
||||
QueryTextSelected = true;
|
||||
ToggleWox();
|
||||
e.Handled = true;
|
||||
if (!ShouldIgnoreHotkeys())
|
||||
{
|
||||
|
||||
if (_settings.LastQueryMode == LastQueryMode.Empty)
|
||||
{
|
||||
ChangeQueryText(string.Empty);
|
||||
}
|
||||
else if (_settings.LastQueryMode == LastQueryMode.Preserved)
|
||||
{
|
||||
LastQuerySelected = true;
|
||||
}
|
||||
else if (_settings.LastQueryMode == LastQueryMode.Selected)
|
||||
{
|
||||
LastQuerySelected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
|
||||
}
|
||||
|
||||
ToggleWox();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleWox()
|
||||
|
||||
@@ -50,8 +50,30 @@ namespace Wox.ViewModel
|
||||
|
||||
#region general
|
||||
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public class LastQueryMode
|
||||
{
|
||||
public string Display { get; set; }
|
||||
public Infrastructure.UserSettings.LastQueryMode Value { get; set; }
|
||||
}
|
||||
public List<LastQueryMode> LastQueryModes
|
||||
{
|
||||
get
|
||||
{
|
||||
List<LastQueryMode> modes = new List<LastQueryMode>();
|
||||
var enums = (Infrastructure.UserSettings.LastQueryMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.LastQueryMode));
|
||||
foreach (var e in enums)
|
||||
{
|
||||
var key = $"LastQuery{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new LastQueryMode { Display = display, Value = e, };
|
||||
modes.Add(m);
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
}
|
||||
|
||||
private Internationalization _translater => InternationalizationManager.Instance;
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user