From 20d80283a4533398d1a8ee810f4b6877a85c5cc6 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sat, 4 Dec 2021 00:48:18 -0500 Subject: [PATCH] Add CopyText field for plugin support --- Flow.Launcher.Plugin/Result.cs | 2 ++ Flow.Launcher/MainWindow.xaml.cs | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 833ada9cd..adf185557 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -29,6 +29,8 @@ namespace Flow.Launcher.Plugin /// public string ActionKeywordAssigned { get; set; } + public string CopyText { get; set; } = String.Empty; + public string IcoPath { get { return _icoPath; } diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 1afb2848f..79be50a4b 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -56,15 +56,17 @@ namespace Flow.Launcher var result = results.SelectedItem?.Result; if (result != null) // SelectedItem returns null if selection is empty. { - System.Windows.Clipboard.SetDataObject(result.Title.ToString()); + string _copyText = String.IsNullOrEmpty(result.CopyText) ? result.Title : result.CopyText; + System.Windows.Clipboard.SetDataObject(_copyText.ToString()); + e.Handled = true; } } - else if (!String.IsNullOrEmpty(QueryTextBox.Text)) - { - System.Windows.Clipboard.SetDataObject(QueryTextBox.SelectedText); - } - e.Handled = true; + //else if (!String.IsNullOrEmpty(QueryTextBox.Text)) + //{ + // System.Windows.Clipboard.SetDataObject(QueryTextBox.SelectedText); + //} + e.Handled = false; } private async void OnClosing(object sender, CancelEventArgs e) {