fix: take user's Added Association into account when hiding apps
This commit is contained in:
parent
4ac289f40a
commit
42577aa467
2 changed files with 21 additions and 6 deletions
|
|
@ -2307,7 +2307,7 @@ impl App {
|
||||||
.mime_app_cache
|
.mime_app_cache
|
||||||
.apps()
|
.apps()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|mime_app| !mime_app.no_display)
|
.filter(|mime_app| !mime_app.no_display())
|
||||||
.filter(|&mime_app| dedupe.insert(&mime_app.id))
|
.filter(|&mime_app| dedupe.insert(&mime_app.id))
|
||||||
.map(|mime_app| (mime_app, MimeAppMatch::Other))
|
.map(|mime_app| (mime_app, MimeAppMatch::Other))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ pub struct MimeApp {
|
||||||
icon_name: Box<str>,
|
icon_name: Box<str>,
|
||||||
icon: std::sync::OnceLock<widget::icon::Handle>,
|
icon: std::sync::OnceLock<widget::icon::Handle>,
|
||||||
is_default: Arc<AtomicBool>,
|
is_default: Arc<AtomicBool>,
|
||||||
pub no_display: bool,
|
no_display: Arc<AtomicBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MimeApp {
|
impl MimeApp {
|
||||||
|
|
@ -200,7 +200,11 @@ impl MimeApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_default(&self) -> bool {
|
pub fn is_default(&self) -> bool {
|
||||||
self.is_default.load(atomic::Ordering::SeqCst)
|
self.is_default.load(atomic::Ordering::Relaxed)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn no_display(&self) -> bool {
|
||||||
|
self.no_display.load(atomic::Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn icon(&self) -> widget::icon::Handle {
|
pub fn icon(&self) -> widget::icon::Handle {
|
||||||
|
|
@ -277,9 +281,7 @@ impl MimeAppCache {
|
||||||
icon_name: desktop_entry.icon().unwrap_or_default().into(),
|
icon_name: desktop_entry.icon().unwrap_or_default().into(),
|
||||||
icon: std::sync::OnceLock::new(),
|
icon: std::sync::OnceLock::new(),
|
||||||
is_default: Arc::new(AtomicBool::new(false)),
|
is_default: Arc::new(AtomicBool::new(false)),
|
||||||
no_display: desktop_entry
|
no_display: Arc::new(AtomicBool::new(false)),
|
||||||
.mime_type()
|
|
||||||
.is_none_or(|supported| supported.is_empty()),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tracing::info!(target: "mime-apps", id = app.id, "detected desktop entry");
|
tracing::info!(target: "mime-apps", id = app.id, "detected desktop entry");
|
||||||
|
|
@ -364,6 +366,19 @@ impl MimeAppCache {
|
||||||
tracing::debug!(target: "mime-apps", mime = mime.essence_str(), apps = ?(cache.iter().map(|app| &*app.id).collect::<Vec<&str>>()), "mime defaults found")
|
tracing::debug!(target: "mime-apps", mime = mime.essence_str(), apps = ?(cache.iter().map(|app| &*app.id).collect::<Vec<&str>>()), "mime defaults found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let associated: rustc_hash::FxHashSet<&str> = self
|
||||||
|
.cache
|
||||||
|
.values()
|
||||||
|
.flatten()
|
||||||
|
.map(|app| app.id.as_str())
|
||||||
|
.collect();
|
||||||
|
for app in &self.apps {
|
||||||
|
app.no_display.store(
|
||||||
|
!associated.contains(app.id.as_str()),
|
||||||
|
atomic::Ordering::Relaxed,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let elapsed = start.elapsed();
|
let elapsed = start.elapsed();
|
||||||
tracing::info!(target: "mime-apps", "loaded mime app cache in {elapsed:?}");
|
tracing::info!(target: "mime-apps", "loaded mime app cache in {elapsed:?}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue