File tree Expand file tree Collapse file tree 3 files changed +13
-26
lines changed Expand file tree Collapse file tree 3 files changed +13
-26
lines changed Original file line number Diff line number Diff line change 178
178
Style =" {DynamicResource QueryBoxStyle}"
179
179
Text =" {Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
180
180
Visibility =" Visible" >
181
+ <TextBox .CommandBindings>
182
+ <CommandBinding Command =" ApplicationCommands.Copy" Executed =" OnCopy" />
183
+ </TextBox .CommandBindings>
181
184
<TextBox .ContextMenu>
182
185
<ContextMenu >
183
186
<MenuItem Command =" ApplicationCommands.Cut" />
Original file line number Diff line number Diff line change @@ -47,7 +47,17 @@ public MainWindow()
47
47
{
48
48
InitializeComponent ( ) ;
49
49
}
50
+ private void OnCopy ( object sender , ExecutedRoutedEventArgs e )
51
+ {
52
+ var results = _viewModel . Results ;
53
+ var result = results . SelectedItem ? . Result ;
54
+ if ( result != null ) // SelectedItem returns null if selection is empty.
55
+ {
50
56
57
+ System . Windows . Clipboard . SetDataObject ( result . Title . ToString ( ) ) ;
58
+ }
59
+ e . Handled = true ;
60
+ }
51
61
private async void OnClosing ( object sender , CancelEventArgs e )
52
62
{
53
63
_settings . WindowTop = Top ;
Original file line number Diff line number Diff line change @@ -189,32 +189,6 @@ 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
-
218
192
StartHelpCommand = new RelayCommand ( _ =>
219
193
{
220
194
SearchWeb . NewTabInBrowser ( "https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/" ) ;
You can’t perform that action at this time.
0 commit comments