Small fixes

This commit is contained in:
crschnick 2024-08-26 21:52:40 +00:00
parent 44c2f5db87
commit 542e535e42
3 changed files with 7 additions and 20 deletions

View file

@ -9,18 +9,14 @@ import io.xpipe.app.util.PlatformState;
import io.xpipe.app.util.ThreadHelper; import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.process.OsType; import io.xpipe.core.process.OsType;
import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.desktop.*; import java.awt.desktop.*;
import java.util.List; import java.util.List;
import javax.imageio.ImageIO;
public class AppDesktopIntegration { public class AppDesktopIntegration {
public static void setupDesktopIntegrations() { public static void setupDesktopIntegrations() {
if (PlatformState.getCurrent() != PlatformState.RUNNING) {
return;
}
try { try {
if (Desktop.isDesktopSupported()) { if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().addAppEventListener(new SystemSleepListener() { Desktop.getDesktop().addAppEventListener(new SystemSleepListener() {
@ -49,6 +45,10 @@ public class AppDesktopIntegration {
// macOS does not like applications that run fully in the background, so always do it // macOS does not like applications that run fully in the background, so always do it
if (OsType.getLocal().equals(OsType.MACOS) && Desktop.isDesktopSupported()) { if (OsType.getLocal().equals(OsType.MACOS) && Desktop.isDesktopSupported()) {
Desktop.getDesktop().setPreferencesHandler(e -> { Desktop.getDesktop().setPreferencesHandler(e -> {
if (PlatformState.getCurrent() != PlatformState.RUNNING) {
return;
}
AppLayoutModel.get().selectSettings(); AppLayoutModel.get().selectSettings();
}); });
@ -84,19 +84,6 @@ public class AppDesktopIntegration {
} }
} }
} }
if (OsType.getLocal().equals(OsType.LINUX) && !GraphicsEnvironment.isHeadless()) {
try {
Toolkit xToolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field awtAppClassNameField =
xToolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, "XPipe");
} catch (Exception e) {
ErrorEvent.fromThrowable(e).omit().handle();
}
}
} catch (Throwable ex) { } catch (Throwable ex) {
ErrorEvent.fromThrowable(ex).term().handle(); ErrorEvent.fromThrowable(ex).term().handle();
} }

View file

@ -47,7 +47,7 @@ public class ConnectionFileSystem implements FileSystem {
if (!shellControl.getTtyState().isPreservesOutput() if (!shellControl.getTtyState().isPreservesOutput()
|| !shellControl.getTtyState().isSupportsInput()) { || !shellControl.getTtyState().isSupportsInput()) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"Shell has a PTY allocated and does not support file system operations"); "Shell has a PTY allocated and as a result does not support file system operations");
} }
return this; return this;

2
dist/build.gradle vendored
View file

@ -3,7 +3,7 @@ plugins {
id 'org.beryx.jlink' version '3.0.1' id 'org.beryx.jlink' version '3.0.1'
id "org.asciidoctor.jvm.convert" version "4.0.3" id "org.asciidoctor.jvm.convert" version "4.0.3"
id 'org.jreleaser' version '1.13.1' id 'org.jreleaser' version '1.13.1'
id("com.netflix.nebula.ospackage") version "11.9.1" id("com.netflix.nebula.ospackage") version "11.10.0"
id 'org.gradle.crypto.checksum' version '1.4.0' id 'org.gradle.crypto.checksum' version '1.4.0'
id 'signing' id 'signing'
} }