mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-08-27 06:04:00 +02:00
fix(wm): don't err on failed window serialization
This commit is contained in:
@@ -5,7 +5,7 @@ use std::fmt::Formatter;
|
|||||||
use color_eyre::eyre::anyhow;
|
use color_eyre::eyre::anyhow;
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::ser::Error;
|
|
||||||
use serde::ser::SerializeStruct;
|
use serde::ser::SerializeStruct;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde::Serializer;
|
use serde::Serializer;
|
||||||
@@ -64,24 +64,23 @@ impl Serialize for Window {
|
|||||||
"title",
|
"title",
|
||||||
&self
|
&self
|
||||||
.title()
|
.title()
|
||||||
.map_err(|_| S::Error::custom("could not get window title"))?,
|
.unwrap_or_else(|_| "could not get window title".to_string()),
|
||||||
)?;
|
)?;
|
||||||
state.serialize_field(
|
state.serialize_field(
|
||||||
"exe",
|
"exe",
|
||||||
&self
|
&self
|
||||||
.exe()
|
.exe()
|
||||||
.map_err(|_| S::Error::custom("could not get window exe"))?,
|
.unwrap_or_else(|_| "could not get window exe".to_string()),
|
||||||
)?;
|
)?;
|
||||||
state.serialize_field(
|
state.serialize_field(
|
||||||
"class",
|
"class",
|
||||||
&self
|
&self
|
||||||
.class()
|
.class()
|
||||||
.map_err(|_| S::Error::custom("could not get window class"))?,
|
.unwrap_or_else(|_| "could not get window class".to_string()),
|
||||||
)?;
|
)?;
|
||||||
state.serialize_field(
|
state.serialize_field(
|
||||||
"rect",
|
"rect",
|
||||||
&WindowsApi::window_rect(self.hwnd())
|
&WindowsApi::window_rect(self.hwnd()).unwrap_or_default(),
|
||||||
.map_err(|_| S::Error::custom("could not get window rect"))?,
|
|
||||||
)?;
|
)?;
|
||||||
state.end()
|
state.end()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user