Skip to content

Commit 4b7d97d

Browse files
committed
Replace NSDockTile JNI with native NSDockTilePlugin
1 parent 89b43ad commit 4b7d97d

File tree

10 files changed

+238
-132
lines changed

10 files changed

+238
-132
lines changed

pom.xml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,58 @@
227227
</arguments>
228228
</configuration>
229229
</execution>
230+
<execution>
231+
<id>xcode-build-docktile-intel</id>
232+
<goals>
233+
<goal>exec</goal>
234+
</goals>
235+
<phase>compile</phase>
236+
<configuration>
237+
<executable>xcodebuild</executable>
238+
<workingDirectory>${project.basedir}/src/main/native</workingDirectory>
239+
<arguments>
240+
<argument>-project</argument>
241+
<argument>Integrations.xcodeproj</argument>
242+
<argument>-scheme</argument>
243+
<argument>DockTilePlugin</argument>
244+
<argument>-configuration</argument>
245+
<argument>Release</argument>
246+
<argument>-arch</argument>
247+
<argument>x86_64</argument>
248+
<argument>-derivedDataPath</argument>
249+
<argument>${project.build.directory}/docktile-x86_64-build</argument>
250+
<argument>-quiet</argument>
251+
<argument>clean</argument>
252+
<argument>build</argument>
253+
</arguments>
254+
</configuration>
255+
</execution>
256+
<execution>
257+
<id>xcode-build-docktile-arm</id>
258+
<goals>
259+
<goal>exec</goal>
260+
</goals>
261+
<phase>compile</phase>
262+
<configuration>
263+
<executable>xcodebuild</executable>
264+
<workingDirectory>${project.basedir}/src/main/native</workingDirectory>
265+
<arguments>
266+
<argument>-project</argument>
267+
<argument>Integrations.xcodeproj</argument>
268+
<argument>-scheme</argument>
269+
<argument>DockTilePlugin</argument>
270+
<argument>-configuration</argument>
271+
<argument>Release</argument>
272+
<argument>-arch</argument>
273+
<argument>arm64</argument>
274+
<argument>-derivedDataPath</argument>
275+
<argument>${project.build.directory}/docktile-arm64-build</argument>
276+
<argument>-quiet</argument>
277+
<argument>clean</argument>
278+
<argument>build</argument>
279+
</arguments>
280+
</configuration>
281+
</execution>
230282
<execution>
231283
<id>build-universal-binary</id>
232284
<goals>
@@ -245,6 +297,27 @@
245297
</arguments>
246298
</configuration>
247299
</execution>
300+
<execution>
301+
<id>merge-docktile-bundles</id>
302+
<goals>
303+
<goal>exec</goal>
304+
</goals>
305+
<phase>compile</phase>
306+
<configuration>
307+
<executable>bash</executable>
308+
<workingDirectory>${project.build.directory}</workingDirectory>
309+
<arguments>
310+
<argument>-c</argument>
311+
<argument>
312+
cp -R docktile-arm64-build/Build/Products/Release/Cryptomator.docktileplugin . &amp;&amp;
313+
lipo -create \
314+
docktile-x86_64-build/Build/Products/Release/Cryptomator.docktileplugin/Contents/MacOS/Cryptomator \
315+
docktile-arm64-build/Build/Products/Release/Cryptomator.docktileplugin/Contents/MacOS/Cryptomator \
316+
-output Cryptomator.docktileplugin/Contents/MacOS/Cryptomator
317+
</argument>
318+
</arguments>
319+
</configuration>
320+
</execution>
248321
</executions>
249322
</plugin>
250323
<plugin>
@@ -263,6 +336,7 @@
263336
<directory>${project.build.directory}</directory>
264337
<includes>
265338
<include>libIntegrations.dylib</include>
339+
<include>Cryptomator.docktileplugin/**</include>
266340
</includes>
267341
</resource>
268342
</resources>

src/main/headers/org_cryptomator_macos_tray_DockTileIcon_Native.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/main/java/org/cryptomator/macos/tray/DockTileIcon.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/main/java/org/cryptomator/macos/tray/MacTrayIntegrationProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class MacTrayIntegrationProvider implements TrayIntegrationProvider {
1212

1313
public MacTrayIntegrationProvider() {
1414
this.activationPolicy = new ActivationPolicy();
15-
DockTileIcon.applyIcon("Cryptomator", "icns");
1615
}
1716

1817
@Override
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// CryptomatorDockTilePlugin.swift
3+
// Integrations
4+
//
5+
// Created by Tobias Hagemann on 22.09.25.
6+
// Copyright © 2025 Cryptomator. All rights reserved.
7+
//
8+
9+
import AppKit
10+
11+
class CryptomatorDockTilePlugin: NSObject, NSDockTilePlugIn {
12+
func setDockTile(_ dockTile: NSDockTile?) {
13+
guard let dockTile = dockTile, let image = Bundle(for: Self.self).image(forResource: "Cryptomator") else {
14+
return
15+
}
16+
dockTile.contentView = NSImageView(image: image)
17+
dockTile.display()
18+
}
19+
}

0 commit comments

Comments
 (0)