Add: config for controlling debug overlay visibility of tauri

This commit is contained in:
DaZuo0122
2026-02-13 22:31:22 +08:00
parent 875bc54c4f
commit e5e123cc84
9 changed files with 148 additions and 26 deletions

View File

@@ -82,6 +82,28 @@ impl RuntimeCore {
self.command_tx.clone()
}
pub fn frontend_debug_overlay_visible(&self) -> Result<bool, RuntimeCoreError> {
let guard = self
.config
.read()
.map_err(|_| RuntimeCoreError::ConfigPoisoned)?;
Ok(guard.frontend.debug_overlay_visible)
}
pub fn set_frontend_debug_overlay_visible(
&self,
visible: bool,
) -> Result<(), RuntimeCoreError> {
{
let mut guard = self
.config
.write()
.map_err(|_| RuntimeCoreError::ConfigPoisoned)?;
guard.frontend.debug_overlay_visible = visible;
}
self.persist_config()
}
pub fn api_config(&self) -> ApiConfig {
self.api_config.clone()
}
@@ -283,4 +305,14 @@ mod tests {
let config = core.config().read().expect("config lock").clone();
assert!(!config.window.click_through);
}
#[test]
fn frontend_debug_overlay_visibility_roundtrips() {
let temp = TempDir::new().expect("tempdir");
let path = temp.path().join("config.toml");
let core = RuntimeCore::new_with_config(path, AppConfig::default(), CapabilityFlags::default())
.expect("core init");
core.set_frontend_debug_overlay_visible(true).expect("set");
assert!(core.frontend_debug_overlay_visible().expect("get"));
}
}