Make DevTools a toggle in Settings > Developer tab
- DevTools off by default (no more auto-open on launch) - New "Developer" tab in Settings with a checkbox to toggle devtools - Toggle takes effect immediately (opens/closes inspector) - Setting persists: devtools restored on next launch if enabled - toggle_devtools Tauri command wraps window.open/close_devtools Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,3 +32,16 @@ pub fn save_settings(settings: Value) -> Result<(), String> {
|
||||
fs::write(&path, json).map_err(|e| format!("Cannot write settings: {e}"))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Toggle devtools on the main window.
|
||||
#[tauri::command]
|
||||
pub fn toggle_devtools(app: tauri::AppHandle, open: bool) {
|
||||
use tauri::Manager;
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if open {
|
||||
window.open_devtools();
|
||||
} else {
|
||||
window.close_devtools();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user