From dc754cbc9763b3ea6979ed55bd4e8030fe073078 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 11 Jan 2019 01:54:49 +0000 Subject: Check DISPLAY environment variable in default_backend This patch changes the default_backend to also check the DISPLAY environment variable. If it is set, there probably is a X server running, so we try to use the zenity backend. Otherwise, the dialog backend is used. --- src/backends/zenity.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/backends/zenity.rs') diff --git a/src/backends/zenity.rs b/src/backends/zenity.rs index 4bf862b..0730c64 100644 --- a/src/backends/zenity.rs +++ b/src/backends/zenity.rs @@ -59,6 +59,10 @@ impl Zenity { self.timeout = Some(timeout.to_string()); } + pub(crate) fn is_available() -> bool { + super::is_available("zenity") + } + fn execute(&self, args: Vec<&str>, title: &Option) -> Result { let mut command = process::Command::new("zenity"); -- cgit v1.2.1