https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose-desktop
  • e

    Etienne Savard

    12/28/2020, 3:25 PM
    Anyone has tried to target the Raspberry Pi with their Compose Desktop app? I haven't seen any mention of it here yet. I'm working on a pet project on the Raspberry Pi, and, if feasable, I would like to try out Compose Desktop at the same time. I have found TotalCross (https://github.com/TotalCross/totalcross) which seems to be another interesting option, but Kotlin doesn't seem to be a first class citizen... Thanks!
    m
    • 2
    • 2
  • h

    Hamza

    12/29/2020, 5:58 AM
    Not sure if this is just some outdated docs, but in the code, shouldn't the
    by remember
    changed
    = remember
    ? And to then add on that, in the places where they are used, to use the
    value
    property on them? https://github.com/JetBrains/compose-jb/tree/master/tutorials/Keyboard#focus-related-events
    i
    x
    • 3
    • 5
  • h

    Hamza

    12/29/2020, 9:09 AM
    Hey everyone. Trying to compile some code on windows (after it successfully did the Jar on Arch Linux, however not the Deb package..). I'm getting an interesting error. Is this perhaps because I am using JDK 15?
    Execution failed for task ':packageMsi'.
    > Process 'command 'C:\Users\hamza\.jdks\openjdk-15.0.1\bin\jpackage.exe'' finished with non-zero exit value 1
    The stacktrace is just a ton of internal calls. let me know if you need it 😛
    a
    x
    • 3
    • 15
  • x

    xetra11

    12/29/2020, 10:58 PM
    How can I enforce fullscreen on startup?
    s
    • 2
    • 2
  • t

    Thomas

    12/30/2020, 12:47 PM
    Hi everyone. On Windows the "About" menu item usually has no shortcut. However, Compose for Desktop currently uses KeyStroke(Key.Unknown) as a default (if I do not pass one in), so I end with this. Am I missing something, or should I open an issue?
    x
    j
    • 3
    • 4
  • m

    Marin Tolić

    12/30/2020, 5:17 PM
    Hey folks, Might be a silly question so excuse me if I’m a bit too new to this, but where can I find the option to create an installer? Ive gone through this tutorial: https://github.com/JetBrains/compose-jb/tree/master/tutorials/Native_distributions_and_local_execution Unfortunately I cannot say I fully understand the matter and how to trigger building an installer. Any help would be greatly appreciated and sorry for the bother 🙂
    x
    • 2
    • 19
  • d

    Dominaezzz

    12/30/2020, 10:27 PM
    Is there a way to make IntelliJ to stop complaining about Pascal Case method names when it's annotate with
    @Composable
    ?
    x
    t
    • 3
    • 7
  • x

    xetra11

    12/31/2020, 12:48 PM
    Cause I already created some things for my project and wonder if there is some project where we can share things
    o
    • 2
    • 2
  • x

    xetra11

    12/31/2020, 1:36 PM
    Btw. little status of work on my Crusader Kings 3 Modding Tool with Compose for Desktop. I am getting warmer and warmer with the concepts ✔️ Looking for helping hands so if your a CK3 fan and ... well in this slack channel then peek here: https://github.com/xetra11/CK3-Workbench
    👍 2
    b
    • 2
    • 4
  • r

    russhwolf

    01/01/2021, 4:23 PM
    Is there a way to take the compose window and render it to an image file instead of displaying on screen?
    d
    • 2
    • 7
  • x

    xetra11

    01/01/2021, 9:15 PM
    @Kirill Grouchnikov from what dependency repo can I install it?
    k
    • 2
    • 4
  • x

    xetra11

    01/01/2021, 11:34 PM
    Is there already a way to check in
    onClick
    events if a modifier has been press or for example a "right click" happened?
    d
    • 2
    • 1
  • t

    Thomas

    01/02/2021, 10:31 AM
    TL;DR Ultimately we might need the ability to have the client app specify a look and feel Currently writing an article called Musings on window decorations, as I am still on my mission to get complete Dark Mode into my Compose for Desktop app. 😂 To sort of whet your appetite please look at the short clip. Yes, it's the Swing Cross Platform look and feel, because we need the ability to have Swing paint the window decorations and neither the Windows Look and Feel nor the macOS Look and feel Swing implementations allow this. I will be detailing more regarding code and maybe a thing we JB might need to change in Compose. To start with, just a few lines of code: In `main()`:
    invokeLater {
        JFrame.setDefaultLookAndFeelDecorated(true)
    and later in a composable:
    val window = AppManager.windows.first().window
    getDefaults()["activeCaption"] =
            ColorUIResource(colors.background.toArgb())
    getDefaults()["activeCaptionText"] =
            ColorUIResource(colors.primary.toArgb())
    window.rootPane.windowDecorationStyle = JRootPane.FRAME
    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName())
    SwingUtilities.updateComponentTreeUI(window.rootPane)
    Please note that I need to set the look and feel, because deep inside Compose (
    org.jetbrains.skiko.Library
    ) it apparently (decompiled code) is initialized as:
    private final void miscSystemInit() {
       System.setProperty("sun.awt.noerasebackground", "true");
       System.setProperty("skija.staticLoad", "false");
    
       try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          System.setProperty("apple.laf.useScreenMenuBar", "true");
       } catch (UnsupportedOperationException var2) {
       }
    
    }
    The best thing would be to have a Swing Look and Feel that fits the Material Design look alike, at least for window decoration and menubars inside a window. And we might need the ability to have the client app specify a look and feel and pass it there...
    Switching TitleBar colors.mp4
    💯 2
    ❤️ 2
    k
    b
    • 3
    • 20
  • g

    Glenn Martin

    01/03/2021, 4:53 AM
    Hello, I'm what's the recommended method to navigate/route views in desktop? I've tried to import
    androidx.navigation:navigation-compose
    but getting aar gradle import issues. I've been told this is not available for desktop yet. All I want to do is have sidebar items and be able to change the view on the main right panel. Most of the examples are using some sort of state but for the same view only such as Issues or Code. Also If I have an
    onClick
    method it tells me this can't return a composable as I've tried to do it that way, passing in a composable or returning a composable upon clicking
    p
    a
    • 3
    • 29
  • r

    Rafs

    01/03/2021, 9:32 AM
    What is the recommended way of drawing text inside a
    Canvas
    composable since there is no
    drawText
    method. I have a requirement where I rotate the canvas and draw some lines with some text. I'm currently using
    drawContext.canvas.nativeCanvas.drawText
    l
    j
    • 3
    • 2
  • n

    nfrankel

    01/04/2021, 2:17 AM
    hello getting my feet wet with compose for desktop how do you subscribe to changes in
    MutableState
    ? (i’ve close to zero experience in android)
    k
    a
    c
    • 4
    • 92
  • n

    nfrankel

    01/04/2021, 2:17 AM
    the idea is when
    path
    is updated the
    files
    list will reflect the change
    p
    • 2
    • 1
  • s

    Suser

    01/04/2021, 2:26 AM
    can you use the @Preview annotation in compose desktop?
    :no_red: 1
    j
    • 2
    • 1
  • n

    nfrankel

    01/04/2021, 8:33 AM
    just so i understand i see people from G around this subject does it mean that google is involved in jetpack compose? as opposed to jetbrains?
    👆 1
    a
    r
    +2
    • 5
    • 6
  • c

    Colton Idle

    01/05/2021, 4:47 AM
    Completely new to desktop development (in addition to compose, but im a long time android dev) I'm trying to just build a button where onClick it posts a notification to my mac. Is that something that's supported through compose desktop apps, or do I have to look for some kind of swing library that knows how to do this? (never used swing either). I'm assuming that this might not be possible because notifications are handled by the OS and there doesn't seem to be some kind of java <> macOS interop library (unless my google skills are failing me?)
    s
    d
    • 3
    • 4
  • c

    Cedric Ziel

    01/05/2021, 9:20 AM
    I tried some first steps with compose and i like it 🙂 However - is there some tool or library that would provide a navigation stack (for desktop)? The ones I found use androidx and dont seem to work inside the desktop universe
    g
    s
    • 3
    • 5
  • c

    Colton Idle

    01/05/2021, 1:25 PM
    Just read about the AppManager singleton here: https://github.com/JetBrains/compose-jb/tree/master/tutorials/Window_API#appmanager It gives an example of using
    AppManager.setEvents(
        onAppStart = { println("onAppStart") }, // Invoked before the first window is created
        onAppExit = { println("onAppExit") } // Invoked after all windows are closed
    )
    It doesn't tell you where you would call that though? Since it's invoked BEFORE window is created... I wouldn't put it in my window right? But where do I put it? As a top level function? I'm probably missing something basic here.
    x
    • 2
    • 6
  • j

    Javier

    01/05/2021, 2:48 PM
    I am getting this error (JDK 11 or 15, Gradle 6.6 and 6.7.1, build 138 and 139)
    Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
    	at androidx.compose.desktop.ComposeLayer.<init>(ComposeLayer.kt:72)
    	at androidx.compose.desktop.ComposeWindow.<init>(ComposeWindow.kt:26)
    	at androidx.compose.desktop.AppWindow.<init>(AppWindow.kt:107)
    	at androidx.compose.desktop.AppWindow.<init>(AppWindow.kt)
    	at androidx.compose.desktop.AppWindowKt$Window$1.run(AppWindow.kt:76)
    	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
    	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.lang.NullPointerException
    	at java.base/java.io.Reader.<init>(Reader.java:167)
    	at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:72)
    	at org.jetbrains.skiko.Library.load(Library.kt:42)
    	at org.jetbrains.skija.impl.Library$Companion.staticLoad(Library.kt:9)
    	at org.jetbrains.skija.impl.Library.staticLoad(Library.kt)
    	at org.jetbrains.skija.PictureRecorder.<clinit>(PictureRecorder.java:9)
    	... 18 more
    k
    x
    j
    • 4
    • 7
  • c

    Colton Idle

    01/05/2021, 6:47 PM
    Again, apologies for the noob question, but changing my title doesn't seem to change it on the OS level. I want my app to be called "Yay". Same with my notification, except it says "Java". I guess I'm missing some larger configuration somewhere. I did look in tutorials and the only title changes it had were in the Window tutorial.
    r
    d
    • 3
    • 7
  • l

    Logan Knight

    01/05/2021, 9:43 PM
    Looking for advice on form state management with domain
    data class
    objects updated by the inputs. To use or not to use? Details will be in the thread.
    k
    x
    • 3
    • 15
  • t

    Thomas

    01/06/2021, 10:12 AM
    Hi everyone. There might be an issue regarding responsiveness... Before I open an issue on GitHub, would someone please kindly verify if this is reproducable? Running a short demo on Ubuntu 20.04 causes a Compose for Desktop app to become unresponsive if the theme is switched while the app is running. So, on Ubuntu 20.04 • run this app (button presses print hello • While the app is running, open Settings and change the scheme to/from dark mode • now button clicks no longer print something
    package com.thomaskuenneth
    import androidx.compose.desktop.Window
    import androidx.compose.foundation.layout.Box
    import androidx.compose.foundation.layout.fillMaxSize
    import androidx.compose.material.Button
    import androidx.compose.material.Text
    import androidx.compose.ui.Alignment
    import androidx.compose.ui.Modifier
    fun main() = Window {
    Box(contentAlignment = Alignment.Center,
    modifier = Modifier.fillMaxSize()) {
    Button(onClick = {
    println("Hello")
    }) {
    Text("Hallo")
    }
    }
    }
    c
    a
    • 3
    • 12
  • f

    F0X

    01/06/2021, 4:39 PM
    I just learned about compose (desktop) and am now wondering if it is somehow possible to do some 3d rendering inside the application?
    j
    r
    • 3
    • 3
  • j

    jeggy

    01/06/2021, 9:18 PM
    What does this line in gradle actually do?
    implementation(compose.desktop.currentOs)
    Whenever I add this line it breaks all usages of reflect(), when it's reflecting a suspend function
    k
    • 2
    • 4
  • x

    xetra11

    01/07/2021, 7:02 AM
    What is this module there for: https://github.com/xetra11/compose-jb/tree/master/components Is it for people to share components or will these components be introduced to the next CfD releases?
    j
    • 2
    • 2
  • f

    Fabrice

    01/07/2021, 11:28 AM
    Hello, I'm new to compose with a lot of (stupid) questions (after trying JavaFX + ControlsFX + Gradle + Kotlin on IDEA Ultimate and almost killed myself with the build processes). But first, at the moment what is the right way to create UIs? Use Android Studio to benefit from the @preview annotation then switch to IDEA when it looks ok while keeping in mind that some components are not ported yet (like RangeSlider)? (I fully understand the early stage of all those things).
    j
    t
    +3
    • 6
    • 17
Powered by Linen
Title
f

Fabrice

01/07/2021, 11:28 AM
Hello, I'm new to compose with a lot of (stupid) questions (after trying JavaFX + ControlsFX + Gradle + Kotlin on IDEA Ultimate and almost killed myself with the build processes). But first, at the moment what is the right way to create UIs? Use Android Studio to benefit from the @preview annotation then switch to IDEA when it looks ok while keeping in mind that some components are not ported yet (like RangeSlider)? (I fully understand the early stage of all those things).
j

Javier

01/07/2021, 11:29 AM
@Preview doesn't work in desktop
f

Fabrice

01/07/2021, 11:37 AM
I now but basically if I start as an Android App then copy all my UI code to my desktop project it should do the trick? Or am I going to face a dead end?
t

Timo Drick

01/07/2021, 11:59 AM
Keep in mind that not all things which are working on Android work for Desktop. I don't think that preview is really essential. Not sure what the current state is but in the beginning of compose the preview generation took longer than deploy the app to Android. For desktop you do not need to deploy the app. Just start it.
f

Fabrice

01/07/2021, 12:24 PM
Yes, that is what I do for the moment but I have the bad habit to make a small/insignificant change and reload to look at the result (you know, like the gamers that reload their weapon because they used one bullet and end up dead because of it :P)
t

Timo Drick

01/07/2021, 12:26 PM
Yes i know. And this is the difference between web developers (Javascript) and Desktop/Android developers. We need to compile and wait for the result. This is the reason why the development takes 3 times longer. It would be very cool if this preview could reduce this problem a little bit.
j

Javier

01/07/2021, 12:28 PM
Usually u will have the common code in a multiplatform module
there @preview annotation doesnt exist
that is the project structure, if you have luck, you can get the commonMain with 100% compose screens, so you can't preview nothing
if some screen is different in each platform, you maybe can preview it in Android, but having a mixed structure can be strange, so I think it is better to wait to preview works in all places
f

Fabrice

01/07/2021, 12:44 PM
Yes indeed. It makes sense for a project outside of a simple POC.
t

Timo Drick

01/07/2021, 12:47 PM
I think to learn compose you can start with a android only app. Without MPP. Than you have preview. Later you can change to MPP and maybe you do not need preview so much anymore.
f

Fabrice

01/07/2021, 1:20 PM
I don't really need it, I'm just lazy where I can. I started Android dev in 2013 and things are so smooth now but there was a bunch of nightmares along the way so I can't really complain too much ^^.
j

jim

01/07/2021, 1:43 PM
We intend to bring preview to desktop, but in the mean time, on Desktop, you can create a simple main function that just renders the one widget you want to test in a new window. Not quite as convenient as annotating the function with
@Preview
, but it works and the experience there isn't terrible. Just click the play button (or hotkey) to run your makeshift preview window.
👍 5
c

Colton Idle

01/07/2021, 3:33 PM
Didn't think of that, but yeah that's just as fast (if not faster) than @Preview in studio at the moment. lol
x

xetra11

01/07/2021, 5:03 PM
@Fabrice I had the same issue when I started over. But after a week hacking with Components I have a good feel on what to expect. So get your lazy out there and Reload the shit out of your app until you can @Preview in your inner eye !!
🤣 2
👍 1
View count: 1