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

fix: weird behaviour when config does not exist

This commit is contained in:
Jake Stanger 2022-10-16 12:58:11 +01:00
parent b66bd788b2
commit 3c43c20c6a
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
2 changed files with 24 additions and 8 deletions

View file

@ -31,6 +31,13 @@ use wayland::WaylandClient;
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[repr(i32)]
enum ExitCode {
ErrGtkDisplay = 1,
ErrCreateBars = 2,
ErrConfig = 3
}
#[tokio::main]
async fn main() -> Result<()> {
// Disable backtraces by default
@ -58,7 +65,7 @@ async fn main() -> Result<()> {
|| {
let report = Report::msg("Failed to get default GTK display");
error!("{:?}", report);
exit(1)
exit(ExitCode::ErrGtkDisplay as i32)
},
|display| display,
);
@ -67,14 +74,14 @@ async fn main() -> Result<()> {
Ok(config) => config,
Err(err) => {
error!("{:?}", err);
Config::default()
exit(ExitCode::ErrConfig as i32)
}
};
debug!("Loaded config file");
if let Err(err) = create_bars(app, &display, wayland_client, &config) {
error!("{:?}", err);
exit(2);
exit(ExitCode::ErrCreateBars as i32);
}
debug!("Created bars");
@ -83,7 +90,7 @@ async fn main() -> Result<()> {
|| {
let report = Report::msg("Failed to locate user config dir");
error!("{:?}", report);
exit(3);
exit(ExitCode::ErrCreateBars as i32);
},
|dir| dir.join("ironbar").join("style.css"),
);