Skip to content
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

Merged
merged 31 commits into from
Sep 24, 2024

Conversation

Legend-Master
Copy link
Contributor

Closes #5279

Waiting for tauri-apps/tao#937

@Legend-Master Legend-Master changed the title feat(core): add a new function set_theme to set theme dynamically feat(core): add a new function to set theme dynamically Jul 6, 2024
Copy link
Contributor

github-actions bot commented Aug 8, 2024

Package Changes Through bb57d27

There 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 Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.0.0-rc.5 2.0.0-rc.6
tauri-utils 2.0.0-rc.12 2.0.0-rc.13
tauri-bundler 2.0.1-rc.13 2.0.1-rc.14
tauri-runtime 2.0.0-rc.12 2.0.0-rc.13
tauri-runtime-wry 2.0.0-rc.13 2.0.0-rc.14
tauri-codegen 2.0.0-rc.12 2.0.0-rc.13
tauri-macros 2.0.0-rc.11 2.0.0-rc.12
tauri-plugin 2.0.0-rc.12 2.0.0-rc.13
tauri-build 2.0.0-rc.12 2.0.0-rc.13
tauri 2.0.0-rc.15 2.0.0-rc.16
@tauri-apps/cli 2.0.0-rc.16 2.0.0-rc.17
tauri-cli 2.0.0-rc.16 2.0.0-rc.17

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master Legend-Master marked this pull request as ready for review September 19, 2024 15:41
@Legend-Master Legend-Master requested a review from a team as a code owner September 19, 2024 15:41
Copy link
Member

@amrbashir amrbashir left a 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()

packages/api/src/window.ts Outdated Show resolved Hide resolved
crates/tauri-runtime-wry/src/lib.rs Show resolved Hide resolved
@Legend-Master
Copy link
Contributor Author

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>) {
Copy link
Contributor Author

@Legend-Master Legend-Master Sep 20, 2024

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

pub fn extend_api(&self, plugin: &str, invoke: Invoke<R>) -> bool {

manager

packages/api/src/window.ts Outdated Show resolved Hide resolved
packages/api/src/window.ts Show resolved Hide resolved
packages/api/src/app.ts Show resolved Hide resolved
packages/api/src/app.ts Show resolved Hide resolved
crates/tauri/src/window/mod.rs Outdated Show resolved Hide resolved
crates/tauri/src/app.rs Outdated Show resolved Hide resolved
@amrbashir amrbashir merged commit 11db7be into tauri-apps:dev Sep 24, 2024
23 of 24 checks passed
Legend-Master added a commit to Legend-Master/tauri that referenced this pull request Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] Change Window theme dynamically at runtime
2 participants