Fix #4: Add workaround for missing focused property in outputs

If there is an inactive input, then the `focused` property may be missing in sway's response to a `get_output` message.
This fix uses a feature of serde where default values for missing fields can be defined.
Here, the `Default::default` for booleans is used, which is `false`.
This commit is contained in:
Daniel Albert 2022-05-22 19:10:37 +00:00 committed by Daniel Albert
parent 06eb9d29c2
commit 2497f0519f

View file

@ -105,6 +105,7 @@ fn check_success(stream: &UnixStream) {
#[derive(Serialize, Deserialize)]
struct Output {
name: String,
#[serde(default)]
focused: bool,
active: bool,
}