mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Move dock icon initialization
This commit is contained in:
parent
629e8e1dec
commit
e2a1ad7c78
2 changed files with 16 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
|||
package io.xpipe.app.core;
|
||||
|
||||
import io.xpipe.app.Main;
|
||||
import io.xpipe.app.comp.AppLayoutComp;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
|
@ -14,7 +13,6 @@ import javafx.stage.Stage;
|
|||
import lombok.Getter;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
|
||||
@Getter
|
||||
|
@ -35,20 +33,6 @@ public class App extends Application {
|
|||
stage = primaryStage;
|
||||
stage.opacityProperty().bind(AppPrefs.get().windowOpacity());
|
||||
|
||||
// Set dock icon explicitly on mac
|
||||
// This is necessary in case XPipe was started through a script as it will have no icon otherwise
|
||||
if (OsType.getLocal().equals(OsType.MACOS) && AppProperties.get().isDeveloperMode() && AppLogs.get().isWriteToSysout()) {
|
||||
try {
|
||||
var iconUrl = Main.class.getResourceAsStream("resources/img/logo/logo_macos_128x128.png");
|
||||
if (iconUrl != null) {
|
||||
var awtIcon = ImageIO.read(iconUrl);
|
||||
Taskbar.getTaskbar().setIconImage(awtIcon);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ErrorEvent.fromThrowable(ex).omitted(true).build().handle();
|
||||
}
|
||||
}
|
||||
|
||||
if (OsType.getLocal().equals(OsType.MACOS)) {
|
||||
Desktop.getDesktop().setPreferencesHandler(e -> {
|
||||
AppLayoutModel.get().selectSettings();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.xpipe.app.core.mode;
|
||||
|
||||
import io.xpipe.app.Main;
|
||||
import io.xpipe.app.core.*;
|
||||
import io.xpipe.app.core.check.AppTempCheck;
|
||||
import io.xpipe.app.core.check.AppUserDirectoryCheck;
|
||||
|
@ -18,6 +19,7 @@ import io.xpipe.core.util.XPipeInstallation;
|
|||
import javafx.application.Platform;
|
||||
import lombok.Getter;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.desktop.AppReopenedEvent;
|
||||
import java.awt.desktop.AppReopenedListener;
|
||||
|
@ -144,6 +146,20 @@ public abstract class OperationMode {
|
|||
OperationMode.switchToAsync(OperationMode.GUI);
|
||||
}
|
||||
});
|
||||
|
||||
// Set dock icon explicitly on mac
|
||||
// This is necessary in case XPipe was started through a script as it will have no icon otherwise
|
||||
if (AppProperties.get().isDeveloperMode() && AppLogs.get().isWriteToSysout()) {
|
||||
try {
|
||||
var iconUrl = Main.class.getResourceAsStream("resources/img/logo/logo_macos_128x128.png");
|
||||
if (iconUrl != null) {
|
||||
var awtIcon = ImageIO.read(iconUrl);
|
||||
Taskbar.getTaskbar().setIconImage(awtIcon);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ErrorEvent.fromThrowable(ex).omitted(true).build().handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataStoreProviders.postInit(AppExtensionManager.getInstance().getExtendedLayer());
|
||||
|
|
Loading…
Reference in a new issue