From 7fbbd086e963562370646be5a956ba93b5dc3c03 Mon Sep 17 00:00:00 2001 From: Dime Date: Thu, 26 Feb 2026 14:29:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=87=E9=A2=98=E6=A0=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jackhuang/hmcl/setting/Config.java | 15 +++++++++++ .../org/jackhuang/hmcl/ui/main/MainPage.java | 25 ++++++++++++++++--- .../hmcl/ui/main/PersonalizationPage.java | 25 +++++++++++++++++++ HMCL/src/main/resources/assets/css/root.css | 8 ++++++ .../assets/lang/I18N_zh_CN.properties | 2 ++ 5 files changed, 72 insertions(+), 3 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java index 9d75154153..cdfec13673 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java @@ -460,6 +460,21 @@ public void setBackgroundImageOpacity(int backgroundImageOpacity) { this.backgroundImageOpacity.set(backgroundImageOpacity); } + @SerializedName("titleBarText") + private final StringProperty titleBarText = new SimpleStringProperty(""); + + public StringProperty titleBarTextProperty() { + return titleBarText; + } + + public String getTitleBarText() { + return titleBarText.get(); + } + + public void setTitleBarText(String titleBarText) { + this.titleBarText.set(titleBarText); + } + // Networks @SerializedName("autoDownloadThreads") diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java index e5f092c724..594cd221ac 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java @@ -93,6 +93,7 @@ public final class MainPage extends StackPane implements DecoratorPage { private final ObjectProperty latestVersion = new SimpleObjectProperty<>(this, "latestVersion"); private final ObservableList versions = FXCollections.observableArrayList(); private Profile profile; + private Label titleLabel; private TransitionPane announcementPane; private final StackPane updatePane; @@ -104,14 +105,23 @@ public final class MainPage extends StackPane implements DecoratorPage { titleNode.setAlignment(Pos.CENTER_LEFT); ImageView titleIcon = new ImageView(FXUtils.newBuiltinImage("/assets/img/icon-title.png")); - Label titleLabel = new Label(Metadata.FULL_TITLE); + Label versionLabel = new Label(Metadata.VERSION); if (I18n.isUpsideDown()) { titleIcon.setRotate(180); - titleLabel.setRotate(180); + versionLabel.setRotate(180); } + versionLabel.getStyleClass().add("jfx-main-version-label"); + + titleLabel = new Label(Metadata.FULL_NAME); titleLabel.getStyleClass().add("jfx-decorator-title"); titleLabel.textFillProperty().bind(Themes.titleFillProperty()); - titleNode.getChildren().setAll(titleIcon, titleLabel); + titleNode.getChildren().setAll(titleIcon, titleLabel, versionLabel); + + config().titleBarTextProperty().addListener((observable, oldValue, newValue) -> { + updateTitle(); + }); + + updateTitle(); state.setValue(new State(null, titleNode, false, false, true)); @@ -274,6 +284,15 @@ public void accept(String currentGame) { } + private void updateTitle() { + String titleText = config().getTitleBarText(); + if (titleText != null && !titleText.trim().isEmpty()) { + titleLabel.setText(titleText.trim()); + } else { + titleLabel.setText(Metadata.FULL_NAME); + } + } + private void showUpdate(boolean show) { doAnimation(show); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/PersonalizationPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/PersonalizationPage.java index 6f19448095..1846d3764e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/PersonalizationPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/PersonalizationPage.java @@ -110,6 +110,31 @@ public PersonalizationPage() { titleTransparentButton.selectedProperty().bindBidirectional(config().titleTransparentProperty()); titleTransparentButton.setTitle(i18n("settings.launcher.title_transparent")); } + { + BorderPane customizationPane = new BorderPane(); + + VBox leftContent = new VBox(); + Label titleLabel = new Label(i18n("settings.launcher.title_text")); + titleLabel.getStyleClass().add("title-label"); + Label subtitleLabel = new Label(i18n("settings.launcher.title_subtext")); + subtitleLabel.getStyleClass().add("subtitle-label"); + subtitleLabel.setStyle("-fx-font-size: 12px; -fx-text-fill: -monet-on-surface-variant;"); + leftContent.getChildren().addAll(titleLabel, subtitleLabel); + customizationPane.setLeft(leftContent); + + JFXTextField inputField = new JFXTextField(); + inputField.setPrefWidth(150); + inputField.setMaxWidth(150); + inputField.setMinWidth(150); + inputField.setText(config().getTitleBarText()); + inputField.textProperty().addListener((observable, oldValue, newValue) -> { + config().setTitleBarText(newValue); + }); + BorderPane.setAlignment(inputField, Pos.CENTER_RIGHT); + customizationPane.setRight(inputField); + + themeList.getContent().add(customizationPane); + } { LineToggleButton animationButton = new LineToggleButton(); themeList.getContent().add(animationButton); diff --git a/HMCL/src/main/resources/assets/css/root.css b/HMCL/src/main/resources/assets/css/root.css index 54708ea303..5d3f44a069 100644 --- a/HMCL/src/main/resources/assets/css/root.css +++ b/HMCL/src/main/resources/assets/css/root.css @@ -678,6 +678,14 @@ -fx-font-weight: BOLD; } +.jfx-tool-bar .jfx-main-version-label { + -fx-font-weight: BOLD; + -fx-background-color: white; + -fx-text-fill: -monet-primary-container; + -fx-background-radius: 4px; + -fx-padding: 2px 3px; +} + .jfx-tool-bar.background { -fx-background-color: -monet-primary-container; } diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index a5cd75d2c1..da4ef0c63d 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -1240,6 +1240,8 @@ settings.launcher.proxy.socks=SOCKS settings.launcher.proxy.username=账户 settings.launcher.theme=主题色 settings.launcher.title_transparent=标题栏透明 +settings.launcher.title_text=自定义标题栏 +settings.launcher.title_subtext=为空即为默认 settings.launcher.turn_off_animations=关闭动画 settings.launcher.version_list_source=版本列表源 settings.launcher.background.settings.opacity=不透明度 From 098ff711e257556788300c95e1240035691206d3 Mon Sep 17 00:00:00 2001 From: Dime Date: Thu, 26 Feb 2026 14:36:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat(i18n):=20=E6=B7=BB=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HMCL/src/main/resources/assets/lang/I18N.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 6d8f4f9894..4010b36016 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -1450,6 +1450,8 @@ settings.launcher.proxy.socks=SOCKS settings.launcher.proxy.username=Username settings.launcher.theme=Theme Color settings.launcher.title_transparent=Transparent Titlebar +settings.launcher.title_text=Custom Title Bar +settings.launcher.title_subtext=Leave empty to use the default settings.launcher.turn_off_animations=Disable Animation settings.launcher.version_list_source=Version List settings.launcher.background.settings.opacity=Opacity From 719b868c23c9901bad1b52e919d1670b1bc1ba6f Mon Sep 17 00:00:00 2001 From: Dime Date: Thu, 26 Feb 2026 14:45:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat(i18n):=20=E6=B7=BB=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HMCL/src/main/resources/assets/lang/I18N_zh.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index a15a7950b3..a7eb8a1692 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -1235,6 +1235,8 @@ settings.launcher.proxy.socks=SOCKS settings.launcher.proxy.username=帳戶 settings.launcher.theme=主題色 settings.launcher.title_transparent=標題欄透明 +settings.launcher.title_text=自訂標題欄文字 +settings.launcher.title_subtext=若留空則顯示預設標題 settings.launcher.turn_off_animations=關閉動畫 settings.launcher.version_list_source=版本清單來源 settings.launcher.background.settings.opacity=不透明度 From 9d853fa85d700a2fdb7abc09903e255dd6646c69 Mon Sep 17 00:00:00 2001 From: Dime <122196845+MinecraftYJQ@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:47:16 +0800 Subject: [PATCH 4/4] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 辞庐 <109708109+CiiLu@users.noreply.github.com> --- HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java index 594cd221ac..565be69a9e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java @@ -109,6 +109,7 @@ public final class MainPage extends StackPane implements DecoratorPage { if (I18n.isUpsideDown()) { titleIcon.setRotate(180); versionLabel.setRotate(180); + titleLabel.setRotate(180); } versionLabel.getStyleClass().add("jfx-main-version-label");