fix(desktop): read wayland preference from store (#13081)
This commit is contained in:
@@ -402,7 +402,7 @@ fn check_linux_app(app_name: &str) -> bool {
|
|||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
#[specta::specta]
|
#[specta::specta]
|
||||||
fn wsl_path(path: String, mode: Option<WslPathMode>) -> Result<String, String> {
|
fn wsl_path(path: String, mode: Option<WslPathMode>) -> Result<String, String> {
|
||||||
if !cfg(windows) {
|
if !cfg!(windows) {
|
||||||
return Ok(path);
|
return Ok(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ struct DisplayConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn dir() -> Option<PathBuf> {
|
fn dir() -> Option<PathBuf> {
|
||||||
Some(dirs::data_dir()?.join("ai.opencode.desktop"))
|
Some(dirs::data_dir()?.join(if cfg!(debug_assertions) { "ai.opencode.desktop.dev" } else { "ai.opencode.desktop" }))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn path() -> Option<PathBuf> {
|
fn path() -> Option<PathBuf> {
|
||||||
@@ -22,10 +22,13 @@ fn path() -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_wayland() -> Option<bool> {
|
pub fn read_wayland() -> Option<bool> {
|
||||||
let path = path()?;
|
let raw = std::fs::read_to_string(dbg!(path()?)).ok()?;
|
||||||
let raw = std::fs::read_to_string(path).ok()?;
|
let root = serde_json::from_str::<serde_json::Value>(&raw)
|
||||||
let config = serde_json::from_str::<DisplayConfig>(&raw).ok()?;
|
.ok()?
|
||||||
config.wayland
|
.get(LINUX_DISPLAY_CONFIG_KEY).cloned()?;
|
||||||
|
serde_json::from_value::<DisplayConfig>(root)
|
||||||
|
.ok()?
|
||||||
|
.wayland
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_wayland(app: &AppHandle, value: bool) -> Result<(), String> {
|
pub fn write_wayland(app: &AppHandle, value: bool) -> Result<(), String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user