improv: use freedesktop_entry to search applications

This commit is contained in:
wiiznokes 2024-06-05 23:25:49 +02:00 • committed by GitHub
parent 65c1742a88
commit 2449943863
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 146 additions and 99 deletions

View file

@ -2,7 +2,7 @@
// Copyright © 2021 System76
use crate::*;
use freedesktop_desktop_entry as fde;
use freedesktop_desktop_entry::{self as fde, get_languages_from_env};
use futures::StreamExt;
use pop_launcher::*;
use serde::{Deserialize, Serialize};
@ -139,7 +139,7 @@ impl<W: AsyncWrite + Unpin> App<W> {
if let Some(name) = path.file_stem() {
if desktop_entry == name {
if let Ok(data) = fs::read_to_string(path) {
if let Ok(entry) = fde::DesktopEntry::decode(path, &data) {
if let Ok(entry) = fde::DesktopEntry::from_str(path, &data, &get_languages_from_env()) {
if let Some(icon) = entry.icon() {
icon_name = Cow::Owned(icon.to_owned());
}