mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Rework transparency style
This commit is contained in:
parent
2fb2ce35a0
commit
bbe3f09837
22 changed files with 105 additions and 30 deletions
|
@ -103,6 +103,12 @@ public class AppStyle {
|
||||||
STYLESHEET_CONTENTS.values().forEach(s -> {
|
STYLESHEET_CONTENTS.values().forEach(s -> {
|
||||||
scene.getStylesheets().add(s);
|
scene.getStylesheets().add(s);
|
||||||
});
|
});
|
||||||
|
if (AppPrefs.get() != null) {
|
||||||
|
var t = AppPrefs.get().theme.get();
|
||||||
|
if (t != null) {
|
||||||
|
scene.getStylesheets().addAll(t.getAdditionalStylesheets());
|
||||||
|
}
|
||||||
|
}
|
||||||
TrackEvent.debug("Added stylesheets for scene");
|
TrackEvent.debug("Added stylesheets for scene");
|
||||||
|
|
||||||
scenes.add(scene);
|
scenes.add(scene);
|
||||||
|
|
|
@ -59,6 +59,8 @@ public class AppTheme {
|
||||||
}
|
}
|
||||||
|
|
||||||
stage.getScene().getRoot().getStyleClass().add(t.getCssId());
|
stage.getScene().getRoot().getStyleClass().add(t.getCssId());
|
||||||
|
stage.getScene().getStylesheets().removeAll(t.getAdditionalStylesheets());
|
||||||
|
stage.getScene().getStylesheets().addAll(t.getAdditionalStylesheets());
|
||||||
stage.getScene().getRoot().pseudoClassStateChanged(LIGHT, !t.isDark());
|
stage.getScene().getRoot().pseudoClassStateChanged(LIGHT, !t.isDark());
|
||||||
stage.getScene().getRoot().pseudoClassStateChanged(DARK, t.isDark());
|
stage.getScene().getRoot().pseudoClassStateChanged(DARK, t.isDark());
|
||||||
});
|
});
|
||||||
|
@ -257,6 +259,15 @@ public class AppTheme {
|
||||||
Application.setUserAgentStylesheet(theme.getUserAgentStylesheetBSS());
|
Application.setUserAgentStylesheet(theme.getUserAgentStylesheetBSS());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getAdditionalStylesheets() {
|
||||||
|
var r = AppResources.getResourceURL(AppResources.XPIPE_MODULE, "theme/" + getId() + ".css");
|
||||||
|
if (r.isEmpty()) {
|
||||||
|
return List.of();
|
||||||
|
} else {
|
||||||
|
return List.of(r.get().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObservableValue<String> toTranslatedString() {
|
public ObservableValue<String> toTranslatedString() {
|
||||||
return new SimpleStringProperty(theme.getName());
|
return new SimpleStringProperty(theme.getName());
|
||||||
|
|
|
@ -94,13 +94,15 @@ public abstract class OperationMode {
|
||||||
|
|
||||||
// Handle uncaught exceptions
|
// Handle uncaught exceptions
|
||||||
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> {
|
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> {
|
||||||
|
// It seems like a few exceptions are thrown in the quantum renderer
|
||||||
|
// when in shutdown. We can ignore these
|
||||||
|
if (OperationMode.isInShutdown() && Platform.isFxApplicationThread() && ex instanceof NullPointerException) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ErrorEvent.fromThrowable(ex).unhandled(true).build().handle();
|
ErrorEvent.fromThrowable(ex).unhandled(true).build().handle();
|
||||||
});
|
});
|
||||||
|
|
||||||
// if (true) {
|
|
||||||
// throw new OutOfMemoryError();
|
|
||||||
// }
|
|
||||||
|
|
||||||
TrackEvent.info("Initial setup");
|
TrackEvent.info("Initial setup");
|
||||||
AppProperties.init();
|
AppProperties.init();
|
||||||
AppState.init();
|
AppState.init();
|
||||||
|
|
|
@ -6,15 +6,12 @@ import io.xpipe.app.issue.ErrorEvent;
|
||||||
import io.xpipe.app.issue.TrackEvent;
|
import io.xpipe.app.issue.TrackEvent;
|
||||||
import io.xpipe.app.prefs.AppPrefs;
|
import io.xpipe.app.prefs.AppPrefs;
|
||||||
import io.xpipe.core.process.OsType;
|
import io.xpipe.core.process.OsType;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
public enum PlatformState {
|
public enum PlatformState {
|
||||||
|
@ -26,8 +23,15 @@ public enum PlatformState {
|
||||||
@Setter
|
@Setter
|
||||||
private static PlatformState current = PlatformState.NOT_INITIALIZED;
|
private static PlatformState current = PlatformState.NOT_INITIALIZED;
|
||||||
|
|
||||||
@Getter
|
private static Throwable lastError;
|
||||||
private static Exception lastError;
|
private static boolean expectedError;
|
||||||
|
|
||||||
|
public static Throwable getLastError() {
|
||||||
|
if (expectedError) {
|
||||||
|
ErrorEvent.expected(lastError);
|
||||||
|
}
|
||||||
|
return lastError;
|
||||||
|
}
|
||||||
|
|
||||||
public static void teardown() {
|
public static void teardown() {
|
||||||
// This is bad and can get sometimes stuck
|
// This is bad and can get sometimes stuck
|
||||||
|
@ -48,26 +52,25 @@ public enum PlatformState {
|
||||||
public static void initPlatformOrThrow() throws Exception {
|
public static void initPlatformOrThrow() throws Exception {
|
||||||
initPlatformIfNeeded();
|
initPlatformIfNeeded();
|
||||||
if (lastError != null) {
|
if (lastError != null) {
|
||||||
throw lastError;
|
throw lastError instanceof Exception e ? e : new Exception(lastError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean initPlatformIfNeeded() {
|
public static boolean initPlatformIfNeeded() {
|
||||||
if (current == NOT_INITIALIZED) {
|
if (current == NOT_INITIALIZED) {
|
||||||
var t = PlatformState.initPlatform().orElse(null);
|
PlatformState.initPlatform();
|
||||||
lastError = t instanceof Exception e ? e : t != null ? new Exception(t) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return current == RUNNING;
|
return current == RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Optional<Throwable> initPlatform() {
|
private static void initPlatform() {
|
||||||
if (current == EXITED) {
|
if (current == EXITED) {
|
||||||
return Optional.of(new IllegalStateException("Platform has already exited"));
|
lastError = new IllegalStateException("Platform has already exited");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current == RUNNING) {
|
if (current == RUNNING) {
|
||||||
return Optional.empty();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -87,11 +90,14 @@ public enum PlatformState {
|
||||||
+ " You don't have to install XPipe on any system like a server, a WSL distribution, a hypervisor, etc.,"
|
+ " You don't have to install XPipe on any system like a server, a WSL distribution, a hypervisor, etc.,"
|
||||||
+ " to have full access to that system, a shell connection to it is enough for XPipe to work from your local machine.";
|
+ " to have full access to that system, a shell connection to it is enough for XPipe to work from your local machine.";
|
||||||
PlatformState.setCurrent(PlatformState.EXITED);
|
PlatformState.setCurrent(PlatformState.EXITED);
|
||||||
return Optional.of(ErrorEvent.expected(new UnsupportedOperationException(msg)));
|
expectedError = true;
|
||||||
|
lastError = new UnsupportedOperationException(msg);
|
||||||
|
return;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
TrackEvent.warn(t.getMessage());
|
TrackEvent.warn(t.getMessage());
|
||||||
PlatformState.setCurrent(PlatformState.EXITED);
|
PlatformState.setCurrent(PlatformState.EXITED);
|
||||||
return Optional.of(t);
|
lastError = t;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have no fonts and set properties to load bundled ones
|
// Check if we have no fonts and set properties to load bundled ones
|
||||||
|
@ -128,23 +134,26 @@ public enum PlatformState {
|
||||||
try {
|
try {
|
||||||
latch.await();
|
latch.await();
|
||||||
PlatformState.setCurrent(PlatformState.RUNNING);
|
PlatformState.setCurrent(PlatformState.RUNNING);
|
||||||
return Optional.empty();
|
return;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return Optional.of(e);
|
lastError = e;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// Check if we already exited
|
// Check if we already exited
|
||||||
if ("Platform.exit has been called".equals(t.getMessage())) {
|
if ("Platform.exit has been called".equals(t.getMessage())) {
|
||||||
PlatformState.setCurrent(PlatformState.EXITED);
|
PlatformState.setCurrent(PlatformState.EXITED);
|
||||||
return Optional.of(t);
|
lastError = t;
|
||||||
|
return;
|
||||||
} else if ("Toolkit already initialized".equals(t.getMessage())) {
|
} else if ("Toolkit already initialized".equals(t.getMessage())) {
|
||||||
PlatformState.setCurrent(PlatformState.RUNNING);
|
PlatformState.setCurrent(PlatformState.RUNNING);
|
||||||
return Optional.empty();
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Platform initialization has failed in this case
|
// Platform initialization has failed in this case
|
||||||
PlatformState.setCurrent(PlatformState.EXITED);
|
PlatformState.setCurrent(PlatformState.EXITED);
|
||||||
TrackEvent.error(t.getMessage());
|
TrackEvent.error(t.getMessage());
|
||||||
return Optional.of(t);
|
lastError =t;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.browser .welcome {
|
.browser .welcome {
|
||||||
-fx-background-color: -color-bg-inset, -color-border-default, -color-bg-default;
|
-fx-border-color: -color-bg-inset, -color-border-default;
|
||||||
-fx-background-insets: 0, 2.65em 0 0 0, 2.70em 0 0 0;
|
-fx-border-width: 2.65em 0 0 0, 0.05em 0 0 0;
|
||||||
|
-fx-border-insets: 0, 2.65em 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root:seamless-frame .browser .welcome {
|
.root:seamless-frame .browser .welcome {
|
||||||
|
|
|
@ -9,22 +9,40 @@
|
||||||
-fx-background-color: transparent;
|
-fx-background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root:dark .background {
|
.root:dark:separate-frame .background {
|
||||||
-fx-background-color: derive(-color-bg-default, 1%);
|
-fx-background-color: derive(-color-bg-default, 1%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.root:light .background {
|
.root:light:separate-frame .background {
|
||||||
-fx-background-color: derive(-color-bg-default, -9%);
|
-fx-background-color: derive(-color-bg-default, -9%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.root:dark.background {
|
.root:dark:separate-frame.background {
|
||||||
-fx-background-color: derive(-color-bg-default, 1%);
|
-fx-background-color: derive(-color-bg-default, 1%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.root:light.background {
|
.root:light:separate-frame.background {
|
||||||
-fx-background-color: derive(-color-bg-default, -9%);
|
-fx-background-color: derive(-color-bg-default, -9%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.root:dark:seamless-frame .background {
|
||||||
|
-fx-background-color: derive(-color-bg-default-transparent, 1%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.root:light:seamless-frame .background {
|
||||||
|
-fx-background-color: derive(-color-bg-default-transparent, -9%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.root:dark:seamless-frame.background {
|
||||||
|
-fx-background-color: derive(-color-bg-default-transparent, 1%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.root:light:seamless-frame.background {
|
||||||
|
-fx-background-color: derive(-color-bg-default-transparent, -9%);
|
||||||
|
}
|
||||||
|
|
||||||
.root:seamless-frame.layout > .background {
|
.root:seamless-frame.layout > .background {
|
||||||
-fx-background-insets: 5 0 0 0;
|
-fx-background-insets: 5 0 0 0;
|
||||||
-fx-border-insets: 5 0 0 0;
|
-fx-border-insets: 5 0 0 0;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
.root { -color-bg-default-transparent: #0d1117d2; }
|
|
@ -0,0 +1 @@
|
||||||
|
.root { -color-bg-default-transparent: #0d1117d2; }
|
|
@ -0,0 +1 @@
|
||||||
|
.root { -color-bg-default-transparent: #FFFFFF99; }
|
|
@ -0,0 +1 @@
|
||||||
|
.root { -color-bg-default-transparent: #0d1117d2; }
|
|
@ -357,3 +357,5 @@ vmActions=VM-handlinger
|
||||||
dockerContextActions=Kontekst-handlinger
|
dockerContextActions=Kontekst-handlinger
|
||||||
k8sPodActions=Pod-handlinger
|
k8sPodActions=Pod-handlinger
|
||||||
openVnc=Sæt VNC op
|
openVnc=Sæt VNC op
|
||||||
|
commandGroup.displayName=Kommandogruppe
|
||||||
|
commandGroup.displayDescription=Grupper tilgængelige kommandoer for et system
|
||||||
|
|
|
@ -335,3 +335,5 @@ vmActions=VM-Aktionen
|
||||||
dockerContextActions=Kontextbezogene Aktionen
|
dockerContextActions=Kontextbezogene Aktionen
|
||||||
k8sPodActions=Pod-Aktionen
|
k8sPodActions=Pod-Aktionen
|
||||||
openVnc=VNC einrichten
|
openVnc=VNC einrichten
|
||||||
|
commandGroup.displayName=Befehlsgruppe
|
||||||
|
commandGroup.displayDescription=Verfügbare Befehle für ein System gruppieren
|
||||||
|
|
|
@ -332,4 +332,6 @@ containerActions=Container actions
|
||||||
vmActions=VM actions
|
vmActions=VM actions
|
||||||
dockerContextActions=Context actions
|
dockerContextActions=Context actions
|
||||||
k8sPodActions=Pod actions
|
k8sPodActions=Pod actions
|
||||||
openVnc=Set up VNC
|
openVnc=Set up VNC
|
||||||
|
commandGroup.displayName=Command group
|
||||||
|
commandGroup.displayDescription=Group available commands for a system
|
|
@ -331,3 +331,5 @@ vmActions=Acciones VM
|
||||||
dockerContextActions=Acciones contextuales
|
dockerContextActions=Acciones contextuales
|
||||||
k8sPodActions=Acciones del pod
|
k8sPodActions=Acciones del pod
|
||||||
openVnc=Configurar VNC
|
openVnc=Configurar VNC
|
||||||
|
commandGroup.displayName=Grupo de comandos
|
||||||
|
commandGroup.displayDescription=Agrupa los comandos disponibles para un sistema
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=Actions VM
|
||||||
dockerContextActions=Actions contextuelles
|
dockerContextActions=Actions contextuelles
|
||||||
k8sPodActions=Actions de pods
|
k8sPodActions=Actions de pods
|
||||||
openVnc=Configurer VNC
|
openVnc=Configurer VNC
|
||||||
|
commandGroup.displayName=Groupe de commande
|
||||||
|
commandGroup.displayDescription=Groupe de commandes disponibles pour un système
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=Azioni della VM
|
||||||
dockerContextActions=Azioni contestuali
|
dockerContextActions=Azioni contestuali
|
||||||
k8sPodActions=Azioni del pod
|
k8sPodActions=Azioni del pod
|
||||||
openVnc=Configurare VNC
|
openVnc=Configurare VNC
|
||||||
|
commandGroup.displayName=Gruppo di comando
|
||||||
|
commandGroup.displayDescription=Gruppo di comandi disponibili per un sistema
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=VMアクション
|
||||||
dockerContextActions=コンテキストアクション
|
dockerContextActions=コンテキストアクション
|
||||||
k8sPodActions=ポッドアクション
|
k8sPodActions=ポッドアクション
|
||||||
openVnc=VNCを設定する
|
openVnc=VNCを設定する
|
||||||
|
commandGroup.displayName=コマンドグループ
|
||||||
|
commandGroup.displayDescription=システムで使用可能なコマンドをグループ化する
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=VM-acties
|
||||||
dockerContextActions=Context acties
|
dockerContextActions=Context acties
|
||||||
k8sPodActions=Pod acties
|
k8sPodActions=Pod acties
|
||||||
openVnc=VNC instellen
|
openVnc=VNC instellen
|
||||||
|
commandGroup.displayName=Opdrachtgroep
|
||||||
|
commandGroup.displayDescription=Groep beschikbare commando's voor een systeem
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=Acções VM
|
||||||
dockerContextActions=Acções de contexto
|
dockerContextActions=Acções de contexto
|
||||||
k8sPodActions=Acções de pod
|
k8sPodActions=Acções de pod
|
||||||
openVnc=Configura o VNC
|
openVnc=Configura o VNC
|
||||||
|
commandGroup.displayName=Grupo de comandos
|
||||||
|
commandGroup.displayDescription=Agrupa os comandos disponíveis para um sistema
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=Действия виртуальной машины
|
||||||
dockerContextActions=Контекстные действия
|
dockerContextActions=Контекстные действия
|
||||||
k8sPodActions=Действия в капсуле
|
k8sPodActions=Действия в капсуле
|
||||||
openVnc=Настройте VNC
|
openVnc=Настройте VNC
|
||||||
|
commandGroup.displayName=Группа команд
|
||||||
|
commandGroup.displayDescription=Группа доступных команд для системы
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=VM eylemleri
|
||||||
dockerContextActions=Bağlam eylemleri
|
dockerContextActions=Bağlam eylemleri
|
||||||
k8sPodActions=Pod eylemleri
|
k8sPodActions=Pod eylemleri
|
||||||
openVnc=VNC'yi ayarlama
|
openVnc=VNC'yi ayarlama
|
||||||
|
commandGroup.displayName=Komuta grubu
|
||||||
|
commandGroup.displayDescription=Bir sistem için mevcut komutları gruplama
|
||||||
|
|
|
@ -331,3 +331,5 @@ vmActions=虚拟机操作
|
||||||
dockerContextActions=上下文操作
|
dockerContextActions=上下文操作
|
||||||
k8sPodActions=Pod 操作
|
k8sPodActions=Pod 操作
|
||||||
openVnc=设置 VNC
|
openVnc=设置 VNC
|
||||||
|
commandGroup.displayName=命令组
|
||||||
|
commandGroup.displayDescription=系统可用命令组
|
||||||
|
|
Loading…
Reference in a new issue