Skip to content

Commit

Permalink
taking into account the no-display label in desktop files
Browse files Browse the repository at this point in the history
Some time, there are some `.desktop` file that doesn't want
to be displayed. Like this :

```ìni
NoDisplay=true
```

Removing them, eliminates a lot of noises in the app search
  • Loading branch information
luxluth committed Dec 18, 2024
1 parent a4aab81 commit a9bb3ed
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@ pub fn collect_apps() -> Vec<AppEntry> {
.into_iter()
.filter_map(|p| {
if let Ok(entry) = DesktopEntry::from_path(p.clone(), Some(&locales)) {
return Some(AppEntry {
exec: entry.exec().unwrap_or_default().to_string(),
need_terminal: entry.terminal(),
icon: entry
.icon()
.unwrap_or("application-x-executable")
.to_string(),
name: entry.name(&locales).unwrap_or_default().to_string(),
description: entry.comment(&locales).unwrap_or_default().to_string(),
_path: p,
});
if entry.no_display() {
return None;
} else {
return Some(AppEntry {
exec: entry.exec().unwrap_or_default().to_string(),
need_terminal: entry.terminal(),
icon: entry
.icon()
.unwrap_or("application-x-executable")
.to_string(),
name: entry.name(&locales).unwrap_or_default().to_string(),
description: entry.comment(&locales).unwrap_or_default().to_string(),
_path: p,
});
}
}

None
Expand Down

0 comments on commit a9bb3ed

Please sign in to comment.