@@ -7,8 +7,13 @@ import androidx.compose.foundation.layout.Column
77import androidx.compose.foundation.layout.fillMaxWidth
88import androidx.compose.foundation.layout.height
99import androidx.compose.foundation.layout.padding
10+ import androidx.compose.foundation.layout.size
11+ import androidx.compose.foundation.shape.CircleShape
1012import androidx.compose.foundation.shape.RoundedCornerShape
1113import androidx.compose.foundation.window.WindowDraggableArea
14+ import androidx.compose.material3.Icon
15+ import androidx.compose.material3.IconButton
16+ import androidx.compose.material3.IconButtonDefaults
1217import androidx.compose.material3.Surface
1318import androidx.compose.material3.Text
1419import androidx.compose.ui.Alignment
@@ -18,6 +23,7 @@ import androidx.compose.ui.text.font.FontFamily
1823import androidx.compose.ui.unit.dp
1924import androidx.compose.ui.unit.sp
2025import androidx.compose.ui.window.Window
26+ import androidx.compose.ui.window.WindowPlacement
2127import androidx.compose.ui.window.application
2228import androidx.compose.ui.window.rememberWindowState
2329import io.github.redddfoxxyy.pomolin.data.AppSettings
@@ -27,6 +33,9 @@ import org.jetbrains.compose.resources.painterResource
2733import pomolin.composeapp.generated.resources.JetBrainsMonoNerdFont_ExtraBold
2834import pomolin.composeapp.generated.resources.Pomolin
2935import pomolin.composeapp.generated.resources.Res
36+ import pomolin.composeapp.generated.resources.close
37+ import pomolin.composeapp.generated.resources.maximize
38+ import pomolin.composeapp.generated.resources.restore
3039import java.awt.Dimension
3140import javax.swing.SwingUtilities
3241
@@ -81,6 +90,89 @@ fun main() = application {
8190 fontSize = 18 .sp,
8291 color = ThemeManager .colors.mauve
8392 )
93+ Box (
94+ modifier = Modifier
95+ .padding(end = 8 .dp, top = 2 .dp)
96+ .align(Alignment .TopEnd )
97+ .size(22 .dp) // This now correctly controls the background circle size
98+ .background(
99+ color = ThemeManager .colors.surface.copy(alpha = 0.8f ),
100+ shape = CircleShape
101+ ),
102+ contentAlignment = Alignment .Center
103+ ) {
104+ IconButton (
105+ onClick = { exitApplication() },
106+ modifier = Modifier
107+ // .padding(end = 10.dp, top = 1.dp)
108+ .size(22 .dp) // Smaller size for just the button
109+ .align(Alignment .TopEnd ),
110+ // .background(
111+ // color = ThemeManager.colors.surface,
112+ // shape = CircleShape // Explicit circle shape
113+ // ),
114+ colors = IconButtonDefaults .iconButtonColors(
115+ containerColor = Color .Transparent , // Button itself has mauve background
116+ contentColor = ThemeManager .colors.mauve.copy(alpha = 0.8f ), // Icon color
117+ ),
118+ ) {
119+ Icon (
120+ painterResource(Res .drawable.close),
121+ contentDescription = " Close App" ,
122+ modifier = Modifier .size(16 .dp) // Control icon size
123+ )
124+ }
125+ }
126+ Box (
127+ modifier = Modifier
128+ .padding(end = 36 .dp, top = 2 .dp)
129+ .align(Alignment .TopEnd )
130+ .size(22 .dp) // This now correctly controls the background circle size
131+ .background(
132+ color = ThemeManager .colors.surface.copy(alpha = 0.8f ),
133+ shape = CircleShape
134+ ),
135+ contentAlignment = Alignment .Center
136+ ) {
137+ IconButton (
138+ onClick = {
139+ windowState.placement =
140+ if (windowState.placement == WindowPlacement .Maximized ) {
141+ WindowPlacement .Floating
142+ } else {
143+ WindowPlacement .Maximized
144+ }
145+ },
146+ modifier = Modifier
147+ // .padding(end = 10.dp, top = 1.dp)
148+ .size(22 .dp) // Smaller size for just the button
149+ .align(Alignment .TopEnd ),
150+ // .background(
151+ // color = ThemeManager.colors.surface,
152+ // shape = CircleShape // Explicit circle shape
153+ // ),
154+ colors = IconButtonDefaults .iconButtonColors(
155+ containerColor = Color .Transparent , // Button itself has mauve background
156+ contentColor = ThemeManager .colors.mauve.copy(alpha = 0.8f ), // Icon color
157+ ),
158+ ) {
159+ Icon (
160+ painterResource(
161+ if (windowState.placement == WindowPlacement .Maximized ) {
162+ Res .drawable.restore // Icon when maximized (shows restore icon)
163+ } else {
164+ Res .drawable.maximize // Icon when not maximized (shows maximize icon)
165+ }
166+ ),
167+ contentDescription = if (windowState.placement == WindowPlacement .Maximized ) {
168+ " Restore Window"
169+ } else {
170+ " Maximize Window"
171+ },
172+ modifier = Modifier .size(16 .dp) // Control icon size
173+ )
174+ }
175+ }
84176 }
85177 }
86178 }
0 commit comments