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

refactor: standardise error messages

This commit is contained in:
Jake Stanger 2022-12-11 21:31:45 +00:00
parent fd2d7e5c7a
commit 9d5049dde0
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
19 changed files with 117 additions and 110 deletions

View file

@ -3,6 +3,7 @@ mod bridge_channel;
mod clients;
mod config;
mod dynamic_string;
mod error;
mod icon;
mod logging;
mod modules;
@ -30,6 +31,7 @@ use crate::error::ExitCode;
use clients::wayland::{self, WaylandClient};
use tracing::{debug, error, info};
const GTK_APP_ID: &str = "dev.jstanger.ironbar";
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[tokio::main]
@ -41,9 +43,7 @@ async fn main() -> Result<()> {
let wayland_client = wayland::get_client().await;
let app = Application::builder()
.application_id("dev.jstanger.ironbar")
.build();
let app = Application::builder().application_id(GTK_APP_ID).build();
app.connect_activate(move |app| {
let display = Display::default().map_or_else(
@ -112,8 +112,12 @@ fn create_bars(
let num_monitors = display.n_monitors();
for i in 0..num_monitors {
let monitor = display.monitor(i).ok_or_else(|| Report::msg("GTK and Sway are reporting a different set of outputs - this is a severe bug and should never happen"))?;
let output = outputs.get(i as usize).ok_or_else(|| Report::msg("GTK and Sway are reporting a different set of outputs - this is a severe bug and should never happen"))?;
let monitor = display
.monitor(i)
.ok_or_else(|| Report::msg(error::ERR_OUTPUTS))?;
let output = outputs
.get(i as usize)
.ok_or_else(|| Report::msg(error::ERR_OUTPUTS))?;
let monitor_name = &output.name;
// TODO: Could we use an Arc<Config> or `Cow<Config>` here to avoid cloning?