pub struct AutoLaunch { /* private fields */ }
Expand description
Implementations§
Source§impl AutoLaunch
Linux implement
impl AutoLaunch
Linux implement
Sourcepub fn new(
app_name: &str,
app_path: &str,
args: &[impl AsRef<str>],
) -> AutoLaunch
pub fn new( app_name: &str, app_path: &str, args: &[impl AsRef<str>], ) -> AutoLaunch
Create a new AutoLaunch instance
app_name
: application nameapp_path
: application pathargs
: startup args passed to the binary
§Notes
The parameters of AutoLaunch::new
are different on each platform.
Sourcepub fn enable(&self) -> Result<()>
pub fn enable(&self) -> Result<()>
Enable the AutoLaunch setting
§Errors
- failed to create dir
~/.config/autostart
- failed to create file
~/.config/autostart/{app_name}.desktop
- failed to write bytes to the file
Sourcepub fn is_enabled(&self) -> Result<bool>
pub fn is_enabled(&self) -> Result<bool>
Check whether the AutoLaunch setting is enabled
Source§impl AutoLaunch
impl AutoLaunch
Sourcepub fn is_support() -> bool
pub fn is_support() -> bool
check whether it is support the platform
§Usage
use auto_launch::AutoLaunch;
dbg!(AutoLaunch::is_support());
Sourcepub fn get_app_name(&self) -> &str
pub fn get_app_name(&self) -> &str
get the application name
Sourcepub fn get_app_path(&self) -> &str
pub fn get_app_path(&self) -> &str
get the application path
Trait Implementations§
Source§impl Clone for AutoLaunch
impl Clone for AutoLaunch
Source§fn clone(&self) -> AutoLaunch
fn clone(&self) -> AutoLaunch
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AutoLaunch
impl Debug for AutoLaunch
Source§impl PartialEq for AutoLaunch
impl PartialEq for AutoLaunch
impl Eq for AutoLaunch
impl StructuralPartialEq for AutoLaunch
Auto Trait Implementations§
impl Freeze for AutoLaunch
impl RefUnwindSafe for AutoLaunch
impl Send for AutoLaunch
impl Sync for AutoLaunch
impl Unpin for AutoLaunch
impl UnwindSafe for AutoLaunch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more