diff --git a/Readme.md b/Readme.md index 9c31f46..7edf2dd 100644 --- a/Readme.md +++ b/Readme.md @@ -75,6 +75,7 @@ These settings are used only when bundling Linux compatible packages (currently field in the `.desktop` file. For example if the binary is called `my_program` and `linux_exec_args = "%f"` then the Exec filed will be `Exec=my_program %f`. Find out more from the [specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables) +* `linux_use_terminal`: A boolean variable indicating the app is a console app or a gui app, default it's set to false. ### Debian-specific settings diff --git a/src/bundle/deb_bundle.rs b/src/bundle/deb_bundle.rs index 2e6f135..b81f125 100644 --- a/src/bundle/deb_bundle.rs +++ b/src/bundle/deb_bundle.rs @@ -129,7 +129,7 @@ fn generate_desktop_file(settings: &Settings, data_dir: &Path) -> ::Result<()> { write!(file, "Exec={}\n", exec)?; write!(file, "Icon={}\n", bin_name)?; write!(file, "Name={}\n", settings.bundle_name())?; - write!(file, "Terminal=false\n")?; + write!(file, "Terminal={}\n", settings.linux_use_terminal().unwrap_or(false))?; write!(file, "Type=Application\n")?; write!(file, "MimeType={}\n", mime_types)?; // The `Version` field is omitted on pupose. See `generate_control_file` for specifying diff --git a/src/bundle/settings.rs b/src/bundle/settings.rs index db42125..4662b9c 100644 --- a/src/bundle/settings.rs +++ b/src/bundle/settings.rs @@ -76,6 +76,7 @@ struct BundleSettings { // OS-specific settings: linux_mime_types: Option>, linux_exec_args: Option, + linux_use_terminal: Option, deb_depends: Option>, osx_frameworks: Option>, osx_minimum_system_version: Option, @@ -288,6 +289,8 @@ impl Settings { /// Returns the path to the binary being bundled. pub fn binary_path(&self) -> &Path { &self.binary_path } + pub fn bundle_settings(&self) -> BundleSettings { self.bundle_settings.clone() } + /// If a specific package type was specified by the command-line, returns /// that package type; otherwise, if a target triple was specified by the /// command-line, returns the native package type(s) for that target; @@ -420,6 +423,10 @@ impl Settings { } } + pub fn linux_use_terminal(&self) -> Option { + self.bundle_settings.linux_use_terminal + } + pub fn linux_exec_args(&self) -> Option<&str> { self.bundle_settings.linux_exec_args.as_ref().map(String::as_str) }