feat: add v2_get_runtime_diagnostics command
Single IPC call returns saved audio/graphics/developer settings, runtime GPU detection state, and active environment variables. cc
This commit is contained in:
2 files changed
+135
No files matched your search
@@ -13715,3 +13715,137 @@ pub async fn v2_dismiss_discovery_artist(
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ==================== Runtime Diagnostics ====================
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RuntimeDiagnostics {
|
||||
// Audio: saved settings
|
||||
pub audio_output_device: Option<String>,
|
||||
pub audio_backend_type: Option<String>,
|
||||
pub audio_exclusive_mode: bool,
|
||||
pub audio_dac_passthrough: bool,
|
||||
pub audio_preferred_sample_rate: Option<u32>,
|
||||
pub audio_alsa_plugin: Option<String>,
|
||||
pub audio_alsa_hardware_volume: bool,
|
||||
pub audio_normalization_enabled: bool,
|
||||
pub audio_normalization_target_lufs: f32,
|
||||
pub audio_gapless_enabled: bool,
|
||||
pub audio_pw_force_bitperfect: bool,
|
||||
pub audio_stream_buffer_seconds: u8,
|
||||
pub audio_streaming_only: bool,
|
||||
|
||||
// Graphics: saved settings
|
||||
pub gfx_hardware_acceleration: bool,
|
||||
pub gfx_force_x11: bool,
|
||||
pub gfx_gdk_scale: Option<String>,
|
||||
pub gfx_gdk_dpi_scale: Option<String>,
|
||||
pub gfx_gsk_renderer: Option<String>,
|
||||
|
||||
// Graphics: runtime (what actually applied at startup)
|
||||
pub runtime_using_fallback: bool,
|
||||
pub runtime_is_wayland: bool,
|
||||
pub runtime_has_nvidia: bool,
|
||||
pub runtime_has_amd: bool,
|
||||
pub runtime_has_intel: bool,
|
||||
pub runtime_is_vm: bool,
|
||||
pub runtime_hw_accel_enabled: bool,
|
||||
pub runtime_force_x11_active: bool,
|
||||
|
||||
// Developer settings
|
||||
pub dev_force_dmabuf: bool,
|
||||
|
||||
// Environment variables (what WebKit actually sees)
|
||||
pub env_webkit_disable_dmabuf: Option<String>,
|
||||
pub env_webkit_disable_compositing: Option<String>,
|
||||
pub env_gdk_backend: Option<String>,
|
||||
pub env_gsk_renderer: Option<String>,
|
||||
pub env_libgl_always_software: Option<String>,
|
||||
pub env_wayland_display: Option<String>,
|
||||
pub env_xdg_session_type: Option<String>,
|
||||
|
||||
// App info
|
||||
pub app_version: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn v2_get_runtime_diagnostics(
|
||||
audio_state: State<'_, AudioSettingsState>,
|
||||
graphics_state: State<'_, GraphicsSettingsState>,
|
||||
developer_state: State<'_, DeveloperSettingsState>,
|
||||
) -> Result<RuntimeDiagnostics, RuntimeError> {
|
||||
// Audio settings (may not be available before login)
|
||||
let audio = audio_state
|
||||
.store
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|g| g.as_ref().and_then(|s| s.get_settings().ok()));
|
||||
|
||||
// Graphics settings
|
||||
let gfx = graphics_state
|
||||
.store
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|g| g.as_ref().and_then(|s| s.get_settings().ok()));
|
||||
|
||||
// Graphics runtime status (static atomics — always available)
|
||||
let gfx_status = crate::config::graphics_settings::get_graphics_startup_status();
|
||||
|
||||
// Developer settings
|
||||
let dev = developer_state
|
||||
.store
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|g| g.as_ref().and_then(|s| s.get_settings().ok()));
|
||||
|
||||
let env_var = |name: &str| std::env::var(name).ok();
|
||||
|
||||
let audio_defaults = crate::config::audio_settings::AudioSettings::default();
|
||||
let audio = audio.unwrap_or(audio_defaults);
|
||||
let gfx = gfx.unwrap_or_default();
|
||||
let dev = dev.unwrap_or_default();
|
||||
|
||||
Ok(RuntimeDiagnostics {
|
||||
audio_output_device: audio.output_device,
|
||||
audio_backend_type: audio.backend_type.map(|b| format!("{:?}", b)),
|
||||
audio_exclusive_mode: audio.exclusive_mode,
|
||||
audio_dac_passthrough: audio.dac_passthrough,
|
||||
audio_preferred_sample_rate: audio.preferred_sample_rate,
|
||||
audio_alsa_plugin: audio.alsa_plugin.map(|p| format!("{:?}", p)),
|
||||
audio_alsa_hardware_volume: audio.alsa_hardware_volume,
|
||||
audio_normalization_enabled: audio.normalization_enabled,
|
||||
audio_normalization_target_lufs: audio.normalization_target_lufs,
|
||||
audio_gapless_enabled: audio.gapless_enabled,
|
||||
audio_pw_force_bitperfect: audio.pw_force_bitperfect,
|
||||
audio_stream_buffer_seconds: audio.stream_buffer_seconds,
|
||||
audio_streaming_only: audio.streaming_only,
|
||||
|
||||
gfx_hardware_acceleration: gfx.hardware_acceleration,
|
||||
gfx_force_x11: gfx.force_x11,
|
||||
gfx_gdk_scale: gfx.gdk_scale,
|
||||
gfx_gdk_dpi_scale: gfx.gdk_dpi_scale,
|
||||
gfx_gsk_renderer: gfx.gsk_renderer,
|
||||
|
||||
runtime_using_fallback: gfx_status.using_fallback,
|
||||
runtime_is_wayland: gfx_status.is_wayland,
|
||||
runtime_has_nvidia: gfx_status.has_nvidia,
|
||||
runtime_has_amd: gfx_status.has_amd,
|
||||
runtime_has_intel: gfx_status.has_intel,
|
||||
runtime_is_vm: gfx_status.is_vm,
|
||||
runtime_hw_accel_enabled: gfx_status.hardware_accel_enabled,
|
||||
runtime_force_x11_active: gfx_status.force_x11_active,
|
||||
|
||||
dev_force_dmabuf: dev.force_dmabuf,
|
||||
|
||||
env_webkit_disable_dmabuf: env_var("WEBKIT_DISABLE_DMABUF_RENDERER"),
|
||||
env_webkit_disable_compositing: env_var("WEBKIT_DISABLE_COMPOSITING_MODE"),
|
||||
env_gdk_backend: env_var("GDK_BACKEND"),
|
||||
env_gsk_renderer: env_var("GSK_RENDERER"),
|
||||
env_libgl_always_software: env_var("LIBGL_ALWAYS_SOFTWARE"),
|
||||
env_wayland_display: env_var("WAYLAND_DISPLAY"),
|
||||
env_xdg_session_type: env_var("XDG_SESSION_TYPE"),
|
||||
|
||||
app_version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
})
|
||||
}
|
||||
@@ -1254,6 +1254,7 @@ pub fn run() {
|
||||
commands_v2::v2_plex_play_track,
|
||||
commands_v2::v2_set_visualizer_enabled,
|
||||
commands_v2::v2_get_developer_settings,
|
||||
commands_v2::v2_get_runtime_diagnostics,
|
||||
commands_v2::v2_set_developer_force_dmabuf,
|
||||
commands_v2::v2_get_graphics_settings,
|
||||
commands_v2::v2_get_graphics_startup_status,
|
||||
|
||||
Reference in new issue
Block a user