Skip to content

Commit

Permalink
Add --launch and --electron
Browse files Browse the repository at this point in the history
  • Loading branch information
Syer10 committed Aug 13, 2024
1 parent 2fe6b41 commit b41fe1a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/kotlin/suwayomi/tachidesk/launcher/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.github.weisj.darklaf.theme.event.ThemeChangeEvent
import com.github.weisj.darklaf.theme.event.ThemeChangeListener
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -46,7 +47,7 @@ import javax.swing.JFrame
import javax.swing.JOptionPane
import kotlin.system.exitProcess

suspend fun main() {
suspend fun main(args: Array<String>) {
Thread.setDefaultUncaughtExceptionHandler { _, e ->
val option = JOptionPane.showOptionDialog(
null,
Expand Down Expand Up @@ -74,6 +75,12 @@ suspend fun main() {
val scope = MainScope()
val vm = LauncherViewModel()

if (args.contains("--launch")) {
vm.launch(forceElectron = args.contains("--electron"))
delay(Long.MAX_VALUE)
return
}

withContext(Dispatchers.Swing.immediate) {
setupTheme(vm)

Expand Down

0 comments on commit b41fe1a

Please sign in to comment.