|
22 | 22 | - **Single Instance Management**: Ensures that only one instance of the application can run at a time and allows restoring focus to the running instance when another instance is attempted. |
23 | 23 | - **Tray Position Detection**: Allows determining the position of the system tray, which helps in positioning related windows appropriately. |
24 | 24 | - **Compose Recomposition Support**: The tray supports Compose recomposition, making it possible to dynamically show or hide the tray icon, for example: |
25 | | - |
| 25 | + |
26 | 26 | <p align="center"> |
27 | 27 | <img src="screenshots/demo.gif" alt="demo"> |
28 | 28 | </p> |
@@ -67,7 +67,6 @@ application { |
67 | 67 | modifier = Modifier.fillMaxSize() // This is crucial! |
68 | 68 | ) |
69 | 69 | }, |
70 | | - iconRenderProperties = IconRenderProperties.forCurrentOperatingSystem(), // If you need icon render customization |
71 | 70 | tooltip = "My Application", |
72 | 71 | primaryAction = { |
73 | 72 | Log.i(logTag, "Primary action triggered") |
@@ -132,6 +131,41 @@ application { |
132 | 131 | - **dispose**: Call to remove the system tray icon and exit gracefully. |
133 | 132 | - **Primary Action**: An action triggered by a left-click on the tray icon (Windows and macOS) or as a top item in the context menu (Linux). |
134 | 133 |
|
| 134 | +### 🎨 Icon Rendering Customization |
| 135 | + |
| 136 | +The `IconRenderProperties` class allows you to customize how your tray icon is rendered. This is an optional parameter when using the Tray component, with a default value already provided: |
| 137 | + |
| 138 | +```kotlin |
| 139 | +iconRenderProperties = IconRenderProperties.forCurrentOperatingSystem() |
| 140 | +``` |
| 141 | + |
| 142 | +#### Available Factory Methods: |
| 143 | + |
| 144 | +1. **forCurrentOperatingSystem()**: Creates properties optimized for the current operating system: |
| 145 | + - Windows: 32x32 pixels |
| 146 | + - macOS: 44x44 pixels |
| 147 | + - Linux: 24x24 pixels |
| 148 | + |
| 149 | + ```kotlin |
| 150 | + IconRenderProperties.forCurrentOperatingSystem( |
| 151 | + sceneWidth = 192, // Optional: Width of the compose scene (default: 192) |
| 152 | + sceneHeight = 192, // Optional: Height of the compose scene (default: 192) |
| 153 | + density = Density(2f) // Optional: Density for the compose scene (default: 2f) |
| 154 | + ) |
| 155 | + ``` |
| 156 | + |
| 157 | +2. **withoutScalingAndAliasing()**: Creates properties that don't force icon scaling and aliasing: |
| 158 | + |
| 159 | + ```kotlin |
| 160 | + IconRenderProperties.withoutScalingAndAliasing( |
| 161 | + sceneWidth = 192, // Optional: Width of the compose scene (default: 192) |
| 162 | + sceneHeight = 192, // Optional: Height of the compose scene (default: 192) |
| 163 | + density = Density(2f) // Optional: Density for the compose scene (default: 2f) |
| 164 | + ) |
| 165 | + ``` |
| 166 | + |
| 167 | +This allows you to fine-tune how your icon appears in the system tray across different platforms. |
| 168 | + |
135 | 169 | ### 🔄 Single Instance Management |
136 | 170 |
|
137 | 171 | The `SingleInstanceManager` ensures that only one instance of the application is running at a time. When a second instance tries to start, it sends a restore request to the existing instance to bring it to the foreground. |
@@ -214,4 +248,4 @@ Feel free to open issues or pull requests if you find any bugs or have suggestio |
214 | 248 |
|
215 | 249 | ## 🙏 Acknowledgements |
216 | 250 |
|
217 | | -This library is developed and maintained by Elie G, aiming to provide an easy and cross-platform system tray solution for Kotlin applications. |
| 251 | +This library is developed and maintained by Elie G, aiming to provide an easy and cross-platform system tray solution for Kotlin applications. |
0 commit comments