File tree Expand file tree Collapse file tree 5 files changed +74
-19
lines changed
Plugins/Flow.Launcher.Plugin.Explorer Expand file tree Collapse file tree 5 files changed +74
-19
lines changed Original file line number Diff line number Diff line change @@ -283,18 +283,27 @@ public List<Result> LoadContextMenus(Result selectedResult)
283
283
284
284
if ( record . Type is ResultType . File or ResultType . Folder && Settings . ShowInlinedWindowsContextMenu )
285
285
{
286
- var filters = Settings
287
- . WindowsContextMenuIgnoredItems
286
+ var includedItems = Settings
287
+ . WindowsContextMenuIncludedItems
288
+ . Replace ( "\r " , "" )
289
+ . Split ( "\n " )
290
+ . Where ( v => ! string . IsNullOrWhiteSpace ( v ) )
291
+ . ToArray ( ) ;
292
+ var excludedItems = Settings
293
+ . WindowsContextMenuExcludedItems
288
294
. Replace ( "\r " , "" )
289
295
. Split ( "\n " )
290
296
. Where ( v => ! string . IsNullOrWhiteSpace ( v ) )
291
297
. ToArray ( ) ;
292
298
var menuItems = ShellContextMenuDisplayHelper
293
299
. GetContextMenuWithIcons ( record . FullPath )
294
300
. Where ( contextMenuItem =>
295
- filters . Length == 0 || ! filters . Any ( filter =>
301
+ ( includedItems . Length == 0 || includedItems . Any ( filter =>
302
+ contextMenuItem . Label . Contains ( filter , StringComparison . OrdinalIgnoreCase )
303
+ ) ) &&
304
+ ( excludedItems . Length == 0 || ! excludedItems . Any ( filter =>
296
305
contextMenuItem . Label . Contains ( filter , StringComparison . OrdinalIgnoreCase )
297
- )
306
+ ) )
298
307
) ;
299
308
foreach ( var menuItem in menuItems )
300
309
{
Original file line number Diff line number Diff line change 155
155
<!-- Native Context Menu -->
156
156
<system : String x : Key =" plugin_explorer_native_context_menu_header" >Native Context Menu</system : String >
157
157
<system : String x : Key =" plugin_explorer_native_context_menu_display_context_menu" >Display native context menu</system : String >
158
- <system : String x : Key =" plugin_explorer_native_context_menu_guide" >Below you can specify items you want to exclude from context menu, they can be partial (e.g. 'pen wit') or complete ('Open with')</system : String >
158
+ <system : String x : Key =" plugin_explorer_native_context_menu_include_patterns_guide" >Below you can specify items you want to include in the context menu, they can be partial (e.g. 'pen wit') or complete ('Open with').</system : String >
159
+ <system : String x : Key =" plugin_explorer_native_context_menu_exclude_patterns_guide" >Below you can specify items you want to exclude from context menu, they can be partial (e.g. 'pen wit') or complete ('Open with')</system : String >
159
160
</ResourceDictionary >
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ public class Settings
30
30
31
31
public bool ShowInlinedWindowsContextMenu { get ; set ; } = false ;
32
32
33
- public string WindowsContextMenuIgnoredItems { get ; set ; } = string . Empty ;
33
+ public string WindowsContextMenuIncludedItems { get ; set ; } = string . Empty ;
34
+
35
+ public string WindowsContextMenuExcludedItems { get ; set ; } = string . Empty ;
34
36
35
37
public bool DefaultOpenFolderInFileManager { get ; set ; } = false ;
36
38
Original file line number Diff line number Diff line change @@ -114,12 +114,22 @@ public bool ShowWindowsContextMenu
114
114
}
115
115
}
116
116
117
- public string WindowsContextMenuIgnoredItems
117
+ public string WindowsContextMenuIncludedItems
118
118
{
119
- get => Settings . WindowsContextMenuIgnoredItems ;
119
+ get => Settings . WindowsContextMenuIncludedItems ;
120
120
set
121
121
{
122
- Settings . WindowsContextMenuIgnoredItems = value ;
122
+ Settings . WindowsContextMenuIncludedItems = value ;
123
+ OnPropertyChanged ( ) ;
124
+ }
125
+ }
126
+
127
+ public string WindowsContextMenuExcludedItems
128
+ {
129
+ get => Settings . WindowsContextMenuExcludedItems ;
130
+ set
131
+ {
132
+ Settings . WindowsContextMenuExcludedItems = value ;
123
133
OnPropertyChanged ( ) ;
124
134
}
125
135
}
Original file line number Diff line number Diff line change 358
358
Content =" {DynamicResource plugin_explorer_native_context_menu_display_context_menu}"
359
359
IsChecked =" {Binding ShowWindowsContextMenu}" />
360
360
361
- <TextBlock
362
- Margin =" 0 10 20 10"
363
- Foreground =" {DynamicResource Color05B}"
364
- Text =" {DynamicResource plugin_explorer_native_context_menu_guide}"
365
- TextWrapping =" Wrap" />
361
+ <Grid Margin =" 0 10 20 10" >
362
+ <Grid .ColumnDefinitions>
363
+ <ColumnDefinition Width =" *" />
364
+ <ColumnDefinition Width =" *" />
365
+ </Grid .ColumnDefinitions>
366
+ <Grid .RowDefinitions>
367
+ <RowDefinition Height =" Auto" />
368
+ <RowDefinition Height =" Auto" />
369
+ </Grid .RowDefinitions>
366
370
367
- <TextBox
368
- Height =" 300"
369
- AcceptsReturn =" True"
370
- Text =" {Binding WindowsContextMenuIgnoredItems}"
371
- TextWrapping =" Wrap" />
371
+ <TextBlock
372
+ Grid.Row=" 0"
373
+ Grid.Column=" 0"
374
+ Margin =" 0 0 6 6"
375
+ Foreground =" {DynamicResource Color05B}"
376
+ Text =" {DynamicResource plugin_explorer_native_context_menu_include_patterns_guide}"
377
+ TextWrapping =" Wrap" />
378
+
379
+ <TextBox
380
+ Grid.Row=" 1"
381
+ Grid.Column=" 0"
382
+ Height =" 300"
383
+ Margin =" 0 6 6 0"
384
+ AcceptsReturn =" True"
385
+ Text =" {Binding WindowsContextMenuIncludedItems}"
386
+ TextWrapping =" Wrap" />
387
+
388
+ <TextBlock
389
+ Grid.Row=" 0"
390
+ Grid.Column=" 1"
391
+ Margin =" 6 0 0 6"
392
+ Foreground =" {DynamicResource Color05B}"
393
+ Text =" {DynamicResource plugin_explorer_native_context_menu_exclude_patterns_guide}"
394
+ TextWrapping =" Wrap" />
395
+
396
+ <TextBox
397
+ Grid.Row=" 1"
398
+ Grid.Column=" 1"
399
+ Height =" 300"
400
+ Margin =" 6 6 0 0"
401
+ AcceptsReturn =" True"
402
+ Text =" {Binding WindowsContextMenuExcludedItems}"
403
+ TextWrapping =" Wrap" />
404
+ </Grid >
372
405
</StackPanel >
373
406
</TabItem >
374
407
<TabItem
You can’t perform that action at this time.
0 commit comments