-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add a new function to set theme dynamically #10210
Conversation
set_theme
to set theme dynamically
Package Changes Through bb57d27There are 8 changes which include tauri with prerelease, tauri-runtime-wry with prerelease, tauri-runtime with prerelease, tauri-utils with prerelease, @tauri-apps/api with prerelease, tauri-cli with prerelease, @tauri-apps/cli with prerelease, tauri-bundler with prerelease Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add app.set_theme()
I need to get some sleep, will get back to this tomorrow |
@@ -50,6 +52,11 @@ pub fn default_window_icon<R: Runtime>( | |||
}) | |||
} | |||
|
|||
#[command(root = "crate")] | |||
pub async fn set_app_theme<R: Runtime>(app: AppHandle<R>, theme: Option<Theme>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause a deadlock on plugins without async
, lock happened on these two places, I'm not sure how should we handle this, seems like it's because this call triggers a ThemeChanged
event while having a lock on the plugins when invoked
tauri/crates/tauri/src/manager/mod.rs
Line 462 in f6a9717
pub fn extend_api(&self, plugin: &str, invoke: Invoke<R>) -> bool { |
Line 2157 in f6a9717
manager |
Closes #5279
Waiting for tauri-apps/tao#937