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

refactor(config): use universal-config crate.

XML config is not supported.
This commit is contained in:
Jake Stanger 2023-03-19 16:17:31 +00:00
parent 01a36a9476
commit ecdd71a43d
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
4 changed files with 112 additions and 176 deletions

View file

@ -32,6 +32,7 @@ use tokio::task::block_in_place;
use crate::error::ExitCode;
use clients::wayland::{self, WaylandClient};
use tracing::{debug, error, info};
use universal_config::ConfigLoader;
const GTK_APP_ID: &str = "dev.jstanger.ironbar";
const VERSION: &str = env!("CARGO_PKG_VERSION");
@ -57,13 +58,19 @@ async fn main() -> Result<()> {
|display| display,
);
let config = match Config::load() {
let config_res = match env::var("IRONBAR_CONFIG") {
Ok(path) => ConfigLoader::load(path),
Err(_) => ConfigLoader::new("ironbar").find_and_load(),
};
let config = match config_res {
Ok(config) => config,
Err(err) => {
error!("{:?}", err);
exit(ExitCode::Config as i32)
}
};
debug!("Loaded config file");
if let Err(err) = create_bars(app, &display, wayland_client, &config) {