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 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}"
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments