https://kotlinlang.org logo
Docs
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
  • a

    Arjan van Wieringen

    09/10/2022, 7:00 AM
    What is the most optimal way to write a load of pixels to Canvas or Image? I use drawPixels now, but I have a lot of different colors so that results in a lot of different drawPixels calls. In a non Compose world I'd just fill a bitmap and render that but I have trouble finding this. I see the ImageBitmap and Painter interfaces, but I haven't found a way to use them correctly.
    r
    • 2
    • 4
  • j

    Junaid

    09/11/2022, 9:04 PM
    is there any way to hide title bar and add some padding to window traffic lights (controls). ?
    t
    • 2
    • 1
  • a

    Amresh Kumar

    09/12/2022, 7:20 AM
    Which database to use in desktop-compose, can we use firebase ?
    m
    g
    l
    • 4
    • 5
  • a

    Amresh Kumar

    09/12/2022, 7:40 AM
    I want to develop an android app and desktop app in the same codebase
  • f

    Francesco Pedron

    09/12/2022, 10:56 AM
    Hi, is there any tools that you know about (e.g a gradle plugin) that generates something similar to android's R.drawable from a compose desktop `main/resources`folder? What I would like to achieve is to avoid referencing the image path as a string when using
    painterResource
    , but instead to get a class with all the resources paths generated at build time and get a build error if some resource is missing.
    e
    g
    m
    • 4
    • 7
  • k

    Krystian Kaniowski

    09/13/2022, 8:51 AM
    Hi, can I export some already painted composable (or a moment before) into file or clipboard when application is launched? Plus can I do it (it can be just standard @preview) without launching application using for example gradle task?
    s
    • 2
    • 3
  • a

    altavir

    09/13/2022, 3:15 PM
    I've got a silly question. I have a state that have a default value passed as parameter. In general, I want to be managed inside the component, but if the default value is changed, I wand inner state to be reset to the new default value. Which is the simplest way to do that?
    k
    • 2
    • 3
  • a

    Ali Albaali

    09/13/2022, 10:52 PM
    If anyone is interested, Luca Spinazzola has been working on supporting iOS, macOS, and JS targets in Kamel (an Image loading library) for a while. Feel free to check it and give us some feedback:
    implementation("io.github.luca992.com.alialbaali.kamel:kamel-image:0.5-darwinandjs0")
    m
    • 2
    • 4
  • l

    Long Tran

    09/14/2022, 7:18 AM
    Hi guys, how can we use Firebase in compose-desktop?
    s
    c
    • 3
    • 11
  • d

    Didier Villevalois

    09/14/2022, 10:02 AM
    Hi everyone! 1. When building a linux native distribution, the laucher desktop file is packaged in
    <installationPath>/lib/<packageName>/<packageName>-<packageName>.desktop
    . I would like it to be contributed instead to
    <installationPath>/share/applications
    as per the XDG specification. How can I do that? 2. Also is it possible to have another name for the executable file than the
    packageName
    ?
    m
    • 2
    • 1
  • s

    spierce7

    09/14/2022, 5:03 PM
    I’m finding I can’t release the next version of my desktop app because certain files in library jars aren’t getting signed. I included the opencv library in the app, and files that don’t have extensions aren’t being signed, and
    .so
    files aren’t being signed. •
    opencv-4.5.5-1.5.7-macosx-x86_64-a0d7ee8b1156d370a1c4e8b92fc4f799.jar/org/bytedeco/opencv/macosx-x86_64/opencv_interactive-calibration
    •
    opencv-4.5.5-1.5.7-macosx-x86_64-a0d7ee8b1156d370a1c4e8b92fc4f799.jar/org/bytedeco/opencv/macosx-x86_64/python/cv2.cpython-310-darwin.so
    On a side note, if anyone knows of a better way to access the camera of a laptop in java than opencv, let me know 😄 What can I do to get these files signed, ideally by compose, the same way my other files are signed?
  • a

    Ananiya

    09/14/2022, 8:31 PM
    was trying call the first element of a
    mutableState
    containing
    List<List<Any>>
    before passing it
    LazyColumn
    items()
    but every time I tried so am introduced with
    Compose Disposed, the List is empty
    which normally isn't empty if you passed the whole list of list through
    LazyColumn
    items()
    d
    • 2
    • 1
  • p

    PHondogo

    09/15/2022, 6:16 AM
    Hello! Is it possible to create distributions each for each platform from Linux PC?
    s
    i
    • 3
    • 2
  • s

    Stefan Oltmann

    09/15/2022, 7:07 AM
    Finally we got ProGuard support for Compose for Desktop! 🎉🚀 For me this is a big step towards broader adoption in the industry because you just can't do commercial apps without obfuscation. https://github.com/JetBrains/compose-jb/pull/2313
  • p

    PHondogo

    09/15/2022, 7:37 AM
    Is it possible to create several distribution configurations in one Gradle module? I have 2 fat jars in one Gradle module and want each to be packaged in separate DEB.
    a
    • 2
    • 2
  • c

    Christian Lutnik

    09/15/2022, 2:47 PM
    When I try to run UI tests in my
    jvm
    Compose Project, I immediately get an exception
    'void org.jetbrains.skia.paragraph.ParagraphStyleKt._nSetTextIndent(long, float, float)'
    java.lang.UnsatisfiedLinkError: 'void org.jetbrains.skia.paragraph.ParagraphStyleKt._nSetTextIndent(long, float, float)'
    	at org.jetbrains.skia.paragraph.ParagraphStyleKt._nSetTextIndent(Native Method)
    	at org.jetbrains.skia.paragraph.ParagraphStyleKt.access$_nSetTextIndent(ParagraphStyle.kt:1)
    	at org.jetbrains.skia.paragraph.ParagraphStyle.setTextIndent(ParagraphStyle.kt:182)
    	at androidx.compose.ui.text.platform.ParagraphBuilder.textStyleToParagraphStyle(SkiaParagraph.skiko.kt:776)
    	at androidx.compose.ui.text.platform.ParagraphBuilder.build(SkiaParagraph.skiko.kt:566)
    	at androidx.compose.ui.text.platform.ParagraphLayouter.<init>(ParagraphLayouter.skiko.kt:71)
    as soon as the Composable under test contains a
    Text(String)
    , so this fails:
    class ComposeTest {
        @get:Rule
        val composeTestRule = createComposeRule()
        @Test
        fun firstTest() {
            composeTestRule.setContent {
                Text("Hello")
            }
        }
    }
    whereas this does not:
    class ComposeTest {
        @get:Rule
        val composeTestRule = createComposeRule()
        @Test
        fun firstTest() {
            composeTestRule.setContent {
                Button({}){}
            }
        }
    }
    Does anyone have an idea what the problem could be?
    k
    j
    • 3
    • 7
  • u

    毛小川

    09/16/2022, 8:04 AM
    Hello,How can I get a tab list like
    TabRow
    but vertical arrangement
  • a

    Alex Styl

    09/17/2022, 9:51 AM
    hi folks. I am trying to build a small app to send files from my android to my mac wirelessly. I found out about bonjour that helps discover nearby devices and I was able to detect my MBP from my android. Any hints towards what APIs (desktop + android) I need to use in order to do the actual sharing? I first spotted WiFi-Direct but it seems like Apple doesn’t support it. Anyone has experience with such use case?
    o
    • 2
    • 2
  • a

    Ananiya

    09/17/2022, 2:54 PM
    Hello, was using jp compose with custom built
    JavaFXPanel
    composable [https://github.com/JetBrains/compose-jb/issues/519#issuecomment-804030550] and was trying to display a stream of data from
    Channels
    inside it however when Recomposing JavaFXPanel it suddenly stop to listen for the channel and clears the view so to figure out what's going on created a simple composable containing either of those
    // v1
    JavaFXPanel(jfxpanel: JFXPanel, container: Container){
         Platform.runLater { 
            print("hello")
        }
    }
    // v2
    JavaFXPanel(jfxpanel: JFXPanel, container: Container){
         CoroutineScope(JavaFx).launch { 
            print("hello")
        }
    }
    overall started with v1 prints hello and never made it when it recompose, v2 was identical too also tried to create custom panel by adding
    SideEffect
    which barely do to a thing
    fun JavaFXPanel(
        root: Container,
        panel: JFXPanel,
     onCreate: () -> Unit
    
    
    ) {
        val container = remember { JPanel() }
        val density = LocalDensity.current.density
    
        Layout(
            content =
            {}
            ,
            modifier = Modifier.onGloballyPositioned { childCoordinates ->
                val coordinates = childCoordinates.parentCoordinates!!
                val location = coordinates.localToWindow(Offset.Zero).round()
                val size = coordinates.size
                container.setBounds(
                    (location.x / density).toInt(),
                    (location.y / density).toInt(),
                    (size.width / density).toInt(),
                    (size.height / density).toInt()
                )
                container.validate()
                container.repaint()
            },
            measurePolicy = { _, _ ->
                layout(0, 0) {}
            }
        )
    
        DisposableEffect(Unit) {
    
            onCreate()
            container.layout = BorderLayout(0, 0)
            container.add(panel)
            
    
            root.add(container)
    
    
            onDispose {
                root.remove(container)
            }
        }
    
        SideEffect {
    
            onCreate()
        }
    }
  • a

    Ali Albaali

    09/17/2022, 5:51 PM
    I’m facing an issue when using DropdownMenu. I don’t know if it’s a bug or I’m missing something. More details in the thread.
    a
    • 2
    • 3
  • g

    Guilherme Delgado

    09/17/2022, 6:44 PM
    Anyone trying to perform network calls and facing
    Exception in thread "main" java.lang.NoClassDefFoundError: java/net/http/HttpClient$Version
    ? More here https://kotlinlang.slack.com/archives/C3PQML5NU/p1663372636232599
    a
    • 2
    • 8
  • a

    Aleksey Chugaev

    09/17/2022, 10:39 PM
    Hi All, is it possible to call native OS APIs from within a compose desktop app? E.g. when running on MacOS call some Apple Framework, when on Windows call a Windows API.
    j
    m
    • 3
    • 3
  • o

    orangy

    09/19/2022, 10:28 AM
    There is
    SplitPane
    experimental component https://github.com/JetBrains/compose-jb/tree/master/components/SplitPane It supports vertical/horizontal split pane with a handle and resizing. But not something collapse-to-icons out of the box
  • m

    mikehearn

    09/19/2022, 3:13 PM
    What specific version of Kotlin does Compose Desktop 1.2 beta require, does anyone know? I get an error if I try to use anything less than Kotlin 1.7.10, however, the actual dependency information of the Compose 1.2 libraries states that they depend on Kotlin 1.6. Gradle force upgrades those dependencies to 1.7 usually, but if I resolve Compose Desktop in a different configuration where I haven't forcibly imported the Kotlin 1.7 standard library then I end up with the "wrong" old versions of the Kotlin stdlib. Is there a plan to switch all the libraries to depend on Kotlin 1.7 before release so it's all consistent?
    i
    • 2
    • 1
  • c

    Colton Idle

    09/20/2022, 7:39 PM
    Probably gonna seem dumb for asking this. But how do people do stuff in compose desktop since you don't have a "VM" like in Android? I understand that AAC VM is an uneeded thing, but I've only ever really done android dev and so im confused on how you'd create a presenter or something that survives for the "lifetime" of a "screen" in the compose desktop world.
    s
    c
    +5
    • 8
    • 9
  • x

    Xad Kile

    09/21/2022, 3:16 PM
    I read a State<T> in a Deffered created in Dispatchers.Default and got this exception. Does this mean it is unsafe to read/write State and MutableState in threads other than the main thread? Or am I missing something here? Thanks
    java.lang.IllegalStateException: Method should be called from AWT event dispatch thread
    	at org.jetbrains.skiko.SkiaLayer.needRedraw(SkiaLayer.awt.kt:427)
    k
    m
    • 3
    • 4
  • e

    E Fefer

    09/23/2022, 9:53 AM
    I'm a Native Android developer for a few years now, but it's my first week trying out compose desktop, and I would like to know if and how it's possible to startup the application on Windows reboot? (Links to documentation etc. are also ok.)
    m
    • 2
    • 6
  • m

    Michael Paus

    09/23/2022, 5:15 PM
    I just made the mistake to upgrade to the latest IntelliJ EAP 2002.3 bringing me from a fully working multiplatform build to a completely defunct one. Can anybody tell me how I can fix the following build error?
    Cannot add task 'packageRelease' as a task with that name already exists.
    Full stacktrace in thread ->
    e
    l
    • 3
    • 13
  • c

    czuckie

    09/23/2022, 5:34 PM
    Is there anyway for me to make a window draggable if I've removed the decoration? I'm guessing I'd have to punch into Swing to do it?
    e
    • 2
    • 2
  • c

    czuckie

    09/23/2022, 11:47 PM
    I don't suppose any rockstars in here would understand why on Mac OS the colour wheel animates flawlessly, but on Ubuntu, the animation is choppy? Like any known caveats? https://github.com/godaddy/compose-color-picker/issues/19
    r
    r
    • 3
    • 12
Powered by Linen
Title
c

czuckie

09/23/2022, 11:47 PM
I don't suppose any rockstars in here would understand why on Mac OS the colour wheel animates flawlessly, but on Ubuntu, the animation is choppy? Like any known caveats? https://github.com/godaddy/compose-color-picker/issues/19
r

romainguy

09/24/2022, 1:28 AM
Use a profiler like VisualVM to see where time is spent
c

czuckie

09/24/2022, 11:20 AM
I can give it a shot, but I just don't understand how the colours in the orbs can continue updating and why only slow mouse movements result in a kind of animation, though not as smooth as observed on Mac OS
r

Rebecca Franks

09/24/2022, 10:24 PM
Can you try to remove the animation for positionAnimated to see if it's the cause? As I don't think the colours are animating the change.
https://github.com/godaddy/compose-color-picker/blob/main/color-picker/src/commonMain/kotlin/com/godaddy/android/colorpicker/harmony/HarmonyColorMagnifiers.kt#L27 this line specifically
c

czuckie

09/25/2022, 2:57 PM
@Rebecca Franks let me give that a go
I did some old fashioned printf'ing and found that the position value is updating, but the positionAnimated value is not. My compose-fu is only weak, so I don't know how compose handles scheduling animations to occur, but wonder if the potentially massive influx of events (from dragging) is leading to some sort of pending animation queue getting filled faster than it can be emptied. This would explain why moving the mouse slowly does result in animation at least. If only someone on this particular slack thread had intimate knowledge of animations and compose 😞
r

Rebecca Franks

09/25/2022, 3:12 PM
I'll take a deeper look at it this week to see if I can figure out whats going wrong 🙂
c

czuckie

09/25/2022, 3:14 PM
This is what I added - I noticed that position.x and y update as expected, but the positionAnimated do not.
val positionAnimated by animateOffsetAsState(
        targetValue = position,
        animationSpec = spring(dampingRatio = Spring.DampingRatioLowBouncy)
    )
    println("HIT ${position} ${positionAnimated.x} ${positionAnimated.y}")
I was trying to goad Romain into looking 😛, because unless the api is being used incorrectly (doesn't look like it!) then it sounds like a framework thing :X
but the library is immense, great job on it! 🤜 💥 🤛
r

Rebecca Franks

09/25/2022, 3:16 PM
The strange part is that I haven't seen this issue on Android or Mac
It probably shouldn't be calling the animation on drag, and rather snapping to the new value on drag, and only animating on touch.
c

czuckie

09/25/2022, 4:47 PM
I think that's a really tidy solution, I'll be happy to test!
View count: 2