Skip to content

Commit

Permalink
Timeout color-scheme request
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Apr 1, 2023
1 parent 59ae0e9 commit 21b54c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::process::Command;
pub(crate) fn prefer_dark() -> bool {
// outputs something like: `variant variant uint32 1`
let stdout = Command::new("dbus-send")
.arg("--reply-timeout=100")
.arg("--print-reply=literal")
.arg("--dest=org.freedesktop.portal.Desktop")
.arg("/org/freedesktop/portal/desktop")
Expand All @@ -15,5 +16,10 @@ pub(crate) fn prefer_dark() -> bool {
.ok()
.and_then(|out| String::from_utf8(out.stdout).ok());

if matches!(stdout, Some(ref s) if s.is_empty()) {
log::error!("XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme");
println!("XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme");
}

matches!(stdout, Some(s) if s.trim().ends_with("uint32 1"))
}

0 comments on commit 21b54c1

Please sign in to comment.