I try to write a JavaFX application (TornadoFX, cause I use kotlin) that can open multiple sub windows. Each window should be displayed in tiling mode in i3wm. On other non tiling window manager it should start maximized. But currently it always opens up in floating mode. I thought this could be archived by maximize the window. So I tried the following onDock()
method in two variants. But neither variant worked.
class FileMapFragment : Fragment() {
val file:Path by param()
final override val root =
borderpane {
...
}
override fun onDock() {
//Variant 1
val screen = Screen.getPrimary()
val bounds = screen.visualBounds
currentStage?.x = bounds.minX
currentStage?.y = bounds.minY
currentStage?.width = bounds.width
currentStage?.height = bounds.height
//Variant 2
currentStage?.isMaximized = true
currentStage?.isIconified = true
}
}
This fragment is opened by following code
find<FileMapFragment>(
mapOf(
FileMapFragment::file to file
)
).openWindow()
With Variant 1
it is in a pseudo fullscreen mode but not in tiling mode. Does anybody know a solution? (I think this is a general JavaFX question and not specificly relateted to kotlin/TornadoFX)
i3 seemes to handle windows with a parent window as floating windows. To start a window in tiling mode (or allow minimize/maximize in other window managers) you have to set the parent window to null. In this example the following will work:
find<FileMapFragment>(
mapOf(
FileMapFragment::file to file
)
).openWindow(owner = null)