Auto Launcher
[!NOTE] This crate was forked from zzzgydi/auto-launch, adding more platforms support and features.
Auto launch any application or executable at startup. Supports Windows, macOS, and Linux.
If you find any bugs, welcome to PR or issue.
Usage
The parameters of AutoLaunch::new are different on each platform.
See the function definition or the demo below for details.
AutoLaunchBuilder helps to eliminate the constructor difference on various platforms.
use *;
Linux
Linux supports two ways to achieve auto launch:
- XDG Autostart: Uses
.desktopfiles in~/.config/autostart/(default) - systemd: Uses systemd user services in
~/.config/systemd/user/
use ;
macOS
macOS supports two ways to achieve auto launch:
- Launch Agent: Uses plist files in
~/Library/LaunchAgents/(default) - AppleScript: Uses AppleScript to add login items
Note:
- The
app_pathshould be a absolute path and exists. Otherwise, it will cause an error whenenable. - In case using AppleScript, the
app_nameshould be same as the basename ofapp_path, or it will be corrected automatically. - In case using AppleScript, only
--hiddenand--minimizedinargsare valid, which means that hide the app on launch.
use ;
Windows
On Windows, it will add registry entries under \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run.
It will also detect if startup is disabled inside Task Manager or the Windows settings UI, and can re-enable after being disabled in one of those.
use AutoLaunch;
License
MIT License. See the License file for details.