diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index d04b4a165..daa3810ba 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -178,6 +178,9 @@ Style="{DynamicResource QueryBoxStyle}" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="Visible"> + + + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index ba0b63a52..29f2391e3 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -47,7 +47,17 @@ namespace Flow.Launcher { InitializeComponent(); } + private void OnCopy(object sender, ExecutedRoutedEventArgs e) + { + var results = _viewModel.Results; + var result = results.SelectedItem?.Result; + if (result != null) // SelectedItem returns null if selection is empty. + { + System.Windows.Clipboard.SetDataObject(result.Title.ToString()); + } + e.Handled = true; + } private async void OnClosing(object sender, CancelEventArgs e) { _settings.WindowTop = Top; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 83ef29b19..9a4268854 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -189,32 +189,6 @@ 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/");