This commit is contained in:
crschnick 2024-05-03 16:17:57 +00:00
parent 2d367aadb9
commit 650398b541
6 changed files with 16 additions and 10 deletions

View file

@ -12,6 +12,7 @@ import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.update.UpdateAvailableAlert;
import io.xpipe.app.update.XPipeDistributionType;
import io.xpipe.app.util.Hyperlinks;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;

View file

@ -6,9 +6,11 @@ import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.update.XPipeDistributionType;
import io.xpipe.app.util.LicenseProvider;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.stage.Stage;
import lombok.Getter;
import lombok.SneakyThrows;

View file

@ -8,20 +8,22 @@ import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.process.OsType;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.desktop.*;
import java.util.List;
import javax.imageio.ImageIO;
public class AppIntegration {
public static void setupDesktopIntegrations() {
try {
Desktop.getDesktop().addAppEventListener(new SystemSleepListener() {
@Override
public void systemAboutToSleep(SystemSleepEvent e) {
if (AppPrefs.get() != null && AppPrefs.get().lockVaultOnHibernation().get() && AppPrefs.get().getLockCrypt().get() != null && !AppPrefs.get().getLockCrypt().get().isBlank()) {
if (AppPrefs.get() != null
&& AppPrefs.get().lockVaultOnHibernation().get()
&& AppPrefs.get().getLockCrypt().get() != null
&& !AppPrefs.get().getLockCrypt().get().isBlank()) {
// If we run this at the same time as the system is sleeping, there might be exceptions
// because the platform does not like being shut down while sleeping
// This hopefully assures that it will be run later, probably on system wake
@ -33,9 +35,7 @@ public class AppIntegration {
}
@Override
public void systemAwoke(SystemSleepEvent e) {
}
public void systemAwoke(SystemSleepEvent e) {}
});
// This will initialize the toolkit on macos and create the dock icon
@ -92,5 +92,4 @@ public class AppIntegration {
ErrorEvent.fromThrowable(ex).term().handle();
}
}
}

View file

@ -13,7 +13,9 @@ import io.xpipe.app.util.XPipeSession;
import io.xpipe.core.util.FailableRunnable;
import io.xpipe.core.util.XPipeDaemonMode;
import io.xpipe.core.util.XPipeInstallation;
import javafx.application.Platform;
import lombok.Getter;
import java.util.ArrayList;

View file

@ -55,8 +55,9 @@ public class VaultCategory extends AppPrefsCategory {
prefs.getLockCrypt())
.nameAndDescription("lockVaultOnHibernation")
.addToggle(prefs.lockVaultOnHibernation)
.hide(prefs.getLockCrypt().isNull().or(prefs.getLockCrypt().isEmpty()))
);
.hide(prefs.getLockCrypt()
.isNull()
.or(prefs.getLockCrypt().isEmpty())));
return builder.buildComp();
}
}

View file

@ -37,7 +37,8 @@ public class EditFileAction implements LeafAction {
@Override
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
var e = AppPrefs.get().externalEditor().getValue();
return AppI18n.observable("editWithEditor", e != null ? e.toTranslatedString().getValue() : "?");
return AppI18n.observable(
"editWithEditor", e != null ? e.toTranslatedString().getValue() : "?");
}
@Override