1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-20 08:11:03 +02:00

refactor: split bar/top-level config structs

This allows for some options which are not actually bar-level to be separated, which makes some work moving forward a little easier and keeps things cleaner.
This commit is contained in:
Jake Stanger 2024-03-29 21:48:44 +00:00
parent 4aab6d5061
commit 706e040e25
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
5 changed files with 81 additions and 56 deletions

View file

@ -1,4 +1,4 @@
use super::{BarPosition, Config, MonitorConfig};
use super::{BarConfig, BarPosition, MonitorConfig};
use color_eyre::{Help, Report};
use gtk::Orientation;
use serde::{Deserialize, Deserializer};
@ -13,11 +13,11 @@ impl<'de> Deserialize<'de> for MonitorConfig {
let content =
<serde::__private::de::Content as serde::Deserialize>::deserialize(deserializer)?;
match <Config as serde::Deserialize>::deserialize(
match <BarConfig as serde::Deserialize>::deserialize(
serde::__private::de::ContentRefDeserializer::<D::Error>::new(&content),
) {
Ok(config) => Ok(Self::Single(config)),
Err(outer) => match <Vec<Config> as serde::Deserialize>::deserialize(
Err(outer) => match <Vec<BarConfig> as serde::Deserialize>::deserialize(
serde::__private::de::ContentRefDeserializer::<D::Error>::new(&content),
) {
Ok(config) => Ok(Self::Multiple(config)),