File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 46
46
Key =" Tab"
47
47
Command =" {Binding SelectPrevItemCommand}"
48
48
Modifiers =" Shift" />
49
+ <KeyBinding
50
+ Key =" C"
51
+ Command =" {Binding CopyToClipboard}"
52
+ Modifiers =" Ctrl" />
49
53
<KeyBinding
50
54
Key =" I"
51
55
Command =" {Binding OpenSettingCommand}"
Original file line number Diff line number Diff line change @@ -189,6 +189,32 @@ private void InitializeKeyCommands()
189
189
190
190
SelectFirstResultCommand = new RelayCommand ( _ => SelectedResults . SelectFirstResult ( ) ) ;
191
191
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
+
192
218
StartHelpCommand = new RelayCommand ( _ =>
193
219
{
194
220
SearchWeb . NewTabInBrowser ( "https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/" ) ;
@@ -383,6 +409,7 @@ private ResultsViewModel SelectedResults
383
409
public ICommand OpenSettingCommand { get ; set ; }
384
410
public ICommand ReloadPluginDataCommand { get ; set ; }
385
411
public ICommand ClearQueryCommand { get ; private set ; }
412
+ public ICommand CopyToClipboard { get ; set ; }
386
413
387
414
public string OpenResultCommandModifiers { get ; private set ; }
388
415
You can’t perform that action at this time.
0 commit comments