|
6 | 6 |
|
7 | 7 | **Compose Native Tray** is a Kotlin library that provides a simple way to create system tray applications with native support for Linux, Windows, and macOS. This library was created to address several issues with the Compose for Desktop tray, including poor HDPI support on Windows and Linux, as well as the outdated appearance of the tray on Linux, which resembled Windows 95. In addition to these fixes, ComposeTray also adds support for checkable items, dividers, submenus, and even nested submenus, offering a more feature-rich and modern solution. The Linux implementation uses GTK, while macOS uses AWT, and the Windows implementation is based on native system calls. Additionally, it allows you to enable or disable individual tray items dynamically. This library allows you to add a system tray icon, tooltip, and menu with various options in a Kotlin DSL-style syntax. |
8 | 8 |
|
9 | | -> **Warning**: This library is highly experimental, and its APIs are subject to change. |
10 | 9 |
|
11 | 10 | ## ✨ Features |
12 | 11 |
|
@@ -46,7 +45,7 @@ To use the ComposeTray library, add it as a dependency in your `build.gradle.kts |
46 | 45 |
|
47 | 46 | ```kotlin |
48 | 47 | dependencies { |
49 | | - implementation("io.github.kdroidfilter:composenativetray:0.5.5") |
| 48 | + implementation("io.github.kdroidfilter:composenativetray:0.6.0") |
50 | 49 | } |
51 | 50 | ``` |
52 | 51 |
|
@@ -132,24 +131,6 @@ 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 |
|
135 | | -### 🖥️ Platform-Specific Implementation |
136 | | -The `NativeTray` class automatically detects the operating system and initializes the appropriate tray implementation: |
137 | | -- **Linux**: Uses `LinuxTrayInitializer`, which is implemented using GTK via JNA. |
138 | | -- **Windows**: Uses `WindowsTrayInitializer`, which is based on the [tray library by dmikushin](https://github.com/dmikushin/tray). |
139 | | -- **macOS**: Uses `AwtTrayInitializer`, which is implemented using AWT. |
140 | | - |
141 | | -> Note: The library now accepts a Composable for the tray icon instead of file paths. The Composable is converted to the appropriate image format for each platform automatically. |
142 | | -
|
143 | | -### 🗂️ Windows DLL Generation |
144 | | -To generate the Windows DLL, execute the following command: |
145 | | -```bash |
146 | | -gcc -shared -o ../resources/win32-x86-64/tray.dll tray_windows.c |
147 | | -```` |
148 | | - |
149 | | -### 📜 Logging |
150 | | - |
151 | | -This example uses the `kmplog` library for logging, which allows you to log messages when certain items are selected or toggled. |
152 | | - |
153 | 134 | ### 🔄 Single Instance Management |
154 | 135 |
|
155 | 136 | 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. |
@@ -226,9 +207,9 @@ Feel free to open issues or pull requests if you find any bugs or have suggestio |
226 | 207 |
|
227 | 208 | ## ✅ Things to Implement |
228 | 209 |
|
229 | | -- ✅ Implement a system to check if an instance of the application is already running |
230 | | -- ✅ Add the ability to locate the position of the systray (top left, top right, etc.) |
231 | | -- Add the ability to dynamically change the tray icon |
| 210 | +- ✅ ~~Implement a system to check if an instance of the application is already running~~ |
| 211 | +- ✅ ~~Add the ability to locate the position of the systray (top left, top right, etc.)~~ |
| 212 | +- ✅ ~~Add the ability to dynamically change the tray icon~~ |
232 | 213 |
|
233 | 214 | ## 🙏 Acknowledgements |
234 | 215 |
|
|
0 commit comments