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

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright © 2021 System76
use freedesktop_desktop_entry::get_languages_from_env;
use futures::prelude::*;
use pop_launcher::*;
use std::path::PathBuf;
@ -123,7 +124,7 @@ fn detect_terminal() -> (PathBuf, &'static str) {
freedesktop_desktop_entry::Iter::new(freedesktop_desktop_entry::default_paths())
.filter_map(|path| {
std::fs::read_to_string(&path).ok().and_then(|input| {
DesktopEntry::decode(&path, &input).ok().and_then(|de| {
DesktopEntry::from_str(&path, &input, &get_languages_from_env()).ok().and_then(|de| {
if de.no_display()
|| de
.categories()