diff --git a/build.gradle.kts b/build.gradle.kts index aa23b08..c42af0c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { kotlin("multiplatform") @@ -25,7 +26,7 @@ kotlin { sourceSets { val jvmMain by getting { dependencies { - implementation(compose.desktop.windows_x64) + implementation(compose.desktop.currentOs) implementation("org.jetbrains.compose.ui:ui-graphics-desktop:1.1.0") implementation("org.jetbrains.compose.ui:ui-geometry-desktop:1.1.0") implementation("org.jetbrains.compose.foundation:foundation-desktop:1.1.0") @@ -36,13 +37,21 @@ kotlin { } } +tasks.withType().configureEach { + kotlinOptions.freeCompilerArgs += "-opt-in=RequiresOptIn" +} + compose.desktop { application { mainClass = "MainKt" nativeDistributions { - targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + targetFormats(TargetFormat.Exe) packageName = "pomodoro" packageVersion = "1.0.0" + + windows { + iconFile.set(File("icon.ico")) + } } } } diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..1ba30b1 Binary files /dev/null and b/icon.ico differ diff --git a/src/jvmMain/kotlin/Main.kt b/src/jvmMain/kotlin/Main.kt index f7a1eb4..7d347bf 100644 --- a/src/jvmMain/kotlin/Main.kt +++ b/src/jvmMain/kotlin/Main.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalComposeUiApi::class) + import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -17,11 +19,10 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier -import androidx.compose.ui.input.key.Key +import androidx.compose.ui.input.key.Key.Companion.Enter import androidx.compose.ui.input.key.KeyEventType import androidx.compose.ui.input.key.isAltPressed import androidx.compose.ui.input.key.isCtrlPressed -import androidx.compose.ui.input.key.isMetaPressed import androidx.compose.ui.input.key.isShiftPressed import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.type @@ -44,7 +45,6 @@ import shared.domain.Navigation import tasks.presentation.TaskListScreen import tasks.presentation.TaskListViewModel -@OptIn(ExperimentalComposeUiApi::class) fun main() = application { val state = remember { MainState() } val mainViewModel = state.mainViewModel @@ -72,7 +72,7 @@ fun main() = application { shiftPressed = event.isShiftPressed, altPressed = event.isAltPressed, ctrlPressed = event.isCtrlPressed, - enterPressed = event.key == Key.Enter && event.type == KeyEventType.KeyDown + enterPressed = event.key == Enter && event.type == KeyEventType.KeyDown ) if (combo.anyControlKeyPressed) { mainViewModel.obtainKeyComboKey(combo) @@ -103,6 +103,8 @@ fun main() = application { ) } } + } else { + exitApplication() } }