fix: hide no-display apps only in other category
This commit is contained in:
parent
fc8f2b4000
commit
7c7970d0c0
2 changed files with 4 additions and 24 deletions
|
|
@ -2306,6 +2306,7 @@ impl App {
|
|||
self.mime_app_cache
|
||||
.apps()
|
||||
.iter()
|
||||
.filter(|mime_app| !mime_app.no_display)
|
||||
.filter(|&mime_app| dedupe.insert(&mime_app.id))
|
||||
.map(|mime_app| (mime_app, MimeAppMatch::Other)),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use bstr::{BString, ByteSlice, ByteVec};
|
||||
#[cfg(feature = "desktop")]
|
||||
use cosmic::desktop;
|
||||
use cosmic::widget;
|
||||
pub use mime_guess::Mime;
|
||||
#[cfg(feature = "desktop")]
|
||||
|
|
@ -186,6 +184,7 @@ pub struct MimeApp {
|
|||
pub exec: Option<String>,
|
||||
pub icon: widget::icon::Handle,
|
||||
is_default: Arc<AtomicBool>,
|
||||
pub no_display: bool,
|
||||
}
|
||||
|
||||
impl MimeApp {
|
||||
|
|
@ -211,25 +210,6 @@ impl AsRef<str> for MimeApp {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "desktop")]
|
||||
impl From<&desktop::DesktopEntryData> for MimeApp {
|
||||
fn from(app: &desktop::DesktopEntryData) -> Self {
|
||||
Self {
|
||||
id: app.id.clone(),
|
||||
path: app.path.clone(),
|
||||
name: app.name.clone(),
|
||||
exec: app.exec.clone(),
|
||||
icon: match &app.icon {
|
||||
desktop::fde::IconSource::Name(name) => {
|
||||
widget::icon::from_name(name.as_str()).size(32).handle()
|
||||
}
|
||||
desktop::fde::IconSource::Path(path) => widget::icon::from_path(path.clone()),
|
||||
},
|
||||
is_default: Arc::new(AtomicBool::new(false)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MimeAppCache {
|
||||
apps: Vec<Arc<MimeApp>>,
|
||||
cache: FxHashMap<Mime, Vec<Arc<MimeApp>>>,
|
||||
|
|
@ -271,9 +251,7 @@ impl MimeAppCache {
|
|||
list.load_from_paths(&paths);
|
||||
let locales = fde::get_languages_from_env();
|
||||
|
||||
let desktop_entries = fde::Iter::new(fde::default_paths())
|
||||
.entries(Some(&locales))
|
||||
.filter(move |de| !de.no_display());
|
||||
let desktop_entries = fde::Iter::new(fde::default_paths()).entries(Some(&locales));
|
||||
|
||||
for desktop_entry in desktop_entries {
|
||||
let name = desktop_entry
|
||||
|
|
@ -294,6 +272,7 @@ impl MimeAppCache {
|
|||
}
|
||||
},
|
||||
is_default: Arc::new(AtomicBool::new(false)),
|
||||
no_display: desktop_entry.no_display(),
|
||||
});
|
||||
|
||||
tracing::info!(target: "mime-apps", id = app.id, "detected desktop entry");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue