From 9d94507e1618dfa78e989819d7ceb8b15ca9be4c Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Wed, 1 Dec 2021 05:02:11 -0500 Subject: [PATCH] Initial support --- Flow.Launcher/MainWindow.xaml | 4 ++++ Flow.Launcher/ViewModel/MainViewModel.cs | 27 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index dd8979650..d04b4a165 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -46,6 +46,10 @@ Key="Tab" Command="{Binding SelectPrevItemCommand}" Modifiers="Shift" /> + 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; }