@@ -2,12 +2,13 @@ package com.jdamcd.arrivals.desktop
2
2
3
3
import androidx.compose.runtime.collectAsState
4
4
import androidx.compose.runtime.getValue
5
+ import androidx.compose.ui.Alignment
5
6
import androidx.compose.ui.input.key.Key
6
7
import androidx.compose.ui.input.key.key
7
8
import androidx.compose.ui.unit.DpSize
8
9
import androidx.compose.ui.unit.dp
9
10
import androidx.compose.ui.window.Window
10
- import androidx.compose.ui.window.WindowPlacement
11
+ import androidx.compose.ui.window.WindowPosition
11
12
import androidx.compose.ui.window.application
12
13
import androidx.compose.ui.window.rememberWindowState
13
14
import com.jdamcd.arrivals.Arrivals
@@ -18,10 +19,12 @@ private val koin = initKoin().koin
18
19
19
20
fun main (args : Array <String >) = application {
20
21
val fixWindow = args.contains(" -pi" )
22
+ val width = dimenFromArg(args, 1 ) ? : 1280
23
+ val height = dimenFromArg(args, 2 ) ? : 400
21
24
22
25
val windowState = rememberWindowState(
23
- placement = if (fixWindow) WindowPlacement . Maximized else WindowPlacement . Floating ,
24
- size = DpSize (1280 .dp, 400 .dp)
26
+ position = WindowPosition ( Alignment . Center ) ,
27
+ size = DpSize (width .dp, height .dp)
25
28
)
26
29
27
30
val viewModel = ArrivalsViewModel (koin.get<Arrivals >())
@@ -43,3 +46,5 @@ fun main(args: Array<String>) = application {
43
46
ArrivalsView (state, viewModel::refresh)
44
47
}
45
48
}
49
+
50
+ private fun dimenFromArg (args : Array <String >, index : Int ): Int? = if (args.size > index) args[index].toIntOrNull() else null
0 commit comments