Bladeren bron

theme update

Milan Jurkulak 2 jaren geleden
bovenliggende
commit
d8a6718ffd

+ 2 - 2
src/main/kotlin/eu/mjdev/desktop/components/desktop/Desktop.kt

@@ -21,7 +21,7 @@ import eu.mjdev.desktop.provider.DesktopScope.Companion.withDesktopScope
 @Composable
 fun Desktop(
     modifier: Modifier = Modifier,
-    panelState: VisibilityState = rememberVisibilityState()
+    panelState: VisibilityState = rememberVisibilityState(),
 ) = withDesktopScope {
     val bottomPadding by rememberCalculated(panelState.enabled) {
         if (panelState.enabled) 0.dp else max(0.dp, panelState.bounds.height)
@@ -57,4 +57,4 @@ fun Desktop(
 
 @Preview
 @Composable
-fun DesktopPreview() = Desktop()
+fun DesktopPreview() = Desktop()

+ 46 - 42
src/main/kotlin/eu/mjdev/desktop/components/desktoppanel/DesktopPanel.kt

@@ -31,8 +31,9 @@ import eu.mjdev.desktop.components.sliding.SlidingMenu
 import eu.mjdev.desktop.components.sliding.base.VisibilityState
 import eu.mjdev.desktop.components.sliding.base.VisibilityState.Companion.rememberVisibilityState
 import eu.mjdev.desktop.components.tooltip.Tooltip
+import eu.mjdev.desktop.components.tooltip.TooltipState
+import eu.mjdev.desktop.components.tooltip.rememberTooltipState
 import eu.mjdev.desktop.data.App
-import eu.mjdev.desktop.data.TooltipData
 import eu.mjdev.desktop.extensions.ColorUtils.alpha
 import eu.mjdev.desktop.extensions.ColorUtils.lighter
 import eu.mjdev.desktop.extensions.Compose.height
@@ -57,15 +58,9 @@ fun DesktopPanel(
     showMenuIcon: Boolean = true,
     panelState: VisibilityState = rememberVisibilityState(),
     menuState: VisibilityState = rememberVisibilityState(),
+    tooltipState: TooltipState = rememberTooltipState(),
     enterAnimation: EnterTransition = DesktopPanelEnterAnimation,
     exitAnimation: ExitTransition = DesktopPanelExitAnimation,
-    tooltipHeight: Dp = 64.dp,
-    tooltipConverter: (Any?) -> TooltipData = { item ->
-        when (item) {
-            is App -> TooltipData(title = item.name, description = item.comment)
-            else -> TooltipData(title = item.toString())
-        }
-    },
     position: WindowPosition.Aligned = WindowPosition.Aligned(Alignment.BottomCenter),
     onMenuIconClicked: () -> Unit = {},
     onMenuIconContextMenuClicked: () -> Unit = {},
@@ -77,20 +72,20 @@ fun DesktopPanel(
     onLanguageClick: () -> Unit = {},
     onClockClick: () -> Unit = {}
 ) = withDesktopScope {
-    val tooltipState = rememberState<Any?>(null)
     val panelDividerWidth by rememberState(theme.panelDividerWidth)
     val panelHeight: (visible: Boolean) -> Dp = { visible ->
-        if (visible) iconSize.height + iconOuterPadding.height + tooltipHeight + theme.panelContentPadding.times(2)
-        else panelDividerWidth
+        if (visible)
+            iconSize.height + iconOuterPadding.height + tooltipState.tooltipHeight + theme.panelContentPadding.times(2)
+        else
+            panelDividerWidth
     }
     val panelSize = remember(panelState.isVisible, panelState.enabled) {
         DpSize(containerSize.width, panelHeight(panelState.isVisible))
     }
     val windowState: ChromeWindowState = rememberChromeWindowState(
-        position = position,
-        size = panelSize
+        position = position, size = panelSize
     )
-    panelState.updateSize(panelSize - DpSize(0.dp, tooltipHeight))
+    panelState.updateSize(panelSize - DpSize(0.dp, tooltipState.tooltipHeight))
     globalKeyEventHandler(panelState.isVisible && panelState.enabled) {
         onEscape {
             panelState.hide()
@@ -114,13 +109,15 @@ fun DesktopPanel(
                 if (!menuState.isVisible) {
                     windowState.requestFocus()
                 }
-            }, onPointerLeave = {
+            },
+            onPointerLeave = {
                 if (!menuState.isVisible) {
                     panelState.hide()
                 }
             }) { isVisible ->
             Divider(
-                modifier = Modifier.fillMaxWidth().height(panelDividerWidth),
+                modifier = Modifier.fillMaxWidth()
+                    .height(panelDividerWidth),
                 color = Color.Transparent,
                 thickness = panelDividerWidth
             )
@@ -128,38 +125,44 @@ fun DesktopPanel(
                 TooltipArea(
                     modifier = Modifier.fillMaxWidth().wrapContentHeight(), tooltip = {
                         Tooltip(
-                            textColor = textColor,
-                            borderColor = borderColor,
-                            state = tooltipState,
-                            converter = tooltipConverter,
-                            backgroundColor = backgroundColor
+                            tooltipState = tooltipState,
                         )
-                    }, tooltipPlacement = TooltipPlacement.CursorPoint(
-                        alignment = Alignment.TopEnd, offset = DpOffset(32.dp, 32.dp)
+                    },
+                    tooltipPlacement = TooltipPlacement.CursorPoint(
+                        alignment = Alignment.TopStart,
+                        offset = DpOffset(32.dp, 32.dp)
                     )
                 ) {
                     Column {
                         Box(
-                            modifier = Modifier.fillMaxWidth().height(tooltipHeight)
+                            modifier = Modifier.fillMaxWidth()
+                                .height(tooltipState.tooltipHeight)
                         )
                         Column(
-                            modifier = Modifier.fillMaxWidth().wrapContentHeight().background(
-                                brush = Brush.verticalGradient(
-                                    colors = listOf(
-                                        backgroundColor.alpha(0.3f),
-                                        backgroundColor.alpha(0.7f),
-                                        backgroundColor.alpha(0.8f),
+                            modifier = Modifier.fillMaxWidth()
+                                .wrapContentHeight()
+                                .background(
+                                    brush = Brush.verticalGradient(
+                                        colors = listOf(
+                                            backgroundColor.alpha(0.3f),
+                                            backgroundColor.alpha(0.7f),
+                                            backgroundColor.alpha(0.8f),
+                                        )
                                     )
-                                )
-                            ).topShadow(
-                                color = borderColor.alpha(0.3f), blur = 4.dp
-                            ).onPlaced(panelState::onPlaced),
+                                ).topShadow(
+                                    color = borderColor.alpha(0.3f),
+                                    blur = 4.dp
+                                ).onPlaced(panelState::onPlaced),
                         ) {
                             Divider(
-                                modifier = Modifier.fillMaxWidth().height(2.dp), color = borderColor, thickness = 2.dp
+                                modifier = Modifier.fillMaxWidth()
+                                    .height(2.dp),
+                                color = borderColor,
+                                thickness = 2.dp
                             )
                             Box(
-                                modifier = Modifier.fillMaxWidth().padding(top = 4.dp)
+                                modifier = Modifier.fillMaxWidth()
+                                    .padding(top = 4.dp)
                                     .padding(theme.panelContentPadding)
                             ) {
                                 if (showMenuIcon) {
@@ -170,7 +173,7 @@ fun DesktopPanel(
                                         iconSize = iconSize,
                                         iconPadding = iconPadding,
                                         iconOuterPadding = iconOuterPadding,
-                                        onTooltip = { item -> tooltipState.value = item },
+                                        onTooltip = { item -> tooltipState.show(item) },
                                         onClick = { onMenuIconClicked() },
                                         onContextMenuClick = onMenuIconContextMenuClicked
                                     )
@@ -183,19 +186,20 @@ fun DesktopPanel(
                                     iconSize = iconSize,
                                     iconPadding = iconPadding,
                                     iconOuterPadding = iconOuterPadding,
-                                    onTooltip = { item -> tooltipState.value = item },
+                                    onTooltip = { item -> tooltipState.show(item) },
                                     onAppClick = { app -> onAppClick(app) },
                                     onContextMenuClick = onAppContextMenuClick
                                 )
                                 DesktopPanelTray(
-                                    modifier = Modifier.align(Alignment.CenterEnd).padding(end = 16.dp),
+                                    modifier = Modifier.align(Alignment.CenterEnd)
+                                        .padding(end = 16.dp),
                                 ) {
                                     DesktopPanelLanguage(
-                                        onTooltip = { item -> tooltipState.value = item },
+                                        onTooltip = { item -> tooltipState.show(item) },
                                         onClick = onLanguageClick
                                     )
                                     DesktopPanelDateTime(
-                                        onTooltip = { item -> tooltipState.value = item },
+                                        onTooltip = { item -> tooltipState.show(item) },
                                         onClick = onClockClick
                                     )
                                 }
@@ -210,4 +214,4 @@ fun DesktopPanel(
 
 @Preview
 @Composable
-fun DesktopPanelPreview() = DesktopPanel()
+fun DesktopPanelPreview() = DesktopPanel()

+ 0 - 0
src/main/kotlin/eu/mjdev/desktop/components/installer/InfoWindow.kt → src/main/kotlin/eu/mjdev/desktop/components/installer/Installer.kt


+ 70 - 36
src/main/kotlin/eu/mjdev/desktop/components/tooltip/Tooltip.kt

@@ -1,3 +1,5 @@
+@file:Suppress("CanBeParameter")
+
 package eu.mjdev.desktop.components.tooltip
 
 import androidx.compose.desktop.ui.tooling.preview.Preview
@@ -13,57 +15,89 @@ import androidx.compose.runtime.MutableState
 import androidx.compose.runtime.mutableStateOf
 import androidx.compose.runtime.remember
 import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import eu.mjdev.desktop.components.text.TextAny
+import eu.mjdev.desktop.data.App
 import eu.mjdev.desktop.data.TooltipData
 import eu.mjdev.desktop.extensions.Compose.launchedEffect
+import eu.mjdev.desktop.provider.DesktopScope.Companion.withDesktopScope
 import kotlinx.coroutines.delay
 
 @Suppress("FunctionName")
 @Composable
 fun Tooltip(
-    textColor: Color = Color.White,
-    borderColor: Color = Color.White,
-    backgroundColor: Color = Color.Transparent,
-    hideDelay: Long = 2000,
-    state: MutableState<Any?> = remember { mutableStateOf(null) },
-    converter: (Any?) -> TooltipData = { TooltipData(description = it.toString()) }
-) = if (state.value != null) {
-    Box(
-        modifier = Modifier
-            .wrapContentSize()
-            .background(backgroundColor, RoundedCornerShape(8.dp))
-            .border(2.dp, borderColor, RoundedCornerShape(8.dp))
-            .padding(8.dp)
-    ) {
-        with(converter(state.value)) {
-            Column {
-                if (title.isNotEmpty()) {
-                    TextAny(
-                        text = title,
-                        color = textColor,
-                        fontSize = 14.sp
-                    )
-                }
-                if (description.isNotEmpty()) {
-                    TextAny(
-                        text = description,
-                        color = textColor,
-                        fontSize = 12.sp,
-                        minLines = 1,
-                        maxLines = 2
-                    )
+    tooltipState: TooltipState = rememberTooltipState(),
+) = withDesktopScope {
+    if (tooltipState.value != null) {
+        Box(
+            modifier = Modifier
+                .wrapContentSize()
+                .background(backgroundColor, RoundedCornerShape(8.dp))
+                .border(2.dp, borderColor, RoundedCornerShape(8.dp))
+                .padding(8.dp)
+        ) {
+            with(tooltipState.convertedValue) {
+                Column {
+                    if (title.isNotEmpty()) {
+                        TextAny(
+                            text = title,
+                            color = textColor,
+                            fontSize = 14.sp
+                        )
+                    }
+                    if (description.isNotEmpty()) {
+                        TextAny(
+                            text = description,
+                            color = textColor,
+                            fontSize = 12.sp,
+                            minLines = 1,
+                            maxLines = 2
+                        )
+                    }
                 }
             }
         }
+        launchedEffect(tooltipState) {
+            delay(tooltipState.hideDelay)
+            tooltipState.clear()
+        }
+    } else Unit
+}
+
+class TooltipState(
+    val hideDelay: Long = 2000,
+    val tooltipHeight: Dp = 64.dp,
+    val converter: (Any?) -> TooltipData = { item ->
+        when (item) {
+            is App -> TooltipData(title = item.name, description = item.comment)
+            else -> TooltipData(description = item.toString())
+        }
     }
-    launchedEffect(state) {
-        delay(hideDelay)
-        state.value = null
+) {
+    private var valueState: MutableState<Any?> = mutableStateOf(null)
+
+    val convertedValue: TooltipData
+        get() = converter(value)
+
+    var value
+        get() = valueState.value
+        set(value) {
+            this.valueState.value = value
+        }
+
+    fun show(what: Any?) {
+        value = what
+    }
+
+    fun clear() {
+        value = null
     }
-} else Unit
+}
+
+@Composable
+fun rememberTooltipState() = remember { TooltipState() }
 
 @Preview
 @Composable

+ 20 - 3
src/main/kotlin/eu/mjdev/desktop/theme/gtk/GtkThemeHelper.kt

@@ -230,12 +230,29 @@ class GtkThemeHelper(
             	border-bottom-right-radius: 8px;
                 border-top-right-radius: 8px;
                 border-top-left-radius: 8px;
-            	box-shadow: 0px 0px 0px 1px ${textColor.hexRgb};
-            	border: 2px solid ${bgColor.hexRgb};
+                border: 2px solid ${bgColor.hexRgb};
             	border-top: none;
-                box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
+                position: relative;
+                box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
+            }
+            
+            window:before, window:after {
+                position:absolute;
+                z-index: -1;
+                box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
+                top: 0;
+                bottom: 0;
+                left: 10px;
+                right: 10px;
+                border-radius: 100px / 10px;
             }
             
+            window:after {
+                right: 10px;
+                left: auto;
+                transform: skew(8deg) rotate(3deg);
+            }
+
             decoration {
                 background-image: none;
             	background-color: ${bgColor.hexRgb};

+ 42 - 39
src/main/kotlin/eu/mjdev/desktop/windows/DesktopWindow.kt

@@ -8,42 +8,40 @@ import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
 import eu.mjdev.desktop.components.background.BackgroundImage
 import eu.mjdev.desktop.components.sliding.base.VisibilityState
+import eu.mjdev.desktop.components.sliding.base.VisibilityState.Companion.rememberVisibilityState
 import eu.mjdev.desktop.extensions.Compose.onLeftClick
 import eu.mjdev.desktop.extensions.Compose.onMousePress
 import eu.mjdev.desktop.extensions.Compose.onRightClick
-import eu.mjdev.desktop.provider.DesktopProvider
-import eu.mjdev.desktop.provider.DesktopProvider.Companion.LocalDesktop
+import eu.mjdev.desktop.provider.DesktopScope.Companion.withDesktopScope
 
 @Suppress("FunctionName")
 @Preview
 @Composable
 fun DesktopWindow(
-    controlCenterState: VisibilityState,
-    panelState: VisibilityState,
-    menuState: VisibilityState,
-    api: DesktopProvider = LocalDesktop.current,
+    controlCenterState: VisibilityState = rememberVisibilityState(),
+    panelState: VisibilityState = rememberVisibilityState(),
+    menuState: VisibilityState = rememberVisibilityState(),
 //    onDesktopMenuShow: () -> Unit = {},
 //    contextMenuState: ContextMenuState = rememberContextMenuState("item1", "item2"),
     content: @Composable BoxScope.() -> Unit = {}
-) = FullScreenWindow(
+) = withDesktopScope {
+    FullScreenWindow(
 //    onOpened = {
 //        println("Window opened $window")
 //        window?.toBack()
 //    },
-    onFocusChange = { focus ->
+        onFocusChange = { focus ->
 //        RuntimeException("Focus change: $it").printStackTrace()
-        // todo better solution
+            // todo better solution
 //        val focusOwner = window?.mostRecentFocusOwner
-        if (focus) {
-            window?.toBack()
-        }
+            if (focus) {
+                window?.toBack()
+            }
 //        focusOwner?.requestFocus()
-    }
-) {
-//    val backgroundColor by rememberBackgroundColor(api)
-    Box(
-        modifier = Modifier
-            .fillMaxSize()
+        }
+    ) {
+        Box(
+            modifier = Modifier.fillMaxSize()
 //            .background(backgroundColor)
 //            .pointerInput(Unit) {
 //                awaitPointerEventScope {
@@ -54,34 +52,34 @@ fun DesktopWindow(
 //                    }
 //                }
 //            }
-    ) {
-        BackgroundImage(
-            modifier = Modifier
-                .fillMaxSize()
-                .onMousePress {
-                    onLeftClick {
-                        panelState.hide()
-                        menuState.hide()
-                        controlCenterState.hide()
-                    }
-                    onRightClick {
+        ) {
+            BackgroundImage(
+                modifier = Modifier
+                    .fillMaxSize()
+                    .onMousePress {
+                        onLeftClick {
+                            panelState.hide()
+                            menuState.hide()
+                            controlCenterState.hide()
+                        }
+                        onRightClick {
 //                        contextMenuState.show()
+                        }
+                    },
+                onChange = { src ->
+                    api.palette.apply {
+                        update(src)
+                    }.also { p ->
+                        api.currentUser.theme.backgroundColor = p.backgroundColor
                     }
-                },
-            onChange = { src ->
-                api.palette.apply {
-                    update(src)
-                }.also { p ->
-                    api.currentUser.theme.backgroundColor = p.backgroundColor
                 }
-            }
-        )
+            )
 //        WidgetsPanel(
 //            modifier = Modifier
 //                .fillMaxSize()
 //        )
-        content()
-    }
+            content()
+        }
 //    ContextMenu(
 //        contextMenuState = contextMenuState,
 //        onMenuItemClick = { item -> log { "Context menu : $item" } },
@@ -95,4 +93,9 @@ fun DesktopWindow(
 //            }.send()
 //        }
 //    }
+    }
 }
+
+@Preview
+@Composable
+fun DesktopWindowPreview() = DesktopWindow()

+ 128 - 0
src/main/kotlin/eu/mjdev/desktop/windows/blur/linux/BlurApp.kt

@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) Milan Jurkulák 2024.
+ *  Contact:
+ *  e: mimoccc@gmail.com
+ *  e: mj@mjdev.org
+ *  w: https://mjdev.org
+ */
+package eu.mjdev.desktop.windows.blur.linux
+
+import eu.mjdev.desktop.helpers.image.filters.GaussianFilter
+import java.awt.*
+import java.awt.event.ActionEvent
+import java.awt.event.ActionListener
+import java.awt.image.BufferedImage
+import javax.swing.JButton
+import javax.swing.JFrame
+import javax.swing.JPanel
+import javax.swing.SwingUtilities
+
+@Suppress("UNUSED_VARIABLE")
+class BlurApp : ActionListener {
+    var jf: JFrame = JFrame("Example")
+    var background: JPanel = object : JPanel() {
+        override fun paintComponent(g: Graphics) {
+            val g2d = g as Graphics2D
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
+            val w = width
+            val h = height
+            val c1 = Color(41, 59, 102)
+            val c2 = Color(2, 2, 2)
+            val gp = GradientPaint(0f, 0f, c1, 0f, (h - 20).toFloat(), c2)
+            g2d.paint = gp
+            g2d.fillRect(0, 0, w, h)
+        }
+    }
+    private var glassPanel: JPanel
+    var button: JButton = JButton("Click me!")
+    private var another: JButton = JButton("Close")
+    var blurBuffer: BufferedImage? = null
+    var backBuffer: BufferedImage? = null
+    var currentGraphics: BufferedImage? = null
+    var alpha: Float = 0.0f
+
+    init {
+        button.addActionListener(this)
+        another.addActionListener(this)
+        jf.setSize(900, 400)
+        jf.setLocationRelativeTo(null)
+        jf.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
+        jf.add(background)
+        jf.add(button, BorderLayout.NORTH)
+        glassPanel = BlurPanel()
+        jf.glassPane = glassPanel
+        jf.isVisible = true
+    }
+
+    override fun actionPerformed(e: ActionEvent) {
+        if (e.source === button) {
+            createBlur()
+            jf.glassPane.isVisible = true
+            val root = SwingUtilities.getRootPane(jf)
+            currentGraphics = BufferedImage(root.width, root.height, BufferedImage.TYPE_3BYTE_BGR)
+            jf.glassPane.isVisible = false
+            glassPanel = GlassPanel()
+            jf.glassPane.isVisible = true
+        }
+        if (e.source === another) {
+            jf.glassPane.isVisible = false
+        }
+    }
+
+    inner class BlurPanel : JPanel() {
+        override fun paintComponent(g: Graphics) {
+            if (isVisible && blurBuffer != null) {
+                val g2d = g.create() as Graphics2D
+                g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
+                g2d.drawImage(backBuffer, 0, 0, null)
+                g2d.composite = AlphaComposite.SrcOver.derive(alpha)
+                println(alpha)
+                println("Function called 1")
+                g2d.drawImage(blurBuffer, 0, 0, jf.width, jf.height, null)
+                g2d.dispose()
+            }
+        }
+    }
+
+    private fun createBlur() {
+        alpha = 1.0f
+        val root = SwingUtilities.getRootPane(jf)
+        blurBuffer = BufferedImage(jf.width, jf.height, BufferedImage.TYPE_INT_ARGB)
+        val g2d = blurBuffer!!.createGraphics()
+        root.paint(g2d)
+        g2d.dispose()
+        backBuffer = blurBuffer
+        blurBuffer = GaussianFilter(5f).filter(blurBuffer, null)
+    }
+
+    inner class GlassPanel : JPanel() {
+        init {
+            isOpaque = false
+        }
+
+        override fun paintComponent(g: Graphics) {
+            val x = 34
+            val y = 34
+            val w = width - 68
+            val h = height - 68
+            val arc = 30
+            var g2 = currentGraphics!!.createGraphics()
+            g2.drawImage(currentGraphics, 0, 0, null)
+            g2 = g.create() as Graphics2D
+            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
+            g2.color = Color(0, 0, 0, 220)
+            g2.fillRoundRect(x, y, w, h, arc, arc)
+            g2.stroke = BasicStroke(1f)
+            g2.color = Color.WHITE
+            g2.drawRoundRect(x, y, w, h, arc, arc)
+            g2.dispose()
+        }
+    }
+
+    companion object {
+        @JvmStatic
+        fun main(args: Array<String>) {
+            val n = BlurApp()
+        }
+    }
+}

+ 15 - 5
src/main/kotlin/eu/mjdev/desktop/windows/blur/linux/BlurBackground.kt

@@ -13,19 +13,29 @@ object BlurBackground {
         blurRadius: Float = 3f,
         contentPane: Container? = window.contentPane
     ) {
+//        val toolkit = Toolkit.getDefaultToolkit()
         val hackedPane = contentPane as? HackedContentPane
         val isHacked = hackedPane != null
         val width = window.width
         val height = window.height
         if (isHacked && (width > 0) && (height > 0)) {
             try {
-                BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB).let { image ->
-                    image.graphics.also { graphics ->
-                        hackedPane?.paint(graphics)
-                        graphics.dispose()
-                        GaussianFilter(blurRadius).filter(image, null).let { blurredImage ->
+                BufferedImage(
+                    width,
+                    height,
+                    BufferedImage.TYPE_INT_ARGB
+                ).let { image ->
+                    with(image.graphics) {
+                        hackedPane?.paint(this)
+                        GaussianFilter(
+                            blurRadius
+                        ).filter(
+                            image,
+                            null
+                        ).let { blurredImage ->
                             hackedPane?.setImage(blurredImage)
                         }
+                        dispose()
                     }
                 }
             } catch (e: Throwable) {

+ 8 - 6
src/main/kotlin/eu/mjdev/desktop/windows/blur/linux/LinuxWindowBlurManager.kt

@@ -29,8 +29,10 @@ class LinuxWindowBlurManager(
 
     init {
         SwingUtilities.invokeLater {
-                if (window is ComposeWindow) window.setComposeLayerTransparency(true)
-                window.hackContentPane()
+            if (window is ComposeWindow) {
+                window.setComposeLayerTransparency(true)
+            }
+            window.hackContentPane()
             updateBlur()
         }
     }
@@ -40,13 +42,13 @@ class LinuxWindowBlurManager(
     }
 
     val componentAdapter = object : ComponentAdapter() {
-        override fun componentMoved(e: ComponentEvent?) = resetTransparent(e)
-        override fun componentResized(e: ComponentEvent?) = resetTransparent(e)
-        override fun componentShown(e: ComponentEvent?) = resetTransparent(e)
+        override fun componentMoved(e: ComponentEvent?) = resetBlur(e)
+        override fun componentResized(e: ComponentEvent?) = resetBlur(e)
+        override fun componentShown(e: ComponentEvent?) = resetBlur(e)
     }
 
     @Suppress("UNUSED_PARAMETER")
-    private fun resetTransparent(e: AWTEvent?) {
+    private fun resetBlur(e: AWTEvent?) {
         if (blurEnabled) updateBlur()
     }