fix: use app container created by window & only create dock object from window list if a matching app info is found

This commit is contained in:
Ashley Wulber 2022-07-20 10:21:40 -04:00
parent adc02df64f
commit 83fc8893ec
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
5 changed files with 18 additions and 20 deletions

View file

@ -78,9 +78,9 @@ impl DockObject {
imp.saved.replace(is_saved);
}
pub fn from_window_list(results: BoxedWindowList) -> Self {
let appinfo = if let Some(first) = results.0.get(0) {
xdg::BaseDirectories::new()
pub fn from_window_list(results: BoxedWindowList) -> Option<Self> {
if let Some(first) = results.0.get(0) {
return xdg::BaseDirectories::new()
.expect("could not access XDG Base directory")
.get_data_dirs()
.iter_mut()
@ -100,7 +100,8 @@ impl DockObject {
.file_stem()
.and_then(|s| s.to_str().map(|s| s.to_string()))).as_ref()
{
return Some(app_info);
return Some(Object::new(&[("appinfo", &app_info), ("active", &results)])
.expect("Failed to create `DockObject`."));
}
}
}
@ -108,13 +109,9 @@ impl DockObject {
}
None
})
.next()
} else {
None
};
Object::new(&[("appinfo", &appinfo), ("active", &results)])
.expect("Failed to create `DockObject`.")
.next();
}
None
}
pub fn set_popover(&self, b: bool) {