Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ plist = "1"
ureq = { version = "3", default-features = false, features = ["gzip"] }

[target."cfg(target_os = \"linux\")".dependencies]
freedesktop_entry_parser = "1.3"
freedesktop_entry_parser = "2.0"

[target."cfg(unix)".dependencies]
libc = "0.2"
Expand Down
9 changes: 2 additions & 7 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ use serde::{Deserialize, Serialize};
#[cfg(feature = "cli")]
use structopt::clap::arg_enum;

#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub enum NoiseLevel {
#[default]
Polite,
LoudAndProud,
FranklyQuitePedantic,
}

impl Default for NoiseLevel {
fn default() -> Self {
Self::Polite
}
}

impl NoiseLevel {
pub fn from_occurrences(occurrences: u64) -> Self {
match occurrences {
Expand Down
11 changes: 5 additions & 6 deletions src/os/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ impl Application {
// We absolutely want the Exec value
exec_command: parsed_entry
.section("Desktop Entry")
.attr("Exec")
.and_then(|s| s.attr("Exec").first())
.ok_or(DetectEditorError::ExecFieldMissing)?
.into(),
// The icon is optional, we try getting it because the Exec value may need it
icon: parsed_entry
.section("Desktop Entry")
.attr("Icon")
.and_then(|s| s.attr("Icon").first())
.map(Into::into),
xdg_entry_path: entry_filepath,
})
Expand Down Expand Up @@ -136,15 +136,14 @@ pub fn open_file_with(

let command_parts = entry
.section("Desktop Entry")
.attr("Exec")
.and_then(|s| s.attr("Exec").first())
.map(|str_entry| {
let osstring_entry: OsString = str_entry.into();
xdg::parse_command(
&osstring_entry,
str_entry.as_ref(),
path_str,
entry
.section("Desktop Entry")
.attr("Icon")
.and_then(|s| s.attr("Icon").first())
.map(|s| s.as_ref()),
Some(&entry_path),
)
Expand Down
4 changes: 2 additions & 2 deletions src/os/linux/xdg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ pub fn find_entry_by_app_name(
if let Ok(parsed) = parse_entry(&entry_path) {
if parsed
.section("Desktop Entry")
.attr("Name")
.map(str::as_ref)
.and_then(|s| s.attr("Name").first())
.map(|s| s.as_ref())
== Some(app_name)
{
return Some((parsed, entry_path));
Expand Down