Skip to content

Commit

Permalink
print a more user-friendly error when running on unsupported compositor
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxVerevkin committed Nov 1, 2024
1 parent 0e23317 commit bba9b25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wayland.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io::ErrorKind;
use std::os::fd::{AsRawFd, RawFd};

use anyhow::Result;
use anyhow::{bail, Result};

use wayrs_client::cstr;
use wayrs_client::global::*;
Expand All @@ -27,7 +27,9 @@ impl Wayland {
let (mut conn, globals) = Connection::connect_and_collect_globals()?;
conn.add_registry_cb(wl_registry_cb);

let gamma_manager = globals.bind(&mut conn, 1)?;
let Ok(gamma_manager) = globals.bind(&mut conn, 1) else {
bail!("Your Wayland compositor is not supported because it does not implement the wlr-gamma-control-unstable-v1 protocol");
};

let outputs = globals
.iter()
Expand Down

0 comments on commit bba9b25

Please sign in to comment.