Commit graph

3400 commits

Author SHA1 Message Date
Jack251970
88fd1e56d0 Handle OperationCanceledException gracefully
Added a `catch` block for `OperationCanceledException` in
`PluginsManifest.cs` to ignore canceled operations. Updated
`EverythingAPI.cs` to use cancellation tokens with `_semaphore.WaitAsync`
and handle cancellations by exiting the method cleanly with `yield break`.
2025-11-06 20:47:54 +08:00
Jack251970
49f89e33b5 Make locking operations cancelable with tokens
Updated `_semaphore.WaitAsync` in `EverythingAPI.cs` to accept a `CancellationToken` and handle `OperationCanceledException` gracefully, returning `false` instead of propagating the exception.

Refactored locking mechanisms in `Main.cs` to use `CancellationToken` for `_win32sLock` and `_uwpsLock`. Added `try-catch` blocks to handle `OperationCanceledException` and ensure proper lock release. Methods now return `emptyResults` when operations are canceled.
2025-11-06 20:46:29 +08:00
Jack251970
d0a47c84b9 Clarify CancellationToken handling in comments
Updated comments to explain the rationale for not directly passing
CancellationToken to methods and instead checking
IsCancellationRequested within locks. This prevents unexpected
OperationCanceledException. Changes made in EverythingAPI.cs
(IsEverythingRunningAsync) and Main.cs (Win32 and UWP program
preparation). No functional changes to the code.
2025-11-06 15:39:19 +08:00
Jack251970
bfaff5cca5 Improve semaphore usage and logging clarity
Added comments in `EverythingAPI.cs` and `Main.cs` to explain
why `CancellationToken` is not directly passed to semaphore
locks, preventing unexpected `OperationCanceledException`.

Updated debug log messages in `Main.cs` for better clarity,
including changing "Start handling programs" to "Start querying
programs". Removed redundant log messages to improve logging
consistency.
2025-11-06 15:32:08 +08:00
Jack251970
30d7f67d42 Refactor token cancellation check for readability
Simplified the `if` statement that checks for token cancellation
by condensing it into a single line. This improves code readability
and eliminates unnecessary line breaks.
2025-11-06 15:30:32 +08:00
Jack251970
7e332fa615 Refactor caching and indexing logic
Added `ResetCache` calls after clearing `_win32s` and `_uwps` lists to ensure proper cache reset during indexing. Updated logic to return `resultList` after setting cache size and expiration for improved clarity. Removed `await Task.WhenAll` to adjust asynchronous flow in the indexing process.
2025-11-06 15:29:38 +08:00
Jack251970
3d8fd1d352 Improve cancellation, locking, and logging mechanisms
Enhanced cancellation handling by adding `token.IsCancellationRequested` checks to improve responsiveness. Refactored locking mechanisms for `_win32sLock` and `_uwpsLock` using `try-finally` blocks to ensure proper acquisition and release, improving thread safety and preventing deadlocks.

Reorganized Win32 and UWP program querying logic for better modularity and readability. Replaced shared collection access with local variables to improve clarity and maintain thread safety. Simplified empty result handling by directly returning `emptyResults` when canceled.

Removed redundant debug log statements to reduce verbosity and updated remaining logs for clarity. Suppressed unused result warnings by replacing direct calls to `EverythingApiDllImport.Everything_GetMajorVersion()` with null-coalescing assignments.
2025-11-06 15:28:13 +08:00
Jack251970
db0c86d50c Remove CancellationToken from semaphore WaitAsync calls
Removed the `CancellationToken` parameter from `WaitAsync` calls
on semaphores in `EverythingAPI.cs` and `Main.cs`. This change
eliminates cancellation support for semaphore waits, likely due
to a design decision prioritizing simplicity or avoiding issues
with cancellation handling.

In `EverythingAPI.cs`, `WaitAsync(token)` was replaced with
`WaitAsync()` in two methods. Similarly, in `Main.cs`, the
`WaitAsync` calls for `_win32sLock` and `_uwpsLock` were updated
to remove the `token` parameter.

Note: This change may impact the ability to gracefully handle
cancellation during semaphore waits.
2025-11-04 14:25:55 +08:00
Jack251970
6e17d5d756 Improve logging for Win32 program lock acquisition
Added a debug log statement to indicate when the lock for
querying Win32 programs is being acquired. This enhances
granularity in logging, making it easier to distinguish
between the acquisition of locks for Win32 and UWP programs.
Improves traceability and debugging of the program's
execution flow.
2025-11-04 12:27:59 +08:00
Jack251970
4cf942ac3a Add detailed debug logging for query execution process
Enhanced logging to provide better traceability and insights:
- Added debug logs for query reception, cache misses, and lock acquisition.
- Logged query cancellation and completion with result counts.
- Added logs for caching results, including item counts and query details.
- Improved logging for filtering and program selection processes.
- Ensured no functional changes to existing query and filtering logic.
2025-10-26 21:01:07 +08:00
Jack251970
f632a4b773 Add caching to QueryAsync and integrate cache reset logic
Introduced a MemoryCache to improve QueryAsync performance by
caching query results, reducing redundant computations. Added
a ResetCache method to reinitialize the cache when settings
are updated. Integrated cache reset calls into settings
property setters to ensure consistency.

Refactored query logic to leverage MemoryCache.GetOrCreateAsync
for streamlined caching. Removed redundant code and debug
logging for improved readability and maintainability. Ensured
thread safety with proper locking mechanisms. Simplified and
consolidated caching logic for better maintainability.
2025-10-26 20:59:29 +08:00
Jack251970
e2fa122362 Improve program indexing with logging and thread safety
Added detailed debug logging to `IndexWin32ProgramsAsync` and
`IndexUwpProgramsAsync` to track the indexing process, including
preparation, start, retrieval, caching, and completion.

Replaced direct updates to `_settings.LastIndexTime` with a
thread-safe lock to prevent race conditions.

Enhanced `IndexProgramsAsync` with a debug log to indicate the
start of indexing for better traceability.

Updated program retrieval logic to process Win32 and UWP programs
in parallel with cancellation support and applied the
`HideUninstallersFilter` for cleaner results.
2025-10-26 20:56:08 +08:00
Jack251970
6a65f8090f Enhance thread safety and refactor reindexing logic
Introduced `_lastIndexTimeLock` to ensure thread-safe access
and updates to `_settings.LastIndexTime`, preventing race
conditions. Refactored reindexing logic to use a `lock` block
for evaluating and updating the reindexing condition.

Added `emptyResults` as a static readonly placeholder list.
Improved code clarity and maintainability without altering
existing functionality.
2025-10-26 20:51:08 +08:00
Jack251970
637d926f7a Remove caching logic and initialize emptyResults list
The caching-related code, including `cacheOptions` and `cache`, has been removed from `Main.cs`, indicating that the caching mechanism is no longer in use or has been refactored elsewhere. Additionally, the `emptyResults` list is now explicitly initialized as an empty list (`[]`). No changes were made to the `Context` property or the `commonUninstallerNames` array.
2025-10-26 20:41:06 +08:00
Jack251970
7f5efc5ca1 Refactor caching and improve QueryAsync method
Removed the `ResetCache` method and its associated calls to streamline caching management and improve performance. Refactored the `QueryAsync` method for better thread safety, synchronization, and exception handling. Simplified UWP and Win32 program filtering logic and removed redundant code. Eliminated manual cache disposal and reset logic, favoring a more efficient and automated caching mechanism. These changes enhance maintainability, responsiveness, and overall plugin performance.
2025-10-26 20:40:37 +08:00
Diego Henrique
1bfd147421
BUG: Explorer plugin navigate path should only show results in current path (#4053) 2025-10-21 12:12:45 +11:00
dependabot[bot]
a3d1c43580
Bump Microsoft.Data.Sqlite from 9.0.9 to 9.0.10
---
updated-dependencies:
- dependency-name: Microsoft.Data.Sqlite
  dependency-version: 9.0.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-14 22:07:02 +00:00
Jeremy
7445d54d22 merge back v2.0.2 from master to dev 2025-10-14 22:35:06 +11:00
Jeremy Wu
f37d4c47cc
Release 2.0.2 | Plugin 5.1.0 (#4046) 2025-10-14 13:49:29 +03:00
Jeremy Wu
02a29c6af4
New Crowdin updates (#4002) 2025-10-14 12:14:37 +03:00
Jack251970
1e3306ef28 Remove unused file 2025-10-12 13:33:20 +08:00
Jack251970
6f17aa21c2 Resolve conflicts 2025-10-12 13:31:24 +08:00
Jack Ye
b8acead444
Merge branch 'dev' into httpspref 2025-10-12 13:24:11 +08:00
Jack Ye
eb261f503b
Merge pull request #3944 from Flow-Launcher/url_open_enhancement
Enhancement: Support Custom Browser Path & Open in window / tab & In private for URL Plugin
2025-10-12 12:22:36 +08:00
Jack Ye
01bbb54054
Merge pull request #4038 from AWAS666/dragdropwebsearch
Enable reordering of websearches with drap and drop
2025-10-11 20:49:17 +08:00
Jack Ye
b297f3d3a3
Fix ArgumentOutOfRangeException in WebSearch Plugin (#4041) 2025-10-11 18:34:05 +11:00
AWAS666
d7dd89d719 change from remove/insert to move 2025-10-10 11:40:06 +02:00
AWAS666
20a865f012 missing nullchecks and casts 2025-10-10 10:06:54 +02:00
AWAS666
87676d2994 fix: error when dragging downwards 2025-10-10 10:06:42 +02:00
AWAS666
001dad9a79 revert manual translation 2025-10-10 10:03:16 +02:00
Jack Ye
a412c7978a
Fix format
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-10 12:23:41 +08:00
AWAS666
b9a43147dc enable reordering with drap and drop on websearches 2025-10-09 12:35:04 +02:00
AWAS666
ae3559ca74 fix: explicit scheme 2025-10-09 10:48:58 +02:00
AWAS666
1a373e1c40 prefer https over http setting 2025-10-09 10:36:42 +02:00
Jack Ye
5ae159de5b
Move to iNKORE.UI.WPF.Modern UI Framework (#3593) 2025-10-05 13:44:40 +03:00
Jack Ye
5b0a30774e
Fix code comment typo
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-02 19:45:08 +08:00
Jack251970
d08ee30a7a Refactor plugin actions to simplify logic
Removed logoff operation logic and associated return statement.
Eliminated return statement after recycle bin error handling.
Removed async plugin data reload and success message logic.
Simplified theme selector query handling by removing `return false`.
These changes streamline the code and improve maintainability.
2025-10-02 19:43:31 +08:00
Jack251970
167570559f Move settings save to post-confirmation for actions
Previously, `Context.API.SaveAppAllSettings()` was called unconditionally before user confirmation for shutdown, restart, and advanced restart actions. This change ensures settings are only saved if the user confirms the action by clicking "Yes" in the confirmation dialog.

For all three functionalities:
- Moved the settings save call inside the `if (result == MessageBoxResult.Yes)` block.
- Retained the existing logic for executing the respective system commands, with checks for `EnableShutdownPrivilege()` to determine whether to use `PInvoke.ExitWindowsEx` or the `shutdown` command.

This change prevents unnecessary settings saves when the user cancels the action.
2025-10-02 19:42:24 +08:00
Jack251970
e376da4482 Save settings before shutdown/restart to prevent data loss
Added a call to `Context.API.SaveAppAllSettings()` before executing system shutdown, restart, or advanced restart operations. This ensures that any unsaved settings are persisted, reducing the risk of data loss during these actions.
2025-10-02 19:29:46 +08:00
Jeremy Wu
652ec40d82
add removal todo comment 2025-09-30 22:28:41 +10:00
Jack251970
9be546d6c7 Fix ShowOnlyMostUsedCMDsNumber default value 2025-09-30 09:50:29 +08:00
Jack Ye
aab213a6b9
Add default value for ShowOnlyMostUsedCMDsNumber
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-09-30 09:38:18 +08:00
Jack Ye
89505fce30
Remove unnecessary DataContext
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-30 09:37:48 +08:00
Jack251970
d106c5144b Fix IsEnabled logic 2025-09-29 23:12:02 +08:00
Jack251970
175571a130 Refactor ShellSettings with Binding logic 2025-09-29 23:00:32 +08:00
Jack251970
d363cf8137 Add property change for settings class & Add localize support for enum 2025-09-29 10:42:19 +08:00
Jack251970
ec41ec2377 Improve code quality 2025-09-28 12:04:32 +08:00
Jack251970
64e9150f11 Fix build issue 2025-09-28 12:03:49 +08:00
Jack Ye
08bf147559
Merge branch 'dev' into url_open_enhancement 2025-09-28 12:02:24 +08:00
Jack Ye
5b6ea73513
Code cleanup & Use Flow.Launcher.Localization to improve code quality (#4009)
* Use Flow.Launcher.Localization to improve code quality

* Code cleanup

* Improve code quality

* Improve code quality

* Use internal static Context & Improve code quality

* Use Flow.Launcher.Localization to improve code quality

* Code cleanup

* Use Flow.Launcher.Localization to improve code quality

* Improve code quality

* Improve code quality

* Use Flow.Launcher.Localization to improve code quality

* Fix logic issue

* Fix the variable name typo

* Fix redundant boolean cast and ensure consistent default value handling

* Use Flow.Launcher.Localization to improve code quality

* Revert namespace styles

* Fix indent format

* Revert namespace style

* Fix indent format

* Fix namespace style

* Fix indent format

* Fix indent format
2025-09-27 19:18:33 +03:00
Jack Ye
5e2536c129
Merge branch 'dev' into dependabot/nuget/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Svg.Skia-3.2.1 2025-09-25 12:41:14 +08:00
dependabot[bot]
a76e2fea7f
Bump SkiaSharp from 3.119.0 to 3.119.1
---
updated-dependencies:
- dependency-name: SkiaSharp
  dependency-version: 3.119.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-23 22:06:58 +00:00
Jack Ye
d7d88a9ebb
Merge branch 'dev' into url_open_enhancement 2025-09-21 21:37:14 +08:00
Jeremy
dc1f0f1095 merge back v2.0.1 from master into dev 2025-09-21 23:15:34 +10:00
Jeremy Wu
a05e09908c
Release 2.0.1 (#3998) 2025-09-21 20:23:00 +08:00
Jeremy Wu
d7e1ad73cc
New Crowdin updates (#3948) 2025-09-21 14:36:35 +03:00
dependabot[bot]
846cc65d8e
Bump Svg.Skia from 3.0.6 to 3.2.1
---
updated-dependencies:
- dependency-name: Svg.Skia
  dependency-version: 3.2.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-21 04:49:51 +00:00
Jack251970
78e5bf2a60 Use Flow.Launcher.Localization to improve code quality 2025-09-21 11:50:51 +08:00
Jeremy Wu
3a8c64b02d
update wording 2025-09-18 23:08:02 +10:00
Jack Ye
16895716e9
Merge pull request #3978 from Flow-Launcher/program_locks
Fix program lock waiting issue
2025-09-18 20:38:15 +08:00
Jack251970
23d0b73e20 Fix AllEverythingSortOptions issue 2025-09-17 17:30:03 +08:00
Jack251970
e10b9254ed Add workaround for log & ln function 2025-09-16 16:31:06 +08:00
Jack251970
6841ad5410 Add calculator unit testing 2025-09-16 16:08:17 +08:00
Jack251970
ef69e329fc Fix release 2025-09-15 15:50:22 +08:00
Jack251970
9321a7df14 Fix program lock issue 2025-09-15 15:40:49 +08:00
Jack251970
684fafdfdd Improve code quality 2025-09-15 15:18:42 +08:00
Jack251970
c2e797615d Improve code quality 2025-09-15 15:18:23 +08:00
Jack251970
f9facda521 Improve code quality 2025-09-15 13:02:42 +08:00
Jack251970
1906d68541 Add ShowErrorMessage setting 2025-09-15 12:57:25 +08:00
Jack251970
cea1402dde Improve code quality 2025-09-15 12:53:17 +08:00
Jack251970
b07420a193 Use EmptyResults to improve code quality 2025-09-15 12:51:31 +08:00
dcog989
9be8b71f09 review feedback, CultureInvariant, mild refactor 2025-09-14 22:28:37 +01:00
dcog989
edc76faeb4 Review feedback, case insensitive, consistent separators 2025-09-14 21:51:47 +01:00
dcog989
e990e0ff5b Handle misplaced separators, Mages edge cases
Allow for e.g. `25,00` when `,` used as digit grouping.
Exclude Mages function from the above relaxed logic.
2025-09-14 19:39:06 +01:00
dcog989
336e51d104 IcoPath to const string 2025-09-14 17:08:37 +01:00
Jack251970
daf35a4972 Do not check bracket complete 2025-09-14 15:54:35 +08:00
Jack251970
495ace1246 Improve plugin description 2025-09-14 12:39:11 +08:00
Jack251970
11f5ea5074 Improve code quality 2025-09-14 12:33:46 +08:00
dcog989
6462023d58
Merge branch 'dev' into calculator-min-fix 2025-09-13 13:17:40 +01:00
dcog989
110f571b40 Rework solution for nested Mages
Previous solution missed e.g. `pow(min(2,3), 4)`
2025-09-13 13:17:08 +01:00
Jeremy Wu
eaa90b31d8
Merge pull request #3906 from Flow-Launcher/nuget_package_upgrade
Upgrade Nuget packages & Update lock files
2025-09-13 17:36:20 +10:00
Jack251970
29b675b26a Upgrade nuget packages 2025-09-13 14:14:59 +08:00
Jack Ye
889ed58f0c
Merge pull request #3973 from dcog989/bookmark-quick-fix
Bookmark plugin - catch an exception for empty / broken favicons
2025-09-13 14:13:06 +08:00
Jack Ye
7fc30aea93
Merge branch 'dev' into nuget_package_upgrade 2025-09-13 14:06:16 +08:00
dcog989
15f31a1698 Bookmark plugin quick fix
Catch an exception for empty / corrupted favicons.
2025-09-12 22:34:03 +01:00
dcog989
bd186e7fe1 correct + extend description 2025-09-12 20:02:34 +01:00
dcog989
190e0e179f Fix 'German' number formatting 2025-09-12 20:01:55 +01:00
dcog989
103d3832a0 dead code, improve messages, group separator fix? 2025-09-12 19:30:07 +01:00
dcog989
e1079396c3 backout 'smart' digit grouping, mages fixes + workaround
Mages did not like the previous change to smart thousands / decimal so backed that out.

Workaround for https://github.com/FlorianRappl/Mages/issues/132
2025-09-12 19:20:19 +01:00
dependabot[bot]
ca164b37db
Bump Microsoft.Data.Sqlite from 9.0.8 to 9.0.9
---
updated-dependencies:
- dependency-name: Microsoft.Data.Sqlite
  dependency-version: 9.0.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-09 22:07:50 +00:00
Jack251970
8e837b8e56 Avoid clobbering inherited NoWarn; append instead. 2025-09-06 13:37:27 +08:00
Jack Ye
8bc60e55e0
Merge branch 'dev' into nuget_package_upgrade 2025-09-06 13:31:24 +08:00
Jack Ye
45bb6e94fc
Merge branch 'dev' into url_open_enhancement 2025-09-06 13:31:19 +08:00
Jeremy Wu
4fe8d8c233
New Crowdin updates (#3940) 2025-09-06 06:34:23 +03:00
Jack251970
3f6bebd540 Keep default value same as origin 2025-09-05 19:04:46 +08:00
Jack251970
96d7d18f6d Change string resource names & Redesign setting panel 2025-09-05 19:02:49 +08:00
Jack251970
4f49077bee Add & Use BoolToVisibilityConverter 2025-09-05 19:02:29 +08:00
Jack251970
33aef7eb54 Add convert back implementation for InverseBoolConverter 2025-09-05 19:02:11 +08:00
Jack251970
cdf3905a51 Use InverseBoolConverter 2025-09-05 18:40:50 +08:00
Jack251970
c17db8c9b4 Use using statements 2025-09-05 18:40:28 +08:00