Skip to content

Commit 9d94507

Browse files
committed
Initial support
1 parent 96bcf1b commit 9d94507

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Flow.Launcher/MainWindow.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
Key="Tab"
4747
Command="{Binding SelectPrevItemCommand}"
4848
Modifiers="Shift" />
49+
<KeyBinding
50+
Key="C"
51+
Command="{Binding CopyToClipboard}"
52+
Modifiers="Ctrl" />
4953
<KeyBinding
5054
Key="I"
5155
Command="{Binding OpenSettingCommand}"

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,32 @@ private void InitializeKeyCommands()
189189

190190
SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult());
191191

192+
CopyToClipboard = new RelayCommand(index =>
193+
{
194+
var results = SelectedResults;
195+
196+
if (index != null)
197+
{
198+
results.SelectedIndex = int.Parse(index.ToString());
199+
}
200+
201+
var result = results.SelectedItem?.Result;
202+
if (result != null) // SelectedItem returns null if selection is empty.
203+
{
204+
bool hideWindow = result.Action != null && result.Action(new ActionContext
205+
{
206+
SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
207+
});
208+
Clipboard.SetText(result.Title.ToString());
209+
if (hideWindow)
210+
{
211+
Hide();
212+
}
213+
214+
215+
}
216+
});
217+
192218
StartHelpCommand = new RelayCommand(_ =>
193219
{
194220
SearchWeb.NewTabInBrowser("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/");
@@ -383,6 +409,7 @@ private ResultsViewModel SelectedResults
383409
public ICommand OpenSettingCommand { get; set; }
384410
public ICommand ReloadPluginDataCommand { get; set; }
385411
public ICommand ClearQueryCommand { get; private set; }
412+
public ICommand CopyToClipboard { get; set; }
386413

387414
public string OpenResultCommandModifiers { get; private set; }
388415

0 commit comments

Comments
 (0)