https://kotlinlang.org logo
Title
y

Yofou

03/03/2021, 12:12 PM
Is it possible to change the color, of the window topbar and if not is there any examples of making a custom one? I'm particularly curious if there any examples of implementing the draggable window part?
t

theapache64

03/03/2021, 12:17 PM
AFAIK, you can't directly customise the window topbar. But, you can use the
undecorated = true
flag of
Window
to hide the OS topbar, and create a
@Composable
that'd act as a toolbar. To make it draggable, you can use
WindowDraggableArea
. Here's an example
Output
f

Filip Wiesner

03/03/2021, 12:21 PM
Just be aware that you'll have to manage all the actions related to 'topbar' - minimize, maximize and close. And bear in mind that different platforms have different conventions, e.g. on Windows the controls are on the right and on macOS the controls are on the left.
1
t

theapache64

03/03/2021, 12:23 PM
@Filip Wiesner Yeah that's right. but I should say the Window API is pretty cool and really straight forward. Implementing something like that shouldn't take much time.
f

Filip Wiesner

03/03/2021, 12:26 PM
That's fair, just wanted to point that out because for someone it might not be worth implementing
👍 1
t

theapache64

03/03/2021, 12:26 PM
can't agree more.
y

Yofou

03/03/2021, 1:19 PM
Thank you @theapache64 & @Filip Wiesner for both of your inputs and I was aware of the window api and seemed simple and good anoth to surfice for a basic window topbar, as for the draggled able example, that's example what I needed, also have to say @theapache64 I have to say your stackys app, has helped me alot a quite few times in using compose desktop, just wanted to say how well the app was made and you did a very good job 🙂
t

theapache64

03/03/2021, 1:20 PM
thanks buddy, it means a lot to me 🙇