fixing window ordering
This commit is contained in:
1 parent
8078e34a2c
commit
807d466b31
2 files changed
+18
-3
No files matched your search
@@ -91,7 +91,7 @@ fun main() {
|
||||
state = windowState,
|
||||
title = "AnyTask",
|
||||
resizable = false,
|
||||
alwaysOnTop = true,
|
||||
alwaysOnTop = !isSettingsVisible,
|
||||
undecorated = false,
|
||||
) {
|
||||
LaunchedEffect(isVisible) {
|
||||
@@ -106,6 +106,7 @@ fun main() {
|
||||
config = configResult.config,
|
||||
isVisible = isVisible,
|
||||
onDismiss = { isVisible = false },
|
||||
onSettings = { isSettingsVisible = true },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -121,6 +122,11 @@ fun main() {
|
||||
title = "AnyTask Settings",
|
||||
resizable = true,
|
||||
) {
|
||||
LaunchedEffect(Unit) {
|
||||
activateMacOsApp()
|
||||
window.toFront()
|
||||
window.requestFocus()
|
||||
}
|
||||
SettingsWindow(
|
||||
config = configResult.config,
|
||||
client = client,
|
||||
|
||||
@@ -18,12 +18,16 @@ import androidx.compose.material.Checkbox
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.DropdownMenu
|
||||
import androidx.compose.material.DropdownMenuItem
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.OutlinedButton
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -51,7 +55,7 @@ import ch.ergon.anytask.config.PropertyConfig
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun TaskWindow(client: AnyTypeApi, config: Configuration, isVisible: Boolean, onDismiss: () -> Unit) {
|
||||
fun TaskWindow(client: AnyTypeApi, config: Configuration, isVisible: Boolean, onDismiss: () -> Unit, onSettings: () -> Unit) {
|
||||
val scope = rememberCoroutineScope()
|
||||
var title by remember { mutableStateOf("") }
|
||||
var details by remember { mutableStateOf("") }
|
||||
@@ -152,9 +156,14 @@ fun TaskWindow(client: AnyTypeApi, config: Configuration, isVisible: Boolean, on
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
IconButton(onClick = onSettings) {
|
||||
Icon(Icons.Default.Settings, contentDescription = "Settings")
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
TextButton(onClick = onDismiss) { Text("Cancel") }
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Button(onClick = ::submit, enabled = title.isNotBlank() && !isLoading) {
|
||||
if (isLoading) CircularProgressIndicator(modifier = Modifier.size(16.dp), strokeWidth = 2.dp)
|
||||
else Text("Create ⌘↵")
|
||||
|
||||