From 7052d8b365b91309451b5032a7d2fa06316c2758 Mon Sep 17 00:00:00 2001 From: naman-crabnebula Date: Tue, 23 Jul 2024 04:38:44 +0530 Subject: [PATCH] Add File Association support by default --- .changes/bundler-fix-file-association.md | 5 +++++ tooling/bundler/src/bundle/linux/freedesktop.rs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changes/bundler-fix-file-association.md diff --git a/.changes/bundler-fix-file-association.md b/.changes/bundler-fix-file-association.md new file mode 100644 index 000000000..7cdbacc25 --- /dev/null +++ b/.changes/bundler-fix-file-association.md @@ -0,0 +1,5 @@ +--- +"tauri-bundler": "patch:feat" +--- + +Add support for File Association in Linux by default. diff --git a/tooling/bundler/src/bundle/linux/freedesktop.rs b/tooling/bundler/src/bundle/linux/freedesktop.rs index 9fc015692..398aa7024 100644 --- a/tooling/bundler/src/bundle/linux/freedesktop.rs +++ b/tooling/bundler/src/bundle/linux/freedesktop.rs @@ -97,6 +97,8 @@ pub fn generate_desktop_file( data_dir: &Path, ) -> crate::Result<(PathBuf, PathBuf)> { let bin_name = settings.main_binary_name(); + // %F is to enable file association for the application. + let exec_command = format!("{} %F", bin_name); let desktop_file_name = format!("{bin_name}.desktop"); let path = PathBuf::from("usr/share/applications").join(desktop_file_name); let dest_path = PathBuf::from("/").join(&path); @@ -159,7 +161,7 @@ pub fn generate_desktop_file( } else { None }, - exec: bin_name, + exec: &exec_command, icon: bin_name, name: settings.product_name(), mime_type,