feat(autostart): add app_name builder method for custom application naming

- Introduced a new builder method app_name() to customize the application name in the autostart entry.
- Updated app_name handling in the Builder struct to accept a generic string type.

This enhancement allows for greater flexibility in defining application names for autostart configurations.
pull/2707/head
Tunglies 2 months ago
parent f9b2e6ef78
commit 4a0c1fff9b

@ -0,0 +1,5 @@
---
autostart: minor
---
Added a new builder method app_name() to allow customizing the application name in the autostart entry.

@ -164,8 +164,8 @@ impl Builder {
/// .app_name("My Custom Name")) /// .app_name("My Custom Name"))
/// .build(); /// .build();
/// ``` /// ```
pub fn app_name(mut self, app_name: &str) -> Self { pub fn app_name<S: Into<String>>(mut self, app_name: S) -> Self {
self.app_name = Some(app_name.to_string()); self.app_name = Some(app_name.into());
self self
} }
@ -175,8 +175,11 @@ impl Builder {
.setup(move |app, _api| { .setup(move |app, _api| {
let mut builder = AutoLaunchBuilder::new(); let mut builder = AutoLaunchBuilder::new();
let app_name = self.app_name.unwrap_or(app.package_info().name.clone()); let app_name = self
builder.set_app_name(&app_name); .app_name
.as_ref()
.unwrap_or_else(|| &app.package_info().name);
builder.set_app_name(app_name);
builder.set_args(&self.args); builder.set_args(&self.args);

Loading…
Cancel
Save