mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-07-08 11:30:42 +00:00
Rework
This commit is contained in:
@@ -81,6 +81,10 @@ public interface McpToolHandler
|
||||
}
|
||||
|
||||
public String getStringArgument(String key) throws BeaconClientException {
|
||||
if (request.arguments() == null) {
|
||||
throw new BeaconClientException("Missing argument for key " + key);
|
||||
}
|
||||
|
||||
var o = request.arguments().get(key);
|
||||
if (o == null) {
|
||||
throw new BeaconClientException("Missing argument for key " + key);
|
||||
|
||||
@@ -225,7 +225,7 @@ public class AppLayoutModel {
|
||||
null,
|
||||
() -> Hyperlinks.open(DocumentationLink.getRoot()),
|
||||
null)));
|
||||
if (AppDistributionType.get() != AppDistributionType.WEBTOP) {
|
||||
if (AppDistributionType.get() == AppDistributionType.WEBTOP) {
|
||||
l.add(
|
||||
new Entry(
|
||||
AppI18n.observable("visitGithubRepository"),
|
||||
|
||||
@@ -279,7 +279,7 @@ public abstract class AppOperationMode {
|
||||
// In case we perform any operations such as opening a terminal
|
||||
// give it some time to open while this process is still alive
|
||||
// Otherwise it might quit because the parent process is dead already
|
||||
ThreadHelper.sleep(100);
|
||||
ThreadHelper.sleep(500);
|
||||
AppOperationMode.halt(0);
|
||||
};
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import javafx.collections.ObservableList;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -50,6 +51,7 @@ public class WorkspaceManager {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ErrorEventFactory.fromThrowable(e).expected().handle();
|
||||
FileUtils.deleteQuietly(file.toFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class WebtopAppListDialog {
|
||||
private static List<WebtopApp> lastShown;
|
||||
|
||||
public static synchronized void show(List<WebtopApp> include) {
|
||||
if (include.equals(lastShown)) {
|
||||
if (!include.isEmpty() && include.equals(lastShown)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.webtop;
|
||||
|
||||
import io.xpipe.app.core.AppInstallation;
|
||||
import io.xpipe.app.core.AppSystemInfo;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
@@ -200,7 +201,8 @@ public class WebtopAppListManager {
|
||||
var command = "/apps/install.sh " + rem.stream()
|
||||
.map(webtopApp -> webtopApp.getId())
|
||||
.collect(Collectors.joining(" "));
|
||||
var restartCommand = requiresRestart ? "xpipe daemon stop --wait\nxpipe open" : null;
|
||||
TerminalLaunch.builder().title("Install packages").localScript(ShellScript.lines(command, restartCommand)).pauseOnExit(false).launch();
|
||||
var exec = AppInstallation.ofCurrent().getCliExecutablePath();
|
||||
var endCommand = requiresRestart ? exec + " daemon stop --wait\n" + exec + " open" : exec + " open";
|
||||
TerminalLaunch.builder().title("Install packages").localScript(ShellScript.lines(command, endCommand)).pauseOnExit(false).launch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import io.xpipe.app.update.AppDistributionType;
|
||||
import io.xpipe.app.util.GlobalTimer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
public class WebtopDisplayScale {
|
||||
@@ -52,6 +53,14 @@ public class WebtopDisplayScale {
|
||||
}
|
||||
|
||||
private static OptionalInt getDpi() throws Exception {
|
||||
if (AppOperationMode.isInStartup() || AppOperationMode.isInShutdown()) {
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
|
||||
if (!LocalShell.isInitialized()) {
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
|
||||
var out = LocalShell.getShell().command(CommandBuilder.of().add("xrdb", "-query"))
|
||||
.sensitive()
|
||||
.readStdoutIfPossible();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.webtop;
|
||||
|
||||
import io.xpipe.app.core.AppInstallation;
|
||||
import io.xpipe.app.core.AppSystemInfo;
|
||||
import io.xpipe.app.core.mode.AppOperationMode;
|
||||
import io.xpipe.app.prefs.ExternalApplicationHelper;
|
||||
@@ -8,6 +9,7 @@ import io.xpipe.app.util.LocalExec;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
public class WebtopMode {
|
||||
|
||||
@@ -24,14 +26,11 @@ public class WebtopMode {
|
||||
|
||||
public static void set(boolean mobile) {
|
||||
AppOperationMode.executeAfterShutdown(() -> {
|
||||
var file = AppSystemInfo.ofCurrent().getUserHome().resolve(".xpipe", "webtop", "mobile");
|
||||
var exec = AppInstallation.ofCurrent().getCliExecutablePath();
|
||||
if (!mobile) {
|
||||
Files.deleteIfExists(file);
|
||||
ExternalApplicationHelper.startAsync(CommandBuilder.of().add("bash", "-c").addQuoted("sleep 3 && /defaults/desktop.sh && plasmashell --replace && xpipe open"));
|
||||
ExternalApplicationHelper.startAsync(CommandBuilder.of().add("bash", "-c").addQuoted("/defaults/desktop.sh && /defaults/reload.sh && /defaults/waitx.sh && " + exec + " open"));
|
||||
} else {
|
||||
Files.createDirectories(file.getParent());
|
||||
Files.createFile(file);
|
||||
ExternalApplicationHelper.startAsync(CommandBuilder.of().add("bash", "-c").addQuoted("sleep 3 && /defaults/mobile.sh && plasmashell --replace && xpipe open"));
|
||||
ExternalApplicationHelper.startAsync(CommandBuilder.of().add("bash", "-c").addQuoted("/defaults/mobile.sh && /defaults/reload.sh && /defaults/waitx.sh && " + exec + " open"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -278,14 +278,22 @@
|
||||
}
|
||||
|
||||
.webtop-mode {
|
||||
-fx-font-size: 1.7em;
|
||||
-fx-font-size: 1.6em;
|
||||
-fx-padding: 1em;
|
||||
}
|
||||
|
||||
.webtop-mode .toggle-button {
|
||||
-fx-background-color: -color-bg-default;
|
||||
-fx-text-fill: -color-fg-default;
|
||||
-fx-border-color: -color-border-default;
|
||||
-fx-padding: 1em;
|
||||
-fx-border-radius: 4;
|
||||
}
|
||||
|
||||
.webtop-mode .toggle-button:selected {
|
||||
-fx-border-color: -color-accent-muted;
|
||||
}
|
||||
|
||||
.webtop-mode .ikonli-font-icon {
|
||||
-fx-icon-size: 50;
|
||||
-fx-icon-size: 35;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user