Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vinceglb/autolaunch
Launch your Kotlin / KMP app automatically on system startup â¨
https://github.com/vinceglb/autolaunch
kmp kotlin kotlin-desktop kotlin-jvm kotlin-multiplatform
Last synced: about 18 hours ago
JSON representation
Launch your Kotlin / KMP app automatically on system startup â¨
- Host: GitHub
- URL: https://github.com/vinceglb/autolaunch
- Owner: vinceglb
- License: mit
- Created: 2024-02-21T19:46:22.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-12-23T12:42:59.000Z (about 1 month ago)
- Last Synced: 2025-01-17T05:05:32.384Z (8 days ago)
- Topics: kmp, kotlin, kotlin-desktop, kotlin-jvm, kotlin-multiplatform
- Language: Kotlin
- Homepage:
- Size: 148 KB
- Stars: 87
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
AutoLaunch Kotlin
Lightweight Kotlin library to enable auto-launch on system startup.
## đĻ Installation
AutoLaunch targets JVM platform.
```kotlin
repositories {
mavenCentral()
}dependencies {
implementation("io.github.vinceglb:auto-launch:0.4.0")
}
```## đ Quick start
```kotlin
// Create an instance of AutoLaunch.
val autoLaunch = AutoLaunch(appPackageName = "com.autolaunch.sample")// Enable or disable launch at startup.
autoLaunch.enable()
autoLaunch.disable()// Check if auto launch is enabled.
val isEnabled = autoLaunch.isEnabled()// Check if the app was started by autostart.
val isStartedViaAutostart = autoLaunch.isStartedViaAutostart()
```> âšī¸ **Note**: To test the auto-launch feature, your application must be distributed. With Compose Multiplatform, you can run a distributable package using `./gradlew :runDistributable`
## đ Advanced
### âĄī¸ Convenient methods
```kotlin
// Get the app resolved executable path
val appPath = AutoLaunch.resolvedExecutable// Determine whether the app is distributable
val isDistributable = AutoLaunch.isRunningFromDistributable
```### đ§ Customizing the application path
By default, your application path is detected automatically. You can customize the application path that will be launched at startup:
- MacOS: something like `/Applications/JetBrains Toolbox.app/Contents/MacOS/jetbrains-toolbox`.
- Windows: the path to the `.exe` file.```kotlin
val autoLaunch = AutoLaunch(
appPackageName = "com.autolaunch.sample",
appPath = "/path/to/your/app"
)
```## ⨠Behind the scene
Depending on the platform, AutoLaunch uses the following techniques:
- MacOS: create a plist file in `~/Library/LaunchAgents/` directory.
- Windows: create a registry key in `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run`.
- Linux: create a `.desktop` file in `~/.config/autostart/` directory.## đą Sample project
You can find a sample project in the `sample` directory. Run the following command to test the auto-launch feature:
```shell
:sample:runDistributable
```## đ Contribution
Your contributions are welcome đĨ Here are some features that are missing:
- [x] Linux support
- [ ] Pass optional arguments to the application---
Made with â¤ī¸ by Vince