├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── Flow.Launcher.Plugin.Obsidian
├── .editorconfig
├── Flow.Launcher.Plugin.Obsidian.csproj
├── Helpers
│ ├── Font.cs
│ ├── Paths.cs
│ └── ScrollViewerHelper.cs
├── Icons
│ └── obsidian-logo.png
├── Main.cs
├── Models
│ ├── File.cs
│ ├── GlobalVaultSetting.cs
│ ├── Settings.cs
│ ├── Vault.cs
│ └── VaultSetting.cs
├── Services
│ ├── AliasesService.cs
│ ├── CheckBoxService.cs
│ ├── ContextMenu.cs
│ ├── NoteCreatorService.cs
│ ├── PluginsDetectionService.cs
│ ├── SearchService.cs
│ ├── UriService.cs
│ └── VaultManager.cs
├── Utilities
│ └── StringMatcher.cs
├── Views
│ ├── GlobalVaultSettingView.xaml
│ ├── GlobalVaultSettingView.xaml.cs
│ ├── SettingsView.xaml
│ ├── SettingsView.xaml.cs
│ ├── VaultSettingView.xaml
│ └── VaultSettingView.xaml.cs
└── plugin.json
├── LICENSE
└── Readme.md
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on: workflow_dispatch
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: windows-latest
9 |
10 | steps:
11 | - uses: actions/checkout@v4
12 | - name: Setup .NET
13 | uses: actions/setup-dotnet@v4
14 | with:
15 | dotnet-version: |
16 | 7
17 | 8
18 | - name: Publish package
19 | run: dotnet publish Flow.Launcher.Plugin.Obsidian -c Release -r win-x64 --no-self-contained -o publish/
20 | - uses: actions/upload-artifact@v4
21 | with:
22 | name: Flow.Launcher.Plugin.Obsidian
23 | path: publish/
24 | if-no-files-found: error
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 |
33 | # Visual Studio 2015/2017 cache/options directory
34 | .vs/
35 | # Uncomment if you have tasks that create the project's static files in wwwroot
36 | #wwwroot/
37 |
38 | # Visual Studio 2017 auto generated files
39 | Generated\ Files/
40 |
41 | # MSTest test Results
42 | [Tt]est[Rr]esult*/
43 | [Bb]uild[Ll]og.*
44 |
45 | # NUnit
46 | *.VisualState.xml
47 | TestResult.xml
48 | nunit-*.xml
49 |
50 | # Build Results of an ATL Project
51 | [Dd]ebugPS/
52 | [Rr]eleasePS/
53 | dlldata.c
54 |
55 | # Benchmark Results
56 | BenchmarkDotNet.Artifacts/
57 |
58 | # .NET Core
59 | project.lock.json
60 | project.fragment.lock.json
61 | artifacts/
62 |
63 | # StyleCop
64 | StyleCopReport.xml
65 |
66 | # Files built by Visual Studio
67 | *_i.c
68 | *_p.c
69 | *_h.h
70 | *.ilk
71 | *.meta
72 | *.obj
73 | *.iobj
74 | *.pch
75 | *.pdb
76 | *.ipdb
77 | *.pgc
78 | *.pgd
79 | *.rsp
80 | *.sbr
81 | *.tlb
82 | *.tli
83 | *.tlh
84 | *.tmp
85 | *.tmp_proj
86 | *_wpftmp.csproj
87 | *.log
88 | *.vspscc
89 | *.vssscc
90 | .builds
91 | *.pidb
92 | *.svclog
93 | *.scc
94 |
95 | # Chutzpah Test files
96 | _Chutzpah*
97 |
98 | # Visual C++ cache files
99 | ipch/
100 | *.aps
101 | *.ncb
102 | *.opendb
103 | *.opensdf
104 | *.sdf
105 | *.cachefile
106 | *.VC.db
107 | *.VC.VC.opendb
108 |
109 | # Visual Studio profiler
110 | *.psess
111 | *.vsp
112 | *.vspx
113 | *.sap
114 |
115 | # Visual Studio Trace Files
116 | *.e2e
117 |
118 | # TFS 2012 Local Workspace
119 | $tf/
120 |
121 | # Guidance Automation Toolkit
122 | *.gpState
123 |
124 | # ReSharper is a .NET coding add-in
125 | _ReSharper*/
126 | *.[Rr]e[Ss]harper
127 | *.DotSettings.user
128 |
129 | # JustCode is a .NET coding add-in
130 | .JustCode
131 |
132 | # TeamCity is a build add-in
133 | _TeamCity*
134 |
135 | # DotCover is a Code Coverage Tool
136 | *.dotCover
137 |
138 | # AxoCover is a Code Coverage Tool
139 | .axoCover/*
140 | !.axoCover/settings.json
141 |
142 | # Visual Studio code coverage results
143 | *.coverage
144 | *.coveragexml
145 |
146 | # NCrunch
147 | _NCrunch_*
148 | .*crunch*.local.xml
149 | nCrunchTemp_*
150 |
151 | # MightyMoose
152 | *.mm.*
153 | AutoTest.Net/
154 |
155 | # Web workbench (sass)
156 | .sass-cache/
157 |
158 | # Installshield output folder
159 | [Ee]xpress/
160 |
161 | # DocProject is a documentation generator add-in
162 | DocProject/buildhelp/
163 | DocProject/Help/*.HxT
164 | DocProject/Help/*.HxC
165 | DocProject/Help/*.hhc
166 | DocProject/Help/*.hhk
167 | DocProject/Help/*.hhp
168 | DocProject/Help/Html2
169 | DocProject/Help/html
170 |
171 | # Click-Once directory
172 | publish/
173 |
174 | # Publish Web Output
175 | *.[Pp]ublish.xml
176 | *.azurePubxml
177 | # Note: Comment the next line if you want to checkin your web deploy settings,
178 | # but database connection strings (with potential passwords) will be unencrypted
179 | *.pubxml
180 | *.publishproj
181 |
182 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
183 | # checkin your Azure Web App publish settings, but sensitive information contained
184 | # in these scripts will be unencrypted
185 | PublishScripts/
186 |
187 | # NuGet Packages
188 | *.nupkg
189 | # NuGet Symbol Packages
190 | *.snupkg
191 | # The packages folder can be ignored because of Package Restore
192 | **/[Pp]ackages/*
193 | # except build/, which is used as an MSBuild target.
194 | !**/[Pp]ackages/build/
195 | # Uncomment if necessary however generally it will be regenerated when needed
196 | #!**/[Pp]ackages/repositories.config
197 | # NuGet v3's project.json files produces more ignorable files
198 | *.nuget.props
199 | *.nuget.targets
200 |
201 | # Microsoft Azure Build Output
202 | csx/
203 | *.build.csdef
204 |
205 | # Microsoft Azure Emulator
206 | ecf/
207 | rcf/
208 |
209 | # Windows Store app package directories and files
210 | AppPackages/
211 | BundleArtifacts/
212 | Package.StoreAssociation.xml
213 | _pkginfo.txt
214 | *.appx
215 | *.appxbundle
216 | *.appxupload
217 |
218 | # Visual Studio cache files
219 | # files ending in .cache can be ignored
220 | *.[Cc]ache
221 | # but keep track of directories ending in .cache
222 | !?*.[Cc]ache/
223 |
224 | # Others
225 | ClientBin/
226 | ~$*
227 | *~
228 | *.dbmdl
229 | *.dbproj.schemaview
230 | *.jfm
231 | *.pfx
232 | *.publishsettings
233 | orleans.codegen.cs
234 |
235 | # Including strong name files can present a security risk
236 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
237 | #*.snk
238 |
239 | # Since there are multiple workflows, uncomment next line to ignore bower_components
240 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
241 | #bower_components/
242 |
243 | # RIA/Silverlight projects
244 | Generated_Code/
245 |
246 | # Backup & report files from converting an old project file
247 | # to a newer Visual Studio version. Backup files are not needed,
248 | # because we have git ;-)
249 | _UpgradeReport_Files/
250 | Backup*/
251 | UpgradeLog*.XML
252 | UpgradeLog*.htm
253 | ServiceFabricBackup/
254 | *.rptproj.bak
255 |
256 | # SQL Server files
257 | *.mdf
258 | *.ldf
259 | *.ndf
260 |
261 | # Business Intelligence projects
262 | *.rdl.data
263 | *.bim.layout
264 | *.bim_*.settings
265 | *.rptproj.rsuser
266 | *- [Bb]ackup.rdl
267 | *- [Bb]ackup ([0-9]).rdl
268 | *- [Bb]ackup ([0-9][0-9]).rdl
269 |
270 | # Microsoft Fakes
271 | FakesAssemblies/
272 |
273 | # GhostDoc plugin setting file
274 | *.GhostDoc.xml
275 |
276 | # Node.js Tools for Visual Studio
277 | .ntvs_analysis.dat
278 | node_modules/
279 |
280 | # Visual Studio 6 build log
281 | *.plg
282 |
283 | # Visual Studio 6 workspace options file
284 | *.opt
285 |
286 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
287 | *.vbw
288 |
289 | # Visual Studio LightSwitch build output
290 | **/*.HTMLClient/GeneratedArtifacts
291 | **/*.DesktopClient/GeneratedArtifacts
292 | **/*.DesktopClient/ModelManifest.xml
293 | **/*.Server/GeneratedArtifacts
294 | **/*.Server/ModelManifest.xml
295 | _Pvt_Extensions
296 |
297 | # Paket dependency manager
298 | .paket/paket.exe
299 | paket-files/
300 |
301 | # FAKE - F# Make
302 | .fake/
303 |
304 | # CodeRush personal settings
305 | .cr/personal
306 |
307 | # Python Tools for Visual Studio (PTVS)
308 | __pycache__/
309 | *.pyc
310 |
311 | # Cake - Uncomment if you are using it
312 | # tools/**
313 | # !tools/packages.config
314 |
315 | # Tabs Studio
316 | *.tss
317 |
318 | # Telerik's JustMock configuration file
319 | *.jmconfig
320 |
321 | # BizTalk build output
322 | *.btp.cs
323 | *.btm.cs
324 | *.odx.cs
325 | *.xsd.cs
326 |
327 | # OpenCover UI analysis results
328 | OpenCover/
329 |
330 | # Azure Stream Analytics local run output
331 | ASALocalRun/
332 |
333 | # MSBuild Binary and Structured Log
334 | *.binlog
335 |
336 | # NVidia Nsight GPU debugger configuration file
337 | *.nvuser
338 |
339 | # MFractors (Xamarin productivity tool) working folder
340 | .mfractor/
341 |
342 | # Local History for Visual Studio
343 | .localhistory/
344 |
345 | # BeatPulse healthcheck temp database
346 | healthchecksdb
347 |
348 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
349 | MigrationBackup/
350 |
351 | # Ionide (cross platform F# VS Code tools) working folder
352 | .ionide/
353 |
354 | # Common IntelliJ Platform excludes
355 |
356 | # Rider
357 | .idea
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | # Default settings:
7 | # A newline ending every file
8 | # Use 4 spaces as indentation
9 | [*]
10 | insert_final_newline = true
11 | indent_style = space
12 | indent_size = 4
13 | trim_trailing_whitespace = true
14 |
15 | [project.json]
16 | indent_size = 2
17 |
18 | # Generated code
19 | [*{_AssemblyInfo.cs,.notsupported.cs}]
20 | generated_code = true
21 |
22 | # C# files
23 | [*.cs]
24 | # New line preferences
25 | csharp_new_line_before_open_brace = all
26 | csharp_new_line_before_else = true
27 | csharp_new_line_before_catch = true
28 | csharp_new_line_before_finally = true
29 | csharp_new_line_before_members_in_object_initializers = true
30 | csharp_new_line_before_members_in_anonymous_types = true
31 | csharp_new_line_between_query_expression_clauses = true
32 |
33 | # Indentation preferences
34 | csharp_indent_block_contents = true
35 | csharp_indent_braces = false
36 | csharp_indent_case_contents = true
37 | csharp_indent_case_contents_when_block = true
38 | csharp_indent_switch_labels = true
39 | csharp_indent_labels = one_less_than_current
40 |
41 | # Modifier preferences
42 | csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
43 |
44 | # avoid this. unless absolutely necessary
45 | dotnet_style_qualification_for_field = false:suggestion
46 | dotnet_style_qualification_for_property = false:suggestion
47 | dotnet_style_qualification_for_method = false:suggestion
48 | dotnet_style_qualification_for_event = false:suggestion
49 |
50 | # Types: use keywords instead of BCL types, and permit var only when the type is clear
51 | csharp_style_var_for_built_in_types = false:suggestion
52 | csharp_style_var_when_type_is_apparent = false:none
53 | csharp_style_var_elsewhere = false:suggestion
54 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
55 | dotnet_style_predefined_type_for_member_access = true:suggestion
56 |
57 | # name all constant fields using PascalCase
58 | dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
59 | dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
60 | dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
61 | dotnet_naming_symbols.constant_fields.applicable_kinds = field
62 | dotnet_naming_symbols.constant_fields.required_modifiers = const
63 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case
64 |
65 | # internal and private fields should be _camelCase
66 | dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
67 | dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
68 | dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
69 | dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
70 | dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
71 | dotnet_naming_style.camel_case_underscore_style.required_prefix = _
72 | dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
73 |
74 | # Code style defaults
75 | csharp_using_directive_placement = outside_namespace:suggestion
76 | dotnet_sort_system_directives_first = true
77 | csharp_prefer_braces = false:silent
78 | csharp_preserve_single_line_blocks = true:none
79 | csharp_preserve_single_line_statements = false:none
80 | csharp_prefer_static_local_function = true:suggestion
81 | csharp_prefer_simple_using_statement = false:none
82 | csharp_style_prefer_switch_expression = true:suggestion
83 | dotnet_style_readonly_field = true:suggestion
84 |
85 | # Expression-level preferences
86 | dotnet_style_object_initializer = true:suggestion
87 | dotnet_style_collection_initializer = true:suggestion
88 | dotnet_style_explicit_tuple_names = true:suggestion
89 | dotnet_style_coalesce_expression = true:suggestion
90 | dotnet_style_null_propagation = true:suggestion
91 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
92 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
93 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
94 | dotnet_style_prefer_auto_properties = true:suggestion
95 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent
96 | dotnet_style_prefer_conditional_expression_over_return = true:silent
97 | csharp_prefer_simple_default_expression = true:suggestion
98 |
99 | # Expression-bodied members
100 | csharp_style_expression_bodied_methods = true:silent
101 | csharp_style_expression_bodied_constructors = true:silent
102 | csharp_style_expression_bodied_operators = true:silent
103 | csharp_style_expression_bodied_properties = true:silent
104 | csharp_style_expression_bodied_indexers = true:silent
105 | csharp_style_expression_bodied_accessors = true:silent
106 | csharp_style_expression_bodied_lambdas = true:silent
107 | csharp_style_expression_bodied_local_functions = true:silent
108 |
109 | # Pattern matching
110 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
111 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
112 | csharp_style_inlined_variable_declaration = true:suggestion
113 |
114 | # Null checking preferences
115 | csharp_style_throw_expression = true:suggestion
116 | csharp_style_conditional_delegate_call = true:suggestion
117 |
118 | # Other features
119 | csharp_style_prefer_index_operator = false:none
120 | csharp_style_prefer_range_operator = false:none
121 | csharp_style_pattern_local_over_anonymous_function = false:none
122 |
123 | # Space preferences
124 | csharp_space_after_cast = false
125 | csharp_space_after_colon_in_inheritance_clause = true
126 | csharp_space_after_comma = true
127 | csharp_space_after_dot = false
128 | csharp_space_after_keywords_in_control_flow_statements = true
129 | csharp_space_after_semicolon_in_for_statement = true
130 | csharp_space_around_binary_operators = before_and_after
131 | csharp_space_around_declaration_statements = do_not_ignore
132 | csharp_space_before_colon_in_inheritance_clause = true
133 | csharp_space_before_comma = false
134 | csharp_space_before_dot = false
135 | csharp_space_before_open_square_brackets = false
136 | csharp_space_before_semicolon_in_for_statement = false
137 | csharp_space_between_empty_square_brackets = false
138 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
139 | csharp_space_between_method_call_name_and_opening_parenthesis = false
140 | csharp_space_between_method_call_parameter_list_parentheses = false
141 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
142 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
143 | csharp_space_between_method_declaration_parameter_list_parentheses = false
144 | csharp_space_between_parentheses = false
145 | csharp_space_between_square_brackets = false
146 |
147 | # C++ Files
148 | [*.{cpp,h,in}]
149 | curly_bracket_next_line = true
150 | indent_brace_style = Allman
151 |
152 | # Xml project files
153 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
154 | indent_size = 2
155 |
156 | [*.{csproj,vbproj,proj,nativeproj,locproj}]
157 | charset = utf-8
158 |
159 | # Xml build files
160 | [*.builds]
161 | indent_size = 2
162 |
163 | # Xml files
164 | [*.{xml,stylecop,resx,ruleset}]
165 | indent_size = 2
166 |
167 | # Xml config files
168 | [*.{props,targets,config,nuspec}]
169 | indent_size = 2
170 |
171 | # YAML config files
172 | [*.{yml,yaml}]
173 | indent_size = 2
174 |
175 | # Shell scripts
176 | [*.sh]
177 | end_of_line = lf
178 |
179 | [*.{cmd,bat}]
180 | end_of_line = crlf
181 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Flow.Launcher.Plugin.Obsidian.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0-windows
5 | Flow.Launcher.Plugin.Obsidian
6 | Flow.Launcher.Plugin.Obsidian
7 | alexandre-v1
8 | https://github.com/alexandre-v1/Flow.Launcher.Plugin.Obsidian
9 | https://github.com/alexandre-v1/Flow.Launcher.Plugin.Obsidian
10 | flow-launcher flow-plugin
11 | true
12 | true
13 | false
14 | false
15 | enable
16 | Nullable
17 |
18 |
19 |
20 | false
21 | None
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | Always
31 |
32 |
33 | PreserveNewest
34 |
35 |
36 |
37 |
38 |
39 | MSBuild:Compile
40 | Wpf
41 | Designer
42 |
43 |
44 | MSBuild:Compile
45 | Wpf
46 | Designer
47 |
48 |
49 | MSBuild:Compile
50 | Wpf
51 | Designer
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Helpers/Font.cs:
--------------------------------------------------------------------------------
1 | namespace Flow.Launcher.Plugin.Obsidian.Helpers;
2 |
3 | public static class Font
4 | {
5 | public const string Family = "Segoe MDL2 Assets";
6 | public const string MarkedCheckBoxGlyph = "\uE73D";
7 | public const string CheckBoxGlyph = "\uE739";
8 | public const string OpenInNewTabGlyph = "\uE8A7";
9 | public const string ExcludeGlyph = "\uECC9";
10 | }
11 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Helpers/Paths.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Flow.Launcher.Plugin.Obsidian.Helpers;
4 |
5 | public static class Paths
6 | {
7 | public static readonly string ObsidianLogo = Path.Combine("Icons", "obsidian-logo.png");
8 |
9 | public static string GetCommunityPluginsJsonPath(string vaultPath)
10 | {
11 | return Path.Combine(vaultPath, ".obsidian", "community-plugins.json");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Helpers/ScrollViewerHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 |
6 | namespace Flow.Launcher.Plugin.Obsidian.Helpers;
7 |
8 | public static class ScrollViewerHelper
9 | {
10 | public static ScrollViewer? FindScrollViewer(DependencyObject element)
11 | {
12 | if (element is ScrollViewer scrollViewer) return scrollViewer;
13 |
14 | for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
15 | {
16 | ScrollViewer? result = FindScrollViewer(VisualTreeHelper.GetChild(element, i));
17 | if (result != null) return result;
18 | }
19 |
20 | return null;
21 | }
22 |
23 | public static void HandlePreviewMouseWheel(object sender, MouseWheelEventArgs e, UIElement element)
24 | {
25 | ScrollViewer? scrollViewer = FindScrollViewer(element);
26 | if (scrollViewer == null) return;
27 |
28 | bool isScrollingDown = e.Delta < 0;
29 | bool isScrollingUp = e.Delta > 0;
30 |
31 | if (!IsScrolledToBoundary(scrollViewer, isScrollingDown, isScrollingUp)) return;
32 |
33 | e.Handled = true;
34 | RaiseMouseWheelEventOnParent(e, element);
35 | }
36 |
37 | private static ScrollViewer? FindParentScrollViewer(DependencyObject element)
38 | {
39 | DependencyObject? parent = VisualTreeHelper.GetParent(element);
40 | while (parent != null)
41 | {
42 | if (parent is ScrollViewer scrollViewer) return scrollViewer;
43 | parent = VisualTreeHelper.GetParent(parent);
44 | }
45 |
46 | return null;
47 | }
48 |
49 | private static bool IsScrolledToBoundary(ScrollViewer scrollViewer, bool scrollingDown, bool scrollingUp)
50 | {
51 | bool atBottomBoundary = scrollingDown &&
52 | scrollViewer.VerticalOffset >= scrollViewer.ScrollableHeight;
53 | bool atTopBoundary = scrollingUp &&
54 | scrollViewer.VerticalOffset == 0;
55 |
56 | return atBottomBoundary || atTopBoundary;
57 | }
58 |
59 | private static void RaiseMouseWheelEventOnParent(MouseWheelEventArgs e, UIElement element)
60 | {
61 | MouseWheelEventArgs eventArg = new(e.MouseDevice, e.Timestamp, e.Delta)
62 | {
63 | RoutedEvent = UIElement.MouseWheelEvent
64 | };
65 | ScrollViewer? parentScrollViewer = FindParentScrollViewer(element);
66 | parentScrollViewer?.RaiseEvent(eventArg);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Icons/obsidian-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexandre-v1/Flow.Launcher.Plugin.Obsidian/bf23c21b62944e564853cd541474e505be688e38/Flow.Launcher.Plugin.Obsidian/Icons/obsidian-logo.png
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Main.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Windows.Controls;
4 | using Flow.Launcher.Plugin.Obsidian.Models;
5 | using Flow.Launcher.Plugin.Obsidian.Services;
6 | using Flow.Launcher.Plugin.Obsidian.Views;
7 | using ContextMenu = Flow.Launcher.Plugin.Obsidian.Services.ContextMenu;
8 |
9 | namespace Flow.Launcher.Plugin.Obsidian;
10 |
11 | public class Obsidian : IPlugin, ISettingProvider, IReloadable, IContextMenu
12 | {
13 | private IPublicAPI _publicApi = null!;
14 | private Settings _settings = null!;
15 | private IContextMenu _contextMenu = null!;
16 |
17 | public List LoadContextMenus(Result selectedResult) => _contextMenu.LoadContextMenus(selectedResult);
18 |
19 | public void Init(PluginInitContext context)
20 | {
21 | _publicApi = context.API;
22 | _settings = _publicApi.LoadSettingJsonStorage();
23 | _contextMenu = new ContextMenu(this, _settings);
24 | ReloadData();
25 | }
26 |
27 | public List Query(Query query)
28 | {
29 | string search = query.Search.Trim();
30 | List results = new();
31 | if (string.IsNullOrEmpty(search))
32 | return results;
33 |
34 | if (NoteCreatorService.IsCreateNewNoteQuery(search))
35 | {
36 | results = NoteCreatorService.CreateNewNoteResultsWithVaults(query).ToList();
37 | return results;
38 | }
39 |
40 | List files = VaultManager.GetAllFiles();
41 | results = SearchService.GetSearchResults(files, search, _settings);
42 | if (_settings.MaxResult > 0)
43 | results = SearchService.SortAndTruncateResults(results, _settings.MaxResult);
44 |
45 | if (_settings.AddCreateNoteOptionOnAllSearch)
46 | results.Add(NoteCreatorService.CreateNewNoteResult(query, _publicApi));
47 |
48 | return results;
49 | }
50 |
51 | public void ReloadData() => VaultManager.UpdateVaultList(_settings);
52 |
53 | public Control CreateSettingPanel() => new SettingsView(_settings, this);
54 | }
55 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Models/File.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 | using Flow.Launcher.Plugin.Obsidian.Helpers;
4 | using Flow.Launcher.Plugin.Obsidian.Services;
5 |
6 | namespace Flow.Launcher.Plugin.Obsidian.Models;
7 |
8 | public class File : Result
9 | {
10 | public readonly string Name;
11 | public readonly string FilePath;
12 | public readonly string Extension;
13 | public readonly string RelativePath;
14 | public readonly string[]? Aliases;
15 | public readonly string VaultId;
16 |
17 | public File(Vault vault, string path, string[]? alias)
18 | {
19 | Name = Path.GetFileNameWithoutExtension(path);
20 | FilePath = path;
21 | Extension = Path.GetExtension(path);
22 | RelativePath = path.Replace(vault.VaultPath, "").TrimStart('\\');
23 | SubTitle = Path.Combine(vault.Name, RelativePath);
24 | CopyText = FilePath;
25 | Action = _ =>
26 | {
27 | if (vault.OpenNoteInNewTabByDefault(vault.VaultSetting))
28 | {
29 | OpenNoteInNewTab();
30 | }
31 | else
32 | {
33 | OpenNote();
34 | }
35 | return true;
36 | };
37 | VaultId = vault.Id;
38 | IcoPath = Paths.ObsidianLogo;
39 | Aliases = alias;
40 | }
41 |
42 | private void OpenNote()
43 | {
44 | Vault? vault = VaultManager.GetVaultWithId(VaultId);
45 | if (vault == null) return;
46 |
47 | string uri = UriService.GetOpenNoteUri(vault.Name, RelativePath);
48 | Process.Start(new ProcessStartInfo { FileName = uri, UseShellExecute = true });
49 | }
50 |
51 | public void OpenNoteInNewTab()
52 | {
53 | Vault? vault = VaultManager.GetVaultWithId(VaultId);
54 | if (vault is null) return;
55 |
56 | string uri = UriService.GetOpenNoteInNewTabUri(vault.Name, RelativePath);
57 | Process.Start(new ProcessStartInfo { FileName = uri, UseShellExecute = true });
58 | }
59 |
60 | public Vault? GetVault() => VaultManager.GetVaultWithId(VaultId);
61 | }
62 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Models/GlobalVaultSetting.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace Flow.Launcher.Plugin.Obsidian.Models;
5 |
6 | public class GlobalVaultSetting
7 | {
8 | private static readonly List DefaultsExcludedPaths = new() { ".trash", ".obsidian" };
9 |
10 | public bool OpenInNewTabByDefault { get; set; } = true;
11 | public bool SearchMarkdown { get; set; } = true;
12 | public bool SearchCanvas { get; set; } = true;
13 | public bool SearchImages { get; set; }
14 | public bool SearchExcalidraw { get; set; } = true;
15 | public bool SearchOther { get; set; }
16 | public bool SearchContent { get; set; }
17 |
18 | public ObservableCollection ExcludedPaths { get; set; } = new(DefaultsExcludedPaths);
19 |
20 |
21 | public virtual HashSet GetSearchableExtensions(Settings settings)
22 | {
23 | HashSet searchPattern = new();
24 | if (SearchMarkdown)
25 | searchPattern.Add(".md");
26 | if (SearchCanvas)
27 | searchPattern.Add(".canvas");
28 | if (SearchImages)
29 | {
30 | searchPattern.Add(".png");
31 | searchPattern.Add(".jpg");
32 | searchPattern.Add(".jpeg");
33 | searchPattern.Add(".gif");
34 | searchPattern.Add(".bmp");
35 | }
36 | if (SearchExcalidraw)
37 | searchPattern.Add(".excalidraw");
38 | if (SearchOther)
39 | {
40 | searchPattern.Add(".json");
41 | searchPattern.Add(".csv");
42 | }
43 |
44 | return searchPattern;
45 | }
46 |
47 | public virtual List GetExcludedPaths(Settings settings) => new(ExcludedPaths);
48 | }
49 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Models/Settings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Flow.Launcher.Plugin.Obsidian.Models;
4 |
5 | public class Settings
6 | {
7 | public int MaxResult { get; set; }
8 | public bool UseAliases { get; set; } = true;
9 | public bool UseFilesExtension { get; set; }
10 | public bool AddCheckBoxesToContext { get; set; } = true;
11 | public bool AddGlobalFolderExcludeToContext { get; set; } = true;
12 | public bool AddLocalFolderExcludeToContext { get; set; }
13 | public bool AddCreateNoteOptionOnAllSearch { get; set; } = true;
14 |
15 | // Keep setters to allow JSON deserialization
16 | public GlobalVaultSetting GlobalVaultSetting { get; set; } = new();
17 | public Dictionary VaultsSetting { get; set; } = new();
18 | }
19 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Models/Vault.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using Flow.Launcher.Plugin.Obsidian.Services;
6 |
7 | namespace Flow.Launcher.Plugin.Obsidian.Models;
8 |
9 | public class Vault
10 | {
11 | public readonly string Id;
12 | public readonly string Name;
13 | public readonly string VaultPath;
14 |
15 | public readonly VaultSetting VaultSetting;
16 | public List Files { get; private set; }
17 | public bool HasAdvancedUri { get; set; }
18 |
19 | public Vault(string id, string vaultPath, VaultSetting vaultSetting, Settings settings)
20 | {
21 | Id = id;
22 | VaultPath = vaultPath;
23 | VaultSetting = vaultSetting;
24 | Name = Path.GetFileName(VaultPath);
25 | Files = GetFiles(settings);
26 | HasAdvancedUri = PluginsDetectionService.IsObsidianAdvancedUriPluginInstalled(VaultPath);
27 | if (!HasAdvancedUri) VaultSetting.OpenInNewTabByDefault = false;
28 | }
29 |
30 | public bool OpenNoteInNewTabByDefault(GlobalVaultSetting globalSetting)
31 | {
32 | if (!HasAdvancedUri) return false;
33 | return VaultSetting.UseGlobalSetting ? globalSetting.OpenInNewTabByDefault : VaultSetting.OpenInNewTabByDefault;
34 | }
35 |
36 | private List GetFiles(Settings settings)
37 | {
38 | bool useAliases = settings.UseAliases;
39 |
40 | HashSet extensions = VaultSetting.GetSearchableExtensions(settings);
41 | List excludedPaths = VaultSetting.GetExcludedPaths(settings)
42 | .Select(excludedPath => Path.Combine(VaultPath, excludedPath))
43 | .ToList();
44 |
45 | List files = Directory.EnumerateFiles(VaultPath, "*", SearchOption.AllDirectories)
46 | .AsParallel()
47 | .WithDegreeOfParallelism(Environment.ProcessorCount)
48 | .Where(file => extensions.Contains(Path.GetExtension(file))
49 | && !excludedPaths.Any(file.StartsWith))
50 | .Select(filePath =>
51 | {
52 | string[]? aliases = null;
53 | if (!useAliases) return new File(this, filePath, aliases);
54 | aliases = AliasesService.GetAliases(filePath);
55 | return new File(this, filePath, aliases);
56 | })
57 | .ToList();
58 |
59 | return files;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Models/VaultSetting.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Flow.Launcher.Plugin.Obsidian.Models;
4 |
5 | public class VaultSetting : GlobalVaultSetting
6 | {
7 | public bool UseGlobalSetting { get; set; } = true;
8 | public bool UseGlobalExcludedPaths { get; set; } = true;
9 |
10 | public override HashSet GetSearchableExtensions(Settings settings) =>
11 | UseGlobalSetting
12 | ? settings.GlobalVaultSetting.GetSearchableExtensions(settings)
13 | : base.GetSearchableExtensions(settings);
14 |
15 | public override List GetExcludedPaths(Settings settings)
16 | {
17 | List excludedPaths = new();
18 | if (UseGlobalExcludedPaths)
19 | excludedPaths.AddRange(settings.GlobalVaultSetting.GetExcludedPaths(settings));
20 | excludedPaths.AddRange(base.GetExcludedPaths(settings));
21 | return excludedPaths;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/AliasesService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 |
5 | namespace Flow.Launcher.Plugin.Obsidian.Services;
6 |
7 | public static class AliasesService
8 | {
9 | private const string YamlFrontMatterDelimiter = "---";
10 | private const string AliasesKey = "aliases:";
11 | private const int AliasesKeyLength = 8;
12 |
13 | public static string[]? GetAliases(string filePath)
14 | {
15 | using StreamReader reader = new(filePath);
16 | if (reader.ReadLine()?.Trim() is not YamlFrontMatterDelimiter) return null;
17 |
18 | bool inAliases = false;
19 | var aliases = new List();
20 |
21 | while (reader.ReadLine() is { } line)
22 | {
23 | line = line.Trim();
24 | if (line is YamlFrontMatterDelimiter) break;
25 |
26 | if (line.StartsWith(AliasesKey))
27 | {
28 | inAliases = true;
29 | ParseAliasLine(line[AliasesKeyLength..].Trim(), aliases);
30 | continue;
31 | }
32 |
33 | if (!inAliases) continue;
34 | if (line.StartsWith('-'))
35 | {
36 | aliases.Add(line[1..].Trim().Trim('"'));
37 | }
38 | else if (line.Contains(':'))
39 | {
40 | break;
41 | }
42 | else
43 | {
44 | ParseAliasLine(line.Trim(), aliases);
45 | }
46 | }
47 |
48 | return aliases.Count > 0 ? aliases.ToArray() : null;
49 | }
50 |
51 |
52 | private static void ParseAliasLine(string value, List aliases)
53 | {
54 | if (value.StartsWith('['))
55 | {
56 | string[] entries = value.TrimStart('[').TrimEnd(']').Split(',');
57 | aliases.AddRange(entries.Select(entry => entry.Trim().Trim('"')));
58 | }
59 | else if (!string.IsNullOrWhiteSpace(value))
60 | {
61 | aliases.Add(value.Trim('"'));
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/CheckBoxService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Flow.Launcher.Plugin.Obsidian.Helpers;
3 | using Flow.Launcher.Plugin.Obsidian.Models;
4 |
5 | namespace Flow.Launcher.Plugin.Obsidian.Services;
6 |
7 | public static class CheckBoxService
8 | {
9 | private const string MarkedCheckBox = "- [x] ";
10 | private const string CheckBox = "- [ ] ";
11 |
12 | public static List GetCheckBoxes(this File file)
13 | {
14 | string path = file.FilePath;
15 | List checkBoxes = new();
16 | string[] lines = System.IO.File.ReadAllLines(path);
17 |
18 | string prevLine = string.Empty;
19 | foreach (string line in lines)
20 | {
21 | string title;
22 | bool isChecked;
23 |
24 | if (line.Contains(MarkedCheckBox))
25 | {
26 | isChecked = true;
27 | title = line.Replace(MarkedCheckBox, "");
28 | }
29 | else if (line.Contains(CheckBox))
30 | {
31 | title = line.Replace(CheckBox, "");
32 | isChecked = false;
33 | }
34 | else
35 | {
36 | if (line.Length > 0)
37 | prevLine = line;
38 | continue;
39 | }
40 |
41 | string subTitle = string.Empty;
42 | string trim = prevLine.Trim();
43 | if (trim.EndsWith(":")) subTitle = trim[..^1];
44 |
45 | Result item = new()
46 | {
47 | Glyph = new GlyphInfo(Font.Family, isChecked ? Font.MarkedCheckBoxGlyph : Font.CheckBoxGlyph),
48 | Title = title.Trim(),
49 | SubTitle = subTitle,
50 | Action = _ =>
51 | {
52 | file.TryToggleCheckBox(line, isChecked);
53 | return false;
54 | }
55 | };
56 | checkBoxes.Add(item);
57 | }
58 |
59 | return checkBoxes;
60 | }
61 |
62 | private static void TryToggleCheckBox(this File file, string checkBoxLine, bool isChecked)
63 | {
64 | string filePath = file.FilePath;
65 | string[] lines = System.IO.File.ReadAllLines(filePath);
66 |
67 | for (int i = 0; i < lines.Length; i++)
68 | {
69 | if (!lines[i].Contains(checkBoxLine)) continue;
70 |
71 | if (isChecked)
72 | lines[i] = lines[i].Replace(MarkedCheckBox, CheckBox);
73 | else
74 | lines[i] = lines[i].Replace(CheckBox, MarkedCheckBox);
75 | break;
76 | }
77 |
78 | System.IO.File.WriteAllLines(filePath, lines);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/ContextMenu.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using Flow.Launcher.Plugin.Obsidian.Helpers;
4 | using Flow.Launcher.Plugin.Obsidian.Models;
5 |
6 | namespace Flow.Launcher.Plugin.Obsidian.Services;
7 |
8 | public class ContextMenu : IContextMenu
9 | {
10 | private readonly Obsidian _obsidian;
11 | private readonly Settings _settings;
12 |
13 | public ContextMenu(Obsidian obsidian, Settings settings)
14 | {
15 | _obsidian = obsidian;
16 | _settings = settings;
17 | }
18 |
19 | private static Result OpenInNewTabResult(File file) => new()
20 | {
21 | Title = "Open in new tab",
22 | Glyph = new GlyphInfo(Font.Family, Font.OpenInNewTabGlyph),
23 | Action = _ =>
24 | {
25 | file.OpenNoteInNewTab();
26 | return true;
27 | }
28 | };
29 |
30 | private List ExcludeResults(string relativePath, string? vaultId)
31 | {
32 | List results = new();
33 | string[] parts = relativePath.Split('\\');
34 | for (int i = 0; i < parts.Length - 1; i++)
35 | {
36 | string directory = string.Join("\\", parts.Take(i + 1));
37 | if (_settings.AddGlobalFolderExcludeToContext)
38 | results.Add(ExcludeGlobalFolderResult(directory));
39 | if (_settings.AddLocalFolderExcludeToContext)
40 | results.Add(ExcludeLocalFolderResult(directory, vaultId));
41 | }
42 |
43 | return results;
44 | }
45 |
46 | private Result ExcludeGlobalFolderResult(string folder) =>
47 | new()
48 | {
49 | Title = $"Exclude {folder} folder globally",
50 | Action = _ => ExcludeGlobalFolder(folder),
51 | Glyph = new GlyphInfo(Font.Family, Font.ExcludeGlyph)
52 | };
53 |
54 | private Result ExcludeLocalFolderResult(string folder, string? vaultId) =>
55 | new()
56 | {
57 | Title = $"Exclude {folder} folder locally",
58 | Action = _ => TryToExcludeLocalFolder(folder, vaultId),
59 | Glyph = new GlyphInfo(Font.Family, Font.ExcludeGlyph)
60 | };
61 |
62 | private bool ExcludeGlobalFolder(string folder)
63 | {
64 | _settings.GlobalVaultSetting.ExcludedPaths.Add(folder);
65 | _obsidian.ReloadData();
66 | return true;
67 | }
68 |
69 | private bool TryToExcludeLocalFolder(string folder, string? vaultId)
70 | {
71 | if (vaultId is null) return false;
72 | Vault? vault = VaultManager.GetVaultWithId(vaultId);
73 | if (vault is null) return false;
74 | vault.VaultSetting.ExcludedPaths.Add(folder);
75 | _obsidian.ReloadData();
76 | return true;
77 | }
78 |
79 | public List LoadContextMenus(Result selectedResult)
80 | {
81 | if (selectedResult is not File file) return new List();
82 | string path = file.RelativePath;
83 |
84 | List results = new();
85 | Vault? vault = file.GetVault();
86 | if (vault is null) return results;
87 | if (vault.HasAdvancedUri)
88 | {
89 | if (!vault.OpenNoteInNewTabByDefault(_settings.GlobalVaultSetting))
90 | {
91 | results.Add(OpenInNewTabResult(file));
92 | }
93 | }
94 |
95 | if (_settings.AddCheckBoxesToContext)
96 | results.AddRange(file.GetCheckBoxes());
97 | if (_settings.AddGlobalFolderExcludeToContext || _settings.AddLocalFolderExcludeToContext)
98 | results.AddRange(ExcludeResults(path, file.VaultId));
99 | return results;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/NoteCreatorService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics;
3 | using System.Linq;
4 | using Flow.Launcher.Plugin.Obsidian.Helpers;
5 | using Flow.Launcher.Plugin.Obsidian.Models;
6 |
7 | namespace Flow.Launcher.Plugin.Obsidian.Services;
8 |
9 | public static class NoteCreatorService
10 | {
11 | private static string NoteCreatorKeyword { get; set; } = "create";
12 |
13 | public static Result CreateNewNoteResult(Query query, IPublicAPI publicApi)
14 | {
15 | string search = query.Search;
16 | return new Result
17 | {
18 | Title = $"Create new note \"{search}\"",
19 | IcoPath = Paths.ObsidianLogo,
20 | Action = _ =>
21 | {
22 | if (VaultManager.HasOnlyOneVault)
23 | {
24 | CreateNewNote(VaultManager.Vaults[0], search);
25 | return true;
26 | }
27 |
28 | publicApi.ChangeQuery($"{query.ActionKeyword} {NoteCreatorKeyword} {search}", true);
29 | return false;
30 | }
31 | };
32 | }
33 |
34 | public static IEnumerable CreateNewNoteResultsWithVaults(Query query)
35 | {
36 | string search = RemoveNoteCreatorKeyword(query.Search);
37 | var select = VaultManager.Vaults.Select(
38 | vault => CreateNewNoteResultWithVault(search, vault));
39 | return select;
40 | }
41 |
42 | private static string RemoveNoteCreatorKeyword(string search)
43 | {
44 | return search.Replace(NoteCreatorKeyword, "").Trim();
45 | }
46 |
47 | private static Result CreateNewNoteResultWithVault(string search, Vault vault)
48 | {
49 | return new Result
50 | {
51 | Title = $"Create new note \"{search}\" in {vault.Name}",
52 | IcoPath = Paths.ObsidianLogo,
53 | Action = _ =>
54 | {
55 | CreateNewNote(vault, search);
56 | return true;
57 | }
58 | };
59 | }
60 |
61 | private static void CreateNewNote(Vault vault, string noteName)
62 | {
63 | string uri = UriService.GetCreateNoteUri(vault.Name, noteName);
64 | Process.Start(new ProcessStartInfo { FileName = uri, UseShellExecute = true });
65 | }
66 |
67 | public static bool IsCreateNewNoteQuery(string search)
68 | {
69 | return search.StartsWith(NoteCreatorKeyword);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/PluginsDetectionService.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using Flow.Launcher.Plugin.Obsidian.Helpers;
3 |
4 | namespace Flow.Launcher.Plugin.Obsidian.Services;
5 |
6 | public static class PluginsDetectionService
7 | {
8 | private const string AdvancedUriPluginName = "obsidian-advanced-uri";
9 |
10 | public static bool IsObsidianAdvancedUriPluginInstalled(string vaultPath)
11 | {
12 | string pluginsJsonPath = Paths.GetCommunityPluginsJsonPath(vaultPath);
13 | if (!File.Exists(pluginsJsonPath)) return false;
14 | string json = File.ReadAllText(pluginsJsonPath);
15 | return json.Contains(AdvancedUriPluginName);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/SearchService.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Concurrent;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text.RegularExpressions;
5 | using System.Threading.Tasks;
6 | using Flow.Launcher.Plugin.Obsidian.Models;
7 | using Flow.Launcher.Plugin.Obsidian.Utilities;
8 |
9 | namespace Flow.Launcher.Plugin.Obsidian.Services;
10 |
11 | public static class SearchService
12 | {
13 | public static List GetSearchResults(List files, string search, Settings settings)
14 | {
15 | ConcurrentBag results = new();
16 | string searchLower = search.ToLower();
17 | string pattern = $@"[_\s\-\.]{Regex.Escape(searchLower)}";
18 |
19 | Parallel.ForEach(files, file =>
20 | {
21 | int maxScore = CalculateScore(file.Name, searchLower, pattern);
22 | string bestMatchTitle = file.Name;
23 |
24 | if (settings.UseAliases && file.Aliases != null)
25 | foreach (string alias in file.Aliases)
26 | {
27 | int score = CalculateScore(alias, searchLower, pattern);
28 |
29 | if (score <= maxScore) continue;
30 | maxScore = score;
31 | bestMatchTitle = alias;
32 | if (score == 100) break;
33 | }
34 |
35 | if (maxScore <= 0) return;
36 | file.Score = maxScore;
37 | file.Title = bestMatchTitle;
38 | if (settings.UseFilesExtension)
39 | file.Title += file.Extension;
40 | results.Add(file);
41 | });
42 |
43 | return results.ToList();
44 | }
45 |
46 | public static List SortAndTruncateResults(List results, int maxResult)
47 | {
48 | return results.OrderByDescending(result => result.Score).Take(maxResult).ToList();
49 | }
50 |
51 | private static int CalculateScore(string name, string searchLower, string pattern)
52 | {
53 | int score = 0;
54 | string fileTitleLower = name.ToLower();
55 |
56 | if (fileTitleLower == searchLower) return 100;
57 |
58 | int distance = StringMatcher.CalculateLevenshteinDistance(fileTitleLower, searchLower);
59 |
60 | if (fileTitleLower.StartsWith(searchLower))
61 | {
62 | score = 80;
63 | }
64 | else if (fileTitleLower.Contains(searchLower))
65 | {
66 | score = 50;
67 | if (Regex.IsMatch(fileTitleLower, pattern)) // Preceded by special char
68 | score += 20;
69 | }
70 | else
71 | {
72 | return score;
73 | }
74 |
75 | score += 2 - distance;
76 | return score;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/UriService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Flow.Launcher.Plugin.Obsidian.Services;
4 |
5 | public static class UriService
6 | {
7 | public static string GetOpenNoteUri(string vaultName, string relativePath)
8 | {
9 | string eVaultName = Uri.EscapeDataString(vaultName);
10 | string eRelativePath = Uri.EscapeDataString(relativePath);
11 | return $"obsidian://open?vault={eVaultName}&file={eRelativePath}";
12 | }
13 |
14 | public static string GetCreateNoteUri(string vaultName, string fileName)
15 | {
16 | string eVaultName = Uri.EscapeDataString(vaultName);
17 | string eFileName = Uri.EscapeDataString(fileName);
18 | return $"obsidian://new?vault={eVaultName}&name={eFileName}";
19 | }
20 |
21 | public static string GetOpenNoteInNewTabUri(string vaultName, string relativePath)
22 | {
23 | string eVaultName = Uri.EscapeDataString(vaultName);
24 | string eRelativePath = Uri.EscapeDataString(relativePath);
25 | return $"obsidian://adv-uri?vault={eVaultName}&filepath={eRelativePath}&openmode=true";
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Services/VaultManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text.Json;
6 | using Flow.Launcher.Plugin.Obsidian.Models;
7 | using File = Flow.Launcher.Plugin.Obsidian.Models.File;
8 |
9 | namespace Flow.Launcher.Plugin.Obsidian.Services;
10 |
11 | public static class VaultManager
12 | {
13 | public static bool HasOnlyOneVault => Vaults.Count == 1;
14 | public static bool OneVaultHasAdvancedUri => Vaults.Any(vault => vault.HasAdvancedUri);
15 | public static bool AllVaultsHaveAdvancedUri => Vaults.All(vault => vault.HasAdvancedUri);
16 | public static List Vaults { get; private set; } = new();
17 |
18 | private static readonly string VaultListJsonPath =
19 | Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "obsidian", "obsidian.json");
20 |
21 | public static void UpdateVaultList(Settings settings)
22 | {
23 | Vaults = new List();
24 | string jsonString = System.IO.File.ReadAllText(VaultListJsonPath);
25 | using JsonDocument document = JsonDocument.Parse(jsonString);
26 |
27 | JsonElement root = document.RootElement;
28 | JsonElement vaults = root.GetProperty("vaults");
29 |
30 |
31 | foreach (JsonProperty vault in vaults.EnumerateObject())
32 | {
33 | string vaultId = vault.Name;
34 | string? path = vault.Value.GetProperty("path").GetString();
35 | if (path is null) continue;
36 |
37 | settings.VaultsSetting.TryGetValue(vaultId, out VaultSetting? vaultSetting);
38 | if (vaultSetting is null)
39 | {
40 | vaultSetting = new VaultSetting();
41 | settings.VaultsSetting.Add(vaultId, vaultSetting);
42 | }
43 |
44 | Vaults.Add(new Vault(vaultId, path, vaultSetting, settings));
45 | }
46 |
47 | if (!OneVaultHasAdvancedUri)
48 | {
49 | settings.GlobalVaultSetting.OpenInNewTabByDefault = false;
50 | }
51 | }
52 |
53 | public static List GetAllFiles()
54 | {
55 | List files = new();
56 | foreach (Vault vault in Vaults) files.AddRange(vault.Files);
57 | return files;
58 | }
59 |
60 | public static Vault? GetVaultWithId(string vaultId) => Vaults.Find(vault => vault.Id == vaultId);
61 |
62 | public static Vault? GetVaultWithName(string name)
63 | {
64 | Vault? vault = Vaults.Find(vault => vault.Name == name);
65 | return vault;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Utilities/StringMatcher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Flow.Launcher.Plugin.Obsidian.Models;
5 |
6 | namespace Flow.Launcher.Plugin.Obsidian.Utilities;
7 |
8 | public static class StringMatcher
9 | {
10 | public static List<(File File, int Distance)> FindClosestMatches(List sourceList, string searchTerm,
11 | int maxDistance = 3) =>
12 | sourceList
13 | .Select(file => (
14 | Text: file,
15 | Distance: CalculateLevenshteinDistance(file.Title.ToLower(), searchTerm.ToLower())
16 | ))
17 | .Where(result => result.Distance <= maxDistance)
18 | .OrderBy(result => result.Distance)
19 | .ToList();
20 |
21 | public static int CalculateLevenshteinDistance(string source, string target)
22 | {
23 | if (string.IsNullOrEmpty(source))
24 | return string.IsNullOrEmpty(target) ? 0 : target.Length;
25 |
26 | if (string.IsNullOrEmpty(target))
27 | return source.Length;
28 |
29 | int[,] matrix = new int[source.Length + 1, target.Length + 1];
30 |
31 | for (int i = 0; i <= source.Length; i++)
32 | matrix[i, 0] = i;
33 |
34 | for (int j = 0; j <= target.Length; j++)
35 | matrix[0, j] = j;
36 |
37 | for (int i = 1; i <= source.Length; i++)
38 | for (int j = 1; j <= target.Length; j++)
39 | {
40 | int cost = source[i - 1] == target[j - 1] ? 0 : 1;
41 | matrix[i, j] = Math.Min(
42 | Math.Min(matrix[i - 1, j] + 1, matrix[i, j - 1] + 1),
43 | matrix[i - 1, j - 1] + cost
44 | );
45 | }
46 |
47 | return matrix[source.Length, target.Length];
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Views/GlobalVaultSettingView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
26 |
32 |
38 |
44 |
50 |
56 |
57 |
58 |
62 |
70 |
71 |
72 |
73 |
79 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Views/GlobalVaultSettingView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Data;
6 | using System.Windows.Input;
7 | using Flow.Launcher.Plugin.Obsidian.Helpers;
8 | using Flow.Launcher.Plugin.Obsidian.Models;
9 | using Flow.Launcher.Plugin.Obsidian.Services;
10 |
11 | namespace Flow.Launcher.Plugin.Obsidian.Views;
12 |
13 | public partial class GlobalVaultSettingView : INotifyPropertyChanged
14 | {
15 | public Vault? Vault { get; }
16 | public GlobalVaultSetting GlobalVaultSetting { get; set; }
17 |
18 | public Visibility GlobalSettingVisibility
19 | {
20 | get => _globalSettingVisibility;
21 | set
22 | {
23 | if (_globalSettingVisibility == value) return;
24 | _globalSettingVisibility = value;
25 | OnPropertyChanged();
26 | }
27 | }
28 |
29 | private Visibility _globalSettingVisibility = Visibility.Visible;
30 |
31 | public GlobalVaultSettingView(Settings settings)
32 | {
33 | GlobalVaultSetting = settings.GlobalVaultSetting;
34 | InitializeComponent();
35 | DataContext = this;
36 | }
37 |
38 | public GlobalVaultSettingView(Vault vault)
39 | {
40 | Vault = vault;
41 | GlobalVaultSetting = vault.VaultSetting;
42 | InitializeComponent();
43 | DataContext = this;
44 | }
45 |
46 | private void GlobalVaultSettingViewOnLoaded(object sender, RoutedEventArgs e)
47 | {
48 | SetupOpenInNewTabDefault();
49 | SetupCheckboxes();
50 | }
51 |
52 | private void SetupOpenInNewTabDefault()
53 | {
54 | OpenInNewTabByDefault.IsChecked = GlobalVaultSetting.OpenInNewTabByDefault;
55 | OpenInNewTabByDefault.Checked += (_, _) => GlobalVaultSetting.OpenInNewTabByDefault = true;
56 | OpenInNewTabByDefault.Unchecked += (_, _) => GlobalVaultSetting.OpenInNewTabByDefault = false;
57 | BindingOperations.SetBinding(OpenInNewTabByDefault, VisibilityProperty, new Binding("GlobalSettingVisibility"));
58 |
59 | bool hasAdvancedUri = Vault?.HasAdvancedUri ?? VaultManager.OneVaultHasAdvancedUri;
60 | if (!hasAdvancedUri)
61 | {
62 | OpenInNewTabByDefault.IsEnabled = false;
63 | OpenInNewTabByDefault.ToolTip = "This option requires the Obsidian Advanced URI plugin in your vault";
64 | ToolTipService.SetShowOnDisabled(OpenInNewTabByDefault, true);
65 | }
66 | else if (Vault is null && !VaultManager.AllVaultsHaveAdvancedUri)
67 | {
68 | OpenInNewTabByDefault.ToolTip = "This option will be active only in vault with the Obsidian Advanced URI plugin";
69 | }
70 | }
71 |
72 | private void SetupCheckboxes()
73 | {
74 | SetupCheckbox(SearchMarkdown, nameof(GlobalVaultSetting.SearchMarkdown));
75 | SetupCheckbox(SearchCanvas, nameof(GlobalVaultSetting.SearchCanvas));
76 | SetupCheckbox(SearchImages, nameof(GlobalVaultSetting.SearchImages));
77 | SetupCheckbox(SearchExcalidraw, nameof(GlobalVaultSetting.SearchExcalidraw));
78 | SetupCheckbox(SearchOther, nameof(GlobalVaultSetting.SearchOther));
79 | }
80 |
81 | private void SetupCheckbox(CheckBox checkBox, string propertyName)
82 | {
83 | checkBox.IsChecked = (bool)GlobalVaultSetting.GetType().GetProperty(propertyName)!.GetValue(GlobalVaultSetting)!;
84 | checkBox.Checked += (_, _) => GlobalVaultSetting.GetType().GetProperty(propertyName)!.SetValue(GlobalVaultSetting, true);
85 | checkBox.Unchecked += (_, _) => GlobalVaultSetting.GetType().GetProperty(propertyName)!.SetValue(GlobalVaultSetting, false);
86 | BindingOperations.SetBinding(checkBox, VisibilityProperty, new Binding("GlobalSettingVisibility"));
87 | }
88 |
89 | private void AddExcludePath_Click(object sender, RoutedEventArgs e)
90 | {
91 | if (string.IsNullOrWhiteSpace(NewExcludePathText.Text)) return;
92 | GlobalVaultSetting.ExcludedPaths.Add(NewExcludePathText.Text);
93 | NewExcludePathText.Clear();
94 |
95 | ScrollViewer? scrollViewer = ScrollViewerHelper.FindScrollViewer(ExcludedPathsListBox);
96 | scrollViewer?.ScrollToBottom();
97 | }
98 |
99 | private void RemoveExcludePath_Click(object sender, RoutedEventArgs e)
100 | {
101 | Button? button = sender as Button;
102 | if (button?.DataContext is not string path) return;
103 | GlobalVaultSetting.ExcludedPaths.Remove(path);
104 | }
105 |
106 | private void OnPropertyChanged([CallerMemberName] string? propertyName = null) =>
107 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
108 |
109 | private void HandlePreviewMouseWheel(object sender, MouseWheelEventArgs e) =>
110 | ScrollViewerHelper.HandlePreviewMouseWheel(sender, e, ExcludedPathsListBox);
111 |
112 | public event PropertyChangedEventHandler? PropertyChanged;
113 | }
114 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Views/SettingsView.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
37 |
38 |
39 |
43 |
44 |
48 |
49 |
50 |
51 |
57 |
63 |
69 |
70 |
77 |
83 |
89 |
95 |
96 |
103 |
104 |
105 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Views/SettingsView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Linq;
3 | using System.Runtime.CompilerServices;
4 | using System.Windows;
5 | using Flow.Launcher.Plugin.Obsidian.Models;
6 | using Flow.Launcher.Plugin.Obsidian.Services;
7 |
8 | namespace Flow.Launcher.Plugin.Obsidian.Views;
9 |
10 | public partial class SettingsView : INotifyPropertyChanged
11 | {
12 | public int MaxResults
13 | {
14 | get => _maxResults;
15 | set
16 | {
17 | if (_maxResults == value) return;
18 | _maxResults = value;
19 | Settings.MaxResult = value;
20 | OnPropertyChanged();
21 | }
22 | }
23 |
24 | private Obsidian Obsidian { get; }
25 | private Settings Settings { get; }
26 | private int _maxResults;
27 |
28 | public SettingsView(Settings settings, Obsidian obsidian)
29 | {
30 | Obsidian = obsidian;
31 | Settings = settings;
32 | InitializeComponent();
33 | CreateVaultSettingControls(settings);
34 | }
35 |
36 | private void SettingsView_OnLoaded(object sender, RoutedEventArgs e)
37 | {
38 | MaxResults = Settings.MaxResult;
39 | UseAliases.IsChecked = Settings.UseAliases;
40 | UseFileExtension.IsChecked = Settings.UseFilesExtension;
41 | AddGlobalFolderExcludeToContext.IsChecked = Settings.AddGlobalFolderExcludeToContext;
42 | AddLocalFolderExcludeToContext.IsChecked = Settings.AddLocalFolderExcludeToContext;
43 | AddCheckBoxesToContext.IsChecked = Settings.AddCheckBoxesToContext;
44 | AddCreateNoteOptionOnAllSearch.IsChecked = Settings.AddCreateNoteOptionOnAllSearch;
45 |
46 | UseAliases.Checked += (_, _) => { Settings.UseAliases = true; };
47 | UseAliases.Unchecked += (_, _) => { Settings.UseAliases = false; };
48 |
49 | UseFileExtension.Checked += (_, _) => { Settings.UseFilesExtension = true; };
50 | UseFileExtension.Unchecked += (_, _) => { Settings.UseFilesExtension = false; };
51 |
52 | AddGlobalFolderExcludeToContext.Checked += (_, _) => { Settings.AddGlobalFolderExcludeToContext = true; };
53 | AddGlobalFolderExcludeToContext.Unchecked += (_, _) => { Settings.AddGlobalFolderExcludeToContext = false; };
54 |
55 | AddLocalFolderExcludeToContext.Checked += (_, _) => { Settings.AddLocalFolderExcludeToContext = true; };
56 | AddLocalFolderExcludeToContext.Unchecked += (_, _) => { Settings.AddLocalFolderExcludeToContext = false; };
57 |
58 | AddCheckBoxesToContext.Checked += (_, _) => { Settings.AddCheckBoxesToContext = true; };
59 | AddCheckBoxesToContext.Unchecked += (_, _) => { Settings.AddCheckBoxesToContext = false; };
60 |
61 | AddCreateNoteOptionOnAllSearch.Checked += (_, _) => { Settings.AddCreateNoteOptionOnAllSearch = true; };
62 | AddCreateNoteOptionOnAllSearch.Unchecked += (_, _) => { Settings.AddCreateNoteOptionOnAllSearch = false; };
63 | }
64 |
65 | private void SettingsView_OnUnloaded(object sender, RoutedEventArgs e) => Obsidian.ReloadData();
66 |
67 | private void CreateVaultSettingControls(Settings settings)
68 | {
69 | GlobalVaultSettingView globalVaultSettingControl = new(settings);
70 | GlobalVaultSettingPanel.Children.Add(globalVaultSettingControl);
71 | Thickness margin = new(0, 0, 10, 0);
72 | foreach (VaultSettingView? vaultSettingControl in VaultManager.Vaults.Select(vault =>
73 | new VaultSettingView(vault) { Margin = margin }))
74 | VaultsSettingPanel.Children.Add(vaultSettingControl);
75 | }
76 |
77 | private void OnIncrease(object sender, RoutedEventArgs e) => MaxResults++;
78 |
79 | private void OnDecrease(object sender, RoutedEventArgs e)
80 | {
81 | MaxResults--;
82 | if (MaxResults < 0) MaxResults = 0;
83 | }
84 |
85 | private void OnPropertyChanged([CallerMemberName] string? propertyName = null) =>
86 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
87 |
88 | public event PropertyChangedEventHandler? PropertyChanged;
89 | }
90 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Views/VaultSettingView.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
27 |
33 |
39 |
40 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/Views/VaultSettingView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using Flow.Launcher.Plugin.Obsidian.Models;
3 |
4 | namespace Flow.Launcher.Plugin.Obsidian.Views;
5 |
6 | public partial class VaultSettingView
7 | {
8 | private Vault Vault { get; }
9 | private VaultSetting VaultSetting { get; }
10 | private GlobalVaultSettingView? GlobalVaultSettingView { get; set; }
11 |
12 | public VaultSettingView(Vault vault)
13 | {
14 | Vault = vault;
15 | VaultSetting = vault.VaultSetting;
16 | InitializeComponent();
17 | InitializeControls();
18 | }
19 |
20 | private void InitializeControls()
21 | {
22 | GlobalVaultSettingView = new GlobalVaultSettingView(Vault);
23 | GlobalVaultSettingPanel.Children.Add(GlobalVaultSettingView);
24 | }
25 |
26 | private void VaultSettingViewOnLoaded(object sender, RoutedEventArgs e)
27 | {
28 | VaultName.Text = Vault.Name;
29 |
30 | UseGlobalSetting.IsChecked = VaultSetting.UseGlobalSetting;
31 | UpdateGlobalVaultSettingVisibility(!VaultSetting.UseGlobalSetting);
32 | UseGlobalExcludedPaths.IsChecked = VaultSetting.UseGlobalExcludedPaths;
33 |
34 | UseGlobalSetting.Checked += (_, _) =>
35 | {
36 | VaultSetting.UseGlobalSetting = true;
37 | UpdateGlobalVaultSettingVisibility(false);
38 | };
39 | UseGlobalSetting.Unchecked += (_, _) =>
40 | {
41 | VaultSetting.UseGlobalSetting = false;
42 | UpdateGlobalVaultSettingVisibility(true);
43 | };
44 |
45 | UseGlobalExcludedPaths.Checked += (_, _) => { VaultSetting.UseGlobalExcludedPaths = true; };
46 | UseGlobalExcludedPaths.Unchecked += (_, _) => { VaultSetting.UseGlobalExcludedPaths = false; };
47 | }
48 |
49 |
50 | private void UpdateGlobalVaultSettingVisibility(bool isVisible)
51 | {
52 | if (GlobalVaultSettingView != null)
53 | GlobalVaultSettingView.GlobalSettingVisibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Flow.Launcher.Plugin.Obsidian/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "ID": "028C97F910684231AB09B5DD5997D424",
3 | "ActionKeyword": "ob",
4 | "Name": "Obsidian",
5 | "Description": "Search all Obsidian files",
6 | "Author": "alexandre-v1",
7 | "Version": "1.1.1",
8 | "Language": "csharp",
9 | "Website": "https://github.com/alexandre-v1/Flow.Launcher.Plugin.Obsidian",
10 | "IcoPath": "Icons/obsidian-logo.png",
11 | "ExecuteFileName": "Flow.Launcher.Plugin.Obsidian.dll"
12 | }
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Alexandre v1
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 | This project contains assets owned by Obsidian (https://obsidian.md).
24 | All Obsidian-related assets, trademarks, and branding are property of Obsidian and are protected by copyright and other laws.
25 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # Flow.Launcher.Plugin.Obsidian
2 |
3 | A plugin for the [Flow launcher](https://github.com/Flow-Launcher/Flow.Launcher).
4 |
5 | Inspired by [Obsidian-Notes by Garulf](https://github.com/Garulf/Obsidian-Notes/) this plugin allow to search any types of files in an [Obsidian](https://obsidian.md/) vault.
6 |
7 | ## Functionality
8 |
9 | ### Base
10 |
11 | - Search File
12 | - Markdown
13 | - Canvas
14 | - Excalidraw
15 | - Images ( png, jpg, jpeg, gif, bmp )
16 | - Other ( json, csv )
17 | - Create new note
18 | - Folder Exclusions
19 | - Search with [Aliases](https://help.obsidian.md/Linking+notes+and+files/Aliases)
20 | - Manage Checkboxes
21 | - Per vault settings
22 |
23 | ### With [obsidian-advanced-uri](https://github.com/Vinzent03/obsidian-advanced-uri) plugin
24 |
25 | - Open in new tab
26 |
27 | ## Planned
28 |
29 | - Make the plugin async (this is need for good Search in content)
30 | - Search in Note content
31 |
32 | ## Usage
33 |
34 | Search note:
35 |
36 | ob
37 |
38 | Create note:
39 |
40 | ob create
41 |
--------------------------------------------------------------------------------