From 825e9cc1c3343700cc4195ab37763d09863315a4 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sat, 17 Jul 2021 04:04:09 -0400 Subject: [PATCH] general: Fix Linux shortcuts Makes them function even if it's missing the icon. --- src/native/mod.rs | 4 ++-- src/tasks/install_desktop_shortcut.rs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/native/mod.rs b/src/native/mod.rs index 5f7e13d..6714007 100644 --- a/src/native/mod.rs +++ b/src/native/mod.rs @@ -333,8 +333,8 @@ mod natives { }; path.push(format!("{}.desktop", slugify(name))); // file name let desktop_file = format!( - "[Desktop Entry]\nName={}\nExec=\"{}\" {}\nComment={}\nPath={}\n", - name, target, args, description, working_dir + "[Desktop Entry]\nType=Application\nName={}\nExec=\"{}\" {}\nComment={}\nPath={}\nIcon=yuzu\n", + name, target, args, description, working_dir ); let desktop_f = File::create(path); let mut desktop_f = match desktop_f { diff --git a/src/tasks/install_desktop_shortcut.rs b/src/tasks/install_desktop_shortcut.rs index f4d71f3..2347bb1 100644 --- a/src/tasks/install_desktop_shortcut.rs +++ b/src/tasks/install_desktop_shortcut.rs @@ -13,6 +13,8 @@ use logging::LoggingErrors; #[cfg(windows)] use native::create_desktop_shortcut; +#[cfg(target_os = "linux")] +use native::create_shortcut; pub struct InstallDesktopShortcutTask { pub name: String, @@ -71,7 +73,6 @@ impl Task for InstallDesktopShortcutTask { "maintenancetool" }; - #[cfg(windows)] for shortcut in package.shortcuts { let tool_path = path.join(platform_extension); let tool_path = tool_path @@ -83,6 +84,7 @@ impl Task for InstallDesktopShortcutTask { .to_str() .log_expect("Unable to build shortcut metadata (exe)"); + #[cfg(windows)] installed_files.push(create_desktop_shortcut( &shortcut.name, &shortcut.description, @@ -92,6 +94,17 @@ impl Task for InstallDesktopShortcutTask { &starting_dir, exe_path, )?); + + #[cfg(target_os = "linux")] + installed_files.push(create_shortcut( + &shortcut.name, + &shortcut.description, + tool_path, + // TODO: Send by list + &format!("--launcher \"{}\"", exe_path), + &starting_dir, + exe_path, + )?); } // Update the installed packages shortcuts information in the database