Various fixes

This commit is contained in:
crschnick 2025-04-02 15:41:09 +00:00
parent b9ac594d55
commit 9c5b86af9d
6 changed files with 47 additions and 6 deletions

View file

@ -11,6 +11,8 @@ import org.apache.commons.io.FileUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.util.Optional;
import java.util.function.Supplier;
public class AppCache {
@ -107,4 +109,22 @@ public class AppCache {
.handle();
}
}
public static Optional<Instant> getModifiedTime(String key) {
var path = getPath(key);
if (Files.exists(path)) {
try {
var t = Files.getLastModifiedTime(path);
return Optional.of(t.toInstant());
} catch (Exception e) {
ErrorEvent.fromThrowable("Could not get modified date for " + key, e)
.omitted(true)
.build()
.handle();
return Optional.empty();
}
} else {
return Optional.empty();
}
}
}

View file

@ -81,6 +81,7 @@ public class TroubleshootCategory extends AppPrefsCategory {
"mdmz-text_snippet",
e -> {
AppLogs.get().flush();
ThreadHelper.sleep(100);
FileOpener.openInTextEditor(AppLogs.get()
.getSessionLogsDirectory()
.resolve("xpipe.log")

View file

@ -2,6 +2,7 @@ package io.xpipe.app.terminal;
import io.xpipe.app.core.AppCache;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.AppVersion;
import io.xpipe.app.ext.ProcessControlProvider;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.prefs.AppPrefs;
@ -18,6 +19,10 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.concurrent.atomic.AtomicInteger;
public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerminalType {
@ -70,8 +75,12 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm
}
default void checkProfile() throws IOException {
// Update old configs
var before = LocalDate.of(2025, 4, 2).atStartOfDay(ZoneId.systemDefault()).toInstant();
var outdated = AppCache.getModifiedTime("wtProfileSet").map(instant -> instant.isBefore(before)).orElse(false);
var profileSet = AppCache.getBoolean("wtProfileSet", false);
if (profileSet) {
if (profileSet && !outdated) {
return;
}
@ -97,6 +106,7 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm
newProfile.put("name", "XPipe");
newProfile.put("closeOnExit", "always");
newProfile.put("suppressApplicationTitle", true);
newProfile.put("elevate", false);
if (!AppProperties.get().isDevelopmentEnvironment()) {
var dir = XPipeInstallation.getLocalDefaultInstallationIcon();
newProfile.put("icon", dir.toString());

View file

@ -124,9 +124,10 @@ public enum PlatformState {
}
}
if (SystemUtils.IS_OS_WINDOWS && ModifiedStage.mergeFrame()) {
if (SystemUtils.IS_OS_WINDOWS) {
// This is primarily intended to fix Windows unified stage transparency issues
// (https://bugs.openjdk.org/browse/JDK-8329382)
// But apparently it can also occur without a custom stage on Windows
System.setProperty("prism.forceUploadingPainter", "true");
}

View file

@ -25,9 +25,15 @@ public class JacksonMapper {
private static boolean init = false;
static {
ObjectMapper objectMapper = BASE;
configureBase(BASE);
INSTANCE = BASE.copy();
}
@SuppressWarnings("deprecation")
private static void configureBase(ObjectMapper objectMapper) {
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
objectMapper.enable(JsonParser.Feature.ALLOW_COMMENTS);
objectMapper.enable(JsonParser.Feature.ALLOW_TRAILING_COMMA);
objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE);
@ -40,8 +46,6 @@ public class JacksonMapper {
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE)
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE));
INSTANCE = BASE.copy();
}
public static <T> T parse(String s, Class<T> c) throws JsonProcessingException {

View file

@ -12,7 +12,11 @@ You can toggle the batch mode in the top left corner.
## Terminals
There is now built-in support for the terminal multiplexers tmux, zellij, and screen. There's also now support to run custom init commands for the terminal session to configure the terminal appearance specific to XPipe.
There is now built-in support for the terminal multiplexers tmux, zellij, and screen.
There is also now support for custom prompts with starship, oh-my-posh, and oh-my-zsh.
You can now run custom init commands for the terminal session to configure the terminal appearance specific to XPipe.
On Windows, you now have the ability to use a WSL or Cygwin environment as the terminal environment, allowing you to use the new terminal multiplexer integration seamlessly on Windows as well.
@ -44,3 +48,4 @@ The password manager integration has been improved and made more robust:
- Fix custom service commands not launching properly with PowerShell as the local shell
- Fix update check being influenced by the local GitHub rate limiting
- Fix repeated file browser errors when remote system did not have the stat command
- Fix Windows terminal launch failing if default profile was set to launch as admin