mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[PTRun]Allow interaction with plugin hints (#30531)
This commit is contained in:
committed by
GitHub
parent
0e01314bbd
commit
e73e73fa6c
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@@ -132,6 +132,10 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (e.PropertyName == nameof(PowerToysRunSettings.ShowPluginsOverview))
|
||||
{
|
||||
RefreshPluginsOverview();
|
||||
}
|
||||
};
|
||||
|
||||
SetHotkey(hwnd, _settings.Hotkey, OnHotkey);
|
||||
@@ -299,6 +303,16 @@ namespace PowerLauncher.ViewModel
|
||||
OnPropertyChanged(nameof(SystemQueryText));
|
||||
}
|
||||
});
|
||||
|
||||
SelectNextOverviewPluginCommand = new RelayCommand(_ =>
|
||||
{
|
||||
SelectNextOverviewPlugin();
|
||||
});
|
||||
|
||||
SelectPrevOverviewPluginCommand = new RelayCommand(_ =>
|
||||
{
|
||||
SelectPrevOverviewPlugin();
|
||||
});
|
||||
}
|
||||
|
||||
private ResultsViewModel _results;
|
||||
@@ -473,6 +487,10 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
public ICommand ClearQueryCommand { get; private set; }
|
||||
|
||||
public ICommand SelectNextOverviewPluginCommand { get; private set; }
|
||||
|
||||
public ICommand SelectPrevOverviewPluginCommand { get; private set; }
|
||||
|
||||
public class QueryTuningOptions
|
||||
{
|
||||
public int SearchClickedItemWeight { get; set; }
|
||||
@@ -1212,6 +1230,22 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
public ObservableCollection<PluginPair> Plugins { get; } = new();
|
||||
|
||||
private PluginPair _selectedPlugin;
|
||||
|
||||
public PluginPair SelectedPlugin
|
||||
{
|
||||
get => _selectedPlugin;
|
||||
|
||||
set
|
||||
{
|
||||
if (_selectedPlugin != value)
|
||||
{
|
||||
_selectedPlugin = value;
|
||||
OnPropertyChanged(nameof(SelectedPlugin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _pluginsOverviewVisibility = Visibility.Visible;
|
||||
|
||||
public Visibility PluginsOverviewVisibility
|
||||
@@ -1245,5 +1279,51 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SelectNextOverviewPlugin()
|
||||
{
|
||||
if (Plugins.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedIndex = Plugins.IndexOf(SelectedPlugin);
|
||||
if (selectedIndex == -1)
|
||||
{
|
||||
selectedIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++selectedIndex > Plugins.Count - 1)
|
||||
{
|
||||
selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SelectedPlugin = Plugins[selectedIndex];
|
||||
}
|
||||
|
||||
private void SelectPrevOverviewPlugin()
|
||||
{
|
||||
if (Plugins.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedIndex = Plugins.IndexOf(SelectedPlugin);
|
||||
if (selectedIndex == -1)
|
||||
{
|
||||
selectedIndex = Plugins.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (--selectedIndex < 0)
|
||||
{
|
||||
selectedIndex = Plugins.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
SelectedPlugin = Plugins[selectedIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user