Initial support

This commit is contained in:
Garulf 2021-12-01 05:02:11 -05:00
parent 96bcf1b1f0
commit 9d94507e16
2 changed files with 31 additions and 0 deletions

View file

@ -46,6 +46,10 @@
Key="Tab"
Command="{Binding SelectPrevItemCommand}"
Modifiers="Shift" />
<KeyBinding
Key="C"
Command="{Binding CopyToClipboard}"
Modifiers="Ctrl" />
<KeyBinding
Key="I"
Command="{Binding OpenSettingCommand}"

View file

@ -189,6 +189,32 @@ namespace Flow.Launcher.ViewModel
SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult());
CopyToClipboard = new RelayCommand(index =>
{
var results = SelectedResults;
if (index != null)
{
results.SelectedIndex = int.Parse(index.ToString());
}
var result = results.SelectedItem?.Result;
if (result != null) // SelectedItem returns null if selection is empty.
{
bool hideWindow = result.Action != null && result.Action(new ActionContext
{
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
});
Clipboard.SetText(result.Title.ToString());
if (hideWindow)
{
Hide();
}
}
});
StartHelpCommand = new RelayCommand(_ =>
{
SearchWeb.NewTabInBrowser("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/");
@ -383,6 +409,7 @@ namespace Flow.Launcher.ViewModel
public ICommand OpenSettingCommand { get; set; }
public ICommand ReloadPluginDataCommand { get; set; }
public ICommand ClearQueryCommand { get; private set; }
public ICommand CopyToClipboard { get; set; }
public string OpenResultCommandModifiers { get; private set; }