1+ @file:OptIn(ExperimentalTrayAppApi ::class )
2+
13package com.kdroid.composetray.tray.api
24
35import androidx.compose.animation.core.AnimationSpec
@@ -71,6 +73,7 @@ fun ApplicationScope.TrayApp(
7173 visibleOnStart : Boolean = false,
7274 fadeDurationMs : Int = 200,
7375 animationSpec : AnimationSpec <Float > = tween(durationMillis = fadeDurationMs, easing = EaseInOut ),
76+ transparent : Boolean = true,
7477 menu : (TrayMenuBuilder .() -> Unit )? = null,
7578 content : @Composable () -> Unit ,
7679) {
@@ -93,6 +96,7 @@ fun ApplicationScope.TrayApp(
9396 visibleOnStart = visibleOnStart,
9497 fadeDurationMs = fadeDurationMs,
9598 animationSpec = animationSpec,
99+ transparent = transparent,
96100 menu = menu,
97101 content = content,
98102 )
@@ -109,6 +113,7 @@ fun ApplicationScope.TrayApp(
109113 visibleOnStart : Boolean = false,
110114 fadeDurationMs : Int = 200,
111115 animationSpec : AnimationSpec <Float > = tween(durationMillis = fadeDurationMs, easing = EaseInOut ),
116+ transparent : Boolean = true,
112117 menu : (TrayMenuBuilder .() -> Unit )? = null,
113118 content : @Composable () -> Unit ,
114119) {
@@ -124,6 +129,7 @@ fun ApplicationScope.TrayApp(
124129 visibleOnStart = visibleOnStart,
125130 fadeDurationMs = fadeDurationMs,
126131 animationSpec = animationSpec,
132+ transparent = transparent,
127133 menu = menu,
128134 content = content,
129135 )
@@ -142,6 +148,7 @@ fun ApplicationScope.TrayApp(
142148 visibleOnStart : Boolean = false,
143149 fadeDurationMs : Int = 200,
144150 animationSpec : AnimationSpec <Float > = tween(durationMillis = fadeDurationMs, easing = EaseInOut ),
151+ transparent : Boolean = true,
145152 menu : (TrayMenuBuilder .() -> Unit )? = null,
146153 content : @Composable () -> Unit ,
147154) {
@@ -155,6 +162,7 @@ fun ApplicationScope.TrayApp(
155162 visibleOnStart = visibleOnStart,
156163 fadeDurationMs = fadeDurationMs,
157164 animationSpec = animationSpec,
165+ transparent = transparent,
158166 menu = menu,
159167 content = content,
160168 )
@@ -169,6 +177,7 @@ fun ApplicationScope.TrayApp(
169177 visibleOnStart = visibleOnStart,
170178 fadeDurationMs = fadeDurationMs,
171179 animationSpec = animationSpec,
180+ transparent = transparent,
172181 menu = menu,
173182 content = content,
174183 )
@@ -186,6 +195,7 @@ fun ApplicationScope.TrayApp(
186195 visibleOnStart : Boolean = false,
187196 fadeDurationMs : Int = 200,
188197 animationSpec : AnimationSpec <Float > = tween(durationMillis = fadeDurationMs, easing = EaseInOut ),
198+ transparent : Boolean = true,
189199 menu : (TrayMenuBuilder .() -> Unit )? = null,
190200 content : @Composable () -> Unit ,
191201) {
@@ -198,6 +208,7 @@ fun ApplicationScope.TrayApp(
198208 visibleOnStart = visibleOnStart,
199209 fadeDurationMs = fadeDurationMs,
200210 animationSpec = animationSpec,
211+ transparent = transparent,
201212 menu = menu,
202213 content = content,
203214 )
@@ -216,6 +227,7 @@ fun ApplicationScope.TrayApp(
216227 visibleOnStart : Boolean = false,
217228 fadeDurationMs : Int = 200,
218229 animationSpec : AnimationSpec <Float > = tween(durationMillis = fadeDurationMs, easing = EaseInOut ),
230+ transparent : Boolean = true,
219231 menu : (TrayMenuBuilder .() -> Unit )? = null,
220232 content : @Composable () -> Unit ,
221233) {
@@ -229,6 +241,7 @@ fun ApplicationScope.TrayApp(
229241 visibleOnStart = visibleOnStart,
230242 fadeDurationMs = fadeDurationMs,
231243 animationSpec = animationSpec,
244+ transparent = transparent,
232245 menu = menu,
233246 content = content,
234247 )
@@ -243,6 +256,7 @@ fun ApplicationScope.TrayApp(
243256 visibleOnStart = visibleOnStart,
244257 fadeDurationMs = fadeDurationMs,
245258 animationSpec = animationSpec,
259+ transparent = transparent,
246260 menu = menu,
247261 content = content,
248262 )
@@ -262,17 +276,18 @@ fun ApplicationScope.TrayApp(
262276 visibleOnStart : Boolean = false,
263277 fadeDurationMs : Int = 200,
264278 animationSpec : AnimationSpec <Float > = tween(durationMillis = fadeDurationMs, easing = EaseInOut ),
279+ transparent : Boolean = true,
265280 menu : (TrayMenuBuilder .() -> Unit )? = null,
266281 content : @Composable () -> Unit ,
267282) {
268283 when (getOperatingSystem()) {
269284 OperatingSystem .LINUX -> TrayAppImplLinux (
270285 iconContent, iconRenderProperties, tooltip, state, windowSize,
271- visibleOnStart, fadeDurationMs, animationSpec, menu, content
286+ visibleOnStart, fadeDurationMs, animationSpec, transparent, menu, content
272287 )
273288 else -> TrayAppImplOriginal (
274289 iconContent, iconRenderProperties, tooltip, state, windowSize,
275- visibleOnStart, fadeDurationMs, animationSpec, menu, content
290+ visibleOnStart, fadeDurationMs, animationSpec, transparent, menu, content
276291 )
277292 }
278293}
@@ -289,6 +304,7 @@ private fun ApplicationScope.TrayAppImplOriginal(
289304 visibleOnStart : Boolean ,
290305 fadeDurationMs : Int ,
291306 animationSpec : AnimationSpec <Float >,
307+ transparent : Boolean ,
292308 menu : (TrayMenuBuilder .() -> Unit )? ,
293309 content : @Composable () -> Unit ,
294310) {
@@ -428,7 +444,7 @@ private fun ApplicationScope.TrayAppImplOriginal(
428444 resizable = false ,
429445 focusable = true ,
430446 alwaysOnTop = true ,
431- transparent = true ,
447+ transparent = transparent ,
432448 visible = shouldShowWindow,
433449 state = dialogState,
434450 ) {
@@ -502,6 +518,7 @@ private fun ApplicationScope.TrayAppImplLinux(
502518 visibleOnStart : Boolean ,
503519 fadeDurationMs : Int ,
504520 animationSpec : AnimationSpec <Float >,
521+ transparent : Boolean ,
505522 menu : (TrayMenuBuilder .() -> Unit )? ,
506523 content : @Composable () -> Unit ,
507524) {
@@ -616,7 +633,7 @@ private fun ApplicationScope.TrayAppImplLinux(
616633 resizable = false ,
617634 focusable = shouldShowWindow, // avoid focus-steal while hidden
618635 alwaysOnTop = true ,
619- transparent = true ,
636+ transparent = transparent ,
620637 visible = shouldShowWindow,
621638 state = dialogState,
622639 ) {
0 commit comments