Skip to content

Commit

Permalink
Differentiate between types of apps in debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nokyan committed Jul 28, 2024
1 parent 829e5e9 commit b4b7826
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/utils/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl App {

let exec = desktop_entry.get("Exec");
let is_flatpak = exec
.map(|exec| exec.starts_with("/usr/bin/flatpak --run"))
.map(|exec| exec.starts_with("/usr/bin/flatpak run"))
.unwrap_or_default();
let commandline = exec
.and_then(|exec| {
Expand Down Expand Up @@ -292,20 +292,31 @@ impl App {
let is_snap = desktop_entry.get("X-SnapInstanceName").is_some();

let containerization = if is_flatpak {
debug!(
"Found Flatpak app \"{display_name}\" (ID: {id}) at {} with commandline `{}` (detected executable name: {})",
file_path.to_string_lossy(),
commandline.as_ref().unwrap_or(&"<None>".into()),
executable_name.as_ref().unwrap_or(&"<None>".into()),
);
Containerization::Flatpak
} else if is_snap {
debug!(
"Found Snap app \"{display_name}\" (ID: {id}) at {} with commandline `{}` (detected executable name: {})",
file_path.to_string_lossy(),
commandline.as_ref().unwrap_or(&"<None>".into()),
executable_name.as_ref().unwrap_or(&"<None>".into()),
);
Containerization::Snap
} else {
debug!(
"Found native app \"{display_name}\" (ID: {id}) at {} with commandline `{}` (detected executable name: {})",
file_path.to_string_lossy(),
commandline.as_ref().unwrap_or(&"<None>".into()),
executable_name.as_ref().unwrap_or(&"<None>".into()),
);
Containerization::None
};

debug!(
"Found app \"{display_name}\" (ID: {id}) at {} with commandline `{}` (detected executable name: {})",
file_path.to_string_lossy(),
commandline.as_ref().unwrap_or(&"<None>".into()),
executable_name.as_ref().unwrap_or(&"<None>".into()),
);

let id = Some(id);

Ok(App {
Expand Down

0 comments on commit b4b7826

Please sign in to comment.