Improve error message for missing default monitor on wayland

This commit is contained in:
elkowar 2022-05-16 12:04:29 +02:00
parent 78ae9cb00a
commit c0dcc43336
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F

View file

@ -456,7 +456,9 @@ fn get_monitor_geometry(n: Option<i32>) -> Result<gdk::Rectangle> {
let display = gdk::Display::default().expect("could not get default display");
let monitor = match n {
Some(n) => display.monitor(n).with_context(|| format!("Failed to get monitor with index {}", n))?,
None => display.primary_monitor().context("Failed to get primary monitor from GTK")?,
None => display
.primary_monitor()
.context("Failed to get primary monitor from GTK. Try explicitly specifying the monitor on your window.")?,
};
Ok(monitor.geometry())
}