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 178178 Style =" {DynamicResource QueryBoxStyle}"
179179 Text =" {Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
180180 Visibility =" Visible" >
181+ <TextBox .CommandBindings>
182+ <CommandBinding Command =" ApplicationCommands.Copy" Executed =" OnCopy" />
183+ </TextBox .CommandBindings>
181184 <TextBox .ContextMenu>
182185 <ContextMenu >
183186 <MenuItem Command =" ApplicationCommands.Cut" />
Original file line number Diff line number Diff line change @@ -47,7 +47,17 @@ public MainWindow()
4747 {
4848 InitializeComponent ( ) ;
4949 }
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+ {
5056
57+ System . Windows . Clipboard . SetDataObject ( result . Title . ToString ( ) ) ;
58+ }
59+ e . Handled = true ;
60+ }
5161 private async void OnClosing ( object sender , CancelEventArgs e )
5262 {
5363 _settings . WindowTop = Top ;
Original file line number Diff line number Diff line change @@ -189,32 +189,6 @@ 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-
218192 StartHelpCommand = new RelayCommand ( _ =>
219193 {
220194 SearchWeb . NewTabInBrowser ( "https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/" ) ;
You can’t perform that action at this time.
0 commit comments