mirror of
https://github.com/xpipe-io/xpipe.git
synced 2025-04-16 17:23:35 +00:00
Reformat
This commit is contained in:
parent
189c9e2b23
commit
1326bd9773
22 changed files with 71 additions and 73 deletions
|
@ -9,8 +9,6 @@ import io.xpipe.beacon.api.AskpassExchange;
|
|||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AskpassExchangeImpl extends AskpassExchange {
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +45,10 @@ public class AskpassExchangeImpl extends AskpassExchange {
|
|||
return;
|
||||
}
|
||||
|
||||
var term = TerminalView.get().getTerminalInstances().stream().filter(instance -> instance.getTerminalProcess().equals(found.get().getTerminal())).findFirst();
|
||||
var term = TerminalView.get().getTerminalInstances().stream()
|
||||
.filter(instance ->
|
||||
instance.getTerminalProcess().equals(found.get().getTerminal()))
|
||||
.findFirst();
|
||||
if (term.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -197,7 +197,8 @@ public class BrowserTransferModel {
|
|||
if (Files.isDirectory(path)) {
|
||||
return path;
|
||||
}
|
||||
} catch (InvalidPathException ignored) {}
|
||||
} catch (InvalidPathException ignored) {
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,9 @@ public class StoreEntryWrapper {
|
|||
busy.setValue(entry.getBusyCounter().get() != 0);
|
||||
deletable.setValue(entry.getConfiguration().isDeletable()
|
||||
|| AppPrefs.get().developerDisableGuiRestrictions().getValue());
|
||||
sessionActive.setValue(entry.getStore() instanceof SingletonSessionStore<?> ss && entry.getStore() instanceof ShellStore && ss.isSessionRunning());
|
||||
sessionActive.setValue(entry.getStore() instanceof SingletonSessionStore<?> ss
|
||||
&& entry.getStore() instanceof ShellStore
|
||||
&& ss.isSessionRunning());
|
||||
|
||||
category.setValue(StoreViewState.get()
|
||||
.getCategoryWrapper(DataStorage.get()
|
||||
|
|
|
@ -6,7 +6,6 @@ import io.xpipe.app.browser.BrowserFullSessionModel;
|
|||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.store.StoreLayoutComp;
|
||||
import io.xpipe.app.prefs.AppPrefsComp;
|
||||
import io.xpipe.app.terminal.TerminalView;
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import io.xpipe.app.util.LicenseProvider;
|
||||
|
@ -122,13 +121,12 @@ public class AppLayoutModel {
|
|||
() -> Hyperlinks.open(
|
||||
"http://localhost:" + AppBeaconServer.get().getPort()),
|
||||
null),
|
||||
new Entry(
|
||||
AppI18n.observable("webtop"),
|
||||
new LabelGraphic.IconGraphic("mdi2d-desktop-mac"),
|
||||
null,
|
||||
() -> Hyperlinks.open(Hyperlinks.GITHUB_WEBTOP),
|
||||
null)
|
||||
));
|
||||
new Entry(
|
||||
AppI18n.observable("webtop"),
|
||||
new LabelGraphic.IconGraphic("mdi2d-desktop-mac"),
|
||||
null,
|
||||
() -> Hyperlinks.open(Hyperlinks.GITHUB_WEBTOP),
|
||||
null)));
|
||||
|
||||
return l;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.xpipe.app.core.window;
|
||||
|
||||
import io.sentry.protocol.User;
|
||||
import io.xpipe.app.util.Rect;
|
||||
|
||||
import javafx.stage.Window;
|
||||
|
|
|
@ -70,7 +70,9 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore
|
|||
}
|
||||
|
||||
// Don't reuse local shell
|
||||
var parentSc = p.getParentStore() instanceof LocalStore l ? l.standaloneControl() : p.getParentStore().getOrStartSession();
|
||||
var parentSc = p.getParentStore() instanceof LocalStore l
|
||||
? l.standaloneControl()
|
||||
: p.getParentStore().getOrStartSession();
|
||||
return p.control(parentSc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import io.xpipe.app.ext.PrefsProvider;
|
|||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.terminal.ExternalTerminalType;
|
||||
import io.xpipe.app.terminal.TerminalView;
|
||||
import io.xpipe.app.update.XPipeDistributionType;
|
||||
import io.xpipe.app.util.PasswordLockSecretValue;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
|
|
|
@ -16,11 +16,12 @@ public class FileBrowserCategory extends AppPrefsCategory {
|
|||
return new OptionsBuilder()
|
||||
.addTitle("fileBrowser")
|
||||
.sub(new OptionsBuilder()
|
||||
.pref(prefs.enableTerminalDocking)
|
||||
.addToggle(prefs.enableTerminalDocking)
|
||||
.pref(prefs.confirmAllDeletions).addToggle(prefs.confirmAllDeletions)
|
||||
.pref(prefs.downloadsDirectory)
|
||||
.addString(prefs.downloadsDirectory))
|
||||
.pref(prefs.enableTerminalDocking)
|
||||
.addToggle(prefs.enableTerminalDocking)
|
||||
.pref(prefs.confirmAllDeletions)
|
||||
.addToggle(prefs.confirmAllDeletions)
|
||||
.pref(prefs.downloadsDirectory)
|
||||
.addString(prefs.downloadsDirectory))
|
||||
.buildComp();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,9 @@ import io.xpipe.app.ext.ProcessControlProvider;
|
|||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.terminal.ExternalTerminalType;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.terminal.TerminalView;
|
||||
import io.xpipe.app.util.*;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.ListCell;
|
||||
|
@ -74,14 +72,14 @@ public class TerminalCategory extends AppPrefsCategory {
|
|||
.addToggle(prefs.enableTerminalLogging)
|
||||
.nameAndDescription("terminalLoggingDirectory")
|
||||
.addComp(new ButtonComp(AppI18n.observable("openSessionLogs"), () -> {
|
||||
var dir = AppProperties.get().getDataDir().resolve("sessions");
|
||||
try {
|
||||
Files.createDirectories(dir);
|
||||
DesktopHelper.browsePathLocal(dir);
|
||||
} catch (IOException e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
}
|
||||
})
|
||||
var dir = AppProperties.get().getDataDir().resolve("sessions");
|
||||
try {
|
||||
Files.createDirectories(dir);
|
||||
DesktopHelper.browsePathLocal(dir);
|
||||
} catch (IOException e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
}
|
||||
})
|
||||
.disable(prefs.enableTerminalLogging.not())))
|
||||
.buildComp();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@ public class CmdTerminalType extends ExternalTerminalType.SimplePathType impleme
|
|||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
var powershell = ShellDialects.isPowershell(ProcessControlProvider.get().getEffectiveLocalDialect()) || AppPrefs.get().enableTerminalLogging().get();
|
||||
var powershell = ShellDialects.isPowershell(ProcessControlProvider.get().getEffectiveLocalDialect())
|
||||
|| AppPrefs.get().enableTerminalLogging().get();
|
||||
return powershell ? 0 : -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1058,7 +1058,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class MacOsType extends ExternalApplicationType.MacApplication implements ExternalTerminalType, TrackableTerminalType {
|
||||
abstract class MacOsType extends ExternalApplicationType.MacApplication
|
||||
implements ExternalTerminalType, TrackableTerminalType {
|
||||
|
||||
public MacOsType(String id, String applicationName) {
|
||||
super(id, applicationName);
|
||||
|
@ -1101,5 +1102,4 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
|||
|
||||
protected abstract CommandBuilder toCommand(LaunchConfiguration configuration) throws Exception;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ import io.xpipe.core.util.FailableFunction;
|
|||
|
||||
public class GnomeTerminalType extends ExternalTerminalType.PathCheckType implements TrackableTerminalType {
|
||||
|
||||
public GnomeTerminalType() {super("app.gnomeTerminal", "gnome-terminal", true);}
|
||||
public GnomeTerminalType() {
|
||||
super("app.gnomeTerminal", "gnome-terminal", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebsite() {
|
||||
|
@ -36,8 +38,11 @@ public class GnomeTerminalType extends ExternalTerminalType.PathCheckType implem
|
|||
try (ShellControl pc = LocalShell.getShell()) {
|
||||
CommandSupport.isInPathOrThrow(pc, executable, toTranslatedString().getValue(), null);
|
||||
|
||||
var toExecute = CommandBuilder.of().add(executable, "-v", "--title").addQuoted(configuration.getColoredTitle()).add("--").addFile(
|
||||
configuration.getScriptFile())
|
||||
var toExecute = CommandBuilder.of()
|
||||
.add(executable, "-v", "--title")
|
||||
.addQuoted(configuration.getColoredTitle())
|
||||
.add("--")
|
||||
.addFile(configuration.getScriptFile())
|
||||
// In order to fix this bug which also affects us:
|
||||
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
|
||||
.envrironment("GNOME_TERMINAL_SCREEN", sc -> "");
|
||||
|
@ -46,12 +51,13 @@ public class GnomeTerminalType extends ExternalTerminalType.PathCheckType implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public FailableFunction<LaunchConfiguration, String, Exception> remoteLaunchCommand(
|
||||
ShellDialect systemDialect
|
||||
) {
|
||||
public FailableFunction<LaunchConfiguration, String, Exception> remoteLaunchCommand(ShellDialect systemDialect) {
|
||||
return launchConfiguration -> {
|
||||
var toExecute = CommandBuilder.of().add(executable, "-v", "--title").addQuoted(launchConfiguration.getColoredTitle()).add("--").addFile(
|
||||
launchConfiguration.getScriptFile());
|
||||
var toExecute = CommandBuilder.of()
|
||||
.add(executable, "-v", "--title")
|
||||
.addQuoted(launchConfiguration.getColoredTitle())
|
||||
.add("--")
|
||||
.addFile(launchConfiguration.getScriptFile());
|
||||
return toExecute.buildSimple();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import io.xpipe.app.util.ShellTemp;
|
|||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
import io.xpipe.core.process.ShellDialect;
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
import io.xpipe.core.store.FilePath;
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
|
|
|
@ -16,7 +16,8 @@ public class PowerShellTerminalType extends ExternalTerminalType.SimplePathType
|
|||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
var powershell = ProcessControlProvider.get().getEffectiveLocalDialect() == POWERSHELL || AppPrefs.get().enableTerminalLogging().get();
|
||||
var powershell = ProcessControlProvider.get().getEffectiveLocalDialect() == POWERSHELL
|
||||
|| AppPrefs.get().enableTerminalLogging().get();
|
||||
return powershell ? -1 : 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
|
|
@ -79,11 +79,12 @@ public interface TabbyTerminalType extends ExternalTerminalType, TrackableTermin
|
|||
.discardOutput());
|
||||
} else {
|
||||
// This is probably not going to work as it does not launch a bat file
|
||||
LocalShell.getShell().executeSimpleCommand(CommandBuilder.of()
|
||||
.addFile(file.toString())
|
||||
.add("run")
|
||||
.add(configuration.getDialectLaunchCommand())
|
||||
.discardOutput());
|
||||
LocalShell.getShell()
|
||||
.executeSimpleCommand(CommandBuilder.of()
|
||||
.addFile(file.toString())
|
||||
.add("run")
|
||||
.add(configuration.getDialectLaunchCommand())
|
||||
.discardOutput());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.Rect;
|
||||
import io.xpipe.core.process.OsType;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
|
|
|
@ -23,9 +23,11 @@ public class TerminalLauncherManager {
|
|||
|
||||
@Override
|
||||
public void onSessionClosed(TerminalView.ShellSession session) {
|
||||
var affectedEntry = entries.values().stream().filter(terminalLaunchRequest -> {
|
||||
return terminalLaunchRequest.getRequest().equals(session.getRequest());
|
||||
}).findFirst();
|
||||
var affectedEntry = entries.values().stream()
|
||||
.filter(terminalLaunchRequest -> {
|
||||
return terminalLaunchRequest.getRequest().equals(session.getRequest());
|
||||
})
|
||||
.findFirst();
|
||||
if (affectedEntry.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -34,14 +36,10 @@ public class TerminalLauncherManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onTerminalOpened(TerminalView.TerminalSession instance) {
|
||||
|
||||
}
|
||||
public void onTerminalOpened(TerminalView.TerminalSession instance) {}
|
||||
|
||||
@Override
|
||||
public void onTerminalClosed(TerminalView.TerminalSession instance) {
|
||||
|
||||
}
|
||||
public void onTerminalClosed(TerminalView.TerminalSession instance) {}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import io.xpipe.app.issue.TrackEvent;
|
|||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.process.OsType;
|
||||
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Value;
|
||||
|
||||
|
@ -163,7 +163,9 @@ public class TerminalView {
|
|||
}
|
||||
|
||||
var finalProc = proc;
|
||||
var found = TerminalView.get().getSessions().stream().filter(session -> session.getShell().equals(finalProc.get())).findFirst();
|
||||
var found = TerminalView.get().getSessions().stream()
|
||||
.filter(session -> session.getShell().equals(finalProc.get()))
|
||||
.findFirst();
|
||||
if (found.isPresent()) {
|
||||
return found;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ public final class WindowsTerminalSession extends ControllableTerminalSession {
|
|||
return control.getBounds();
|
||||
}
|
||||
|
||||
|
||||
public void updateBoundsState() {
|
||||
if (!control.isIconified() || !control.isVisible()) {
|
||||
return;
|
||||
|
|
|
@ -58,7 +58,8 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm
|
|||
|
||||
@Override
|
||||
default int getProcessHierarchyOffset() {
|
||||
var powershell = AppPrefs.get().enableTerminalLogging().get() && !ShellDialects.isPowershell(ProcessControlProvider.get().getEffectiveLocalDialect());
|
||||
var powershell = AppPrefs.get().enableTerminalLogging().get()
|
||||
&& !ShellDialects.isPowershell(ProcessControlProvider.get().getEffectiveLocalDialect());
|
||||
return powershell ? 1 : 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ import io.xpipe.app.issue.ErrorEvent;
|
|||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.ListChangeListener;
|
||||
|
@ -15,9 +13,7 @@ import javafx.collections.ObservableList;
|
|||
import lombok.NonNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class PlatformThread {
|
||||
|
@ -81,7 +77,6 @@ public class PlatformThread {
|
|||
new HashMap<>();
|
||||
private final Map<InvalidationListener, InvalidationListener> invListenerMap = new HashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void addListener(ListChangeListener<? super T> listener) {
|
||||
ListChangeListener<? super T> l = (lc) -> {
|
||||
|
@ -245,7 +240,6 @@ public class PlatformThread {
|
|||
return ol.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void addListener(InvalidationListener listener) {
|
||||
InvalidationListener l = o -> {
|
||||
|
|
Loading…
Add table
Reference in a new issue