Skip to content

Commit 3893c4d

Browse files
committed
Fixed Keybind widgets not having a proper title and tooltip
1 parent 1fb53a7 commit 3893c4d

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/main/java/me/pindour/catpuccin/gui/themes/catpuccin/CatpuccinGuiTheme.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,11 @@ public WCatpuccinKeybind catpuccinKeybind(Keybind keybind) {
388388
}
389389

390390
public WCatpuccinKeybind catpuccinKeybind(Keybind keybind, Keybind defaultValue) {
391-
return w(new WCatpuccinKeybind(keybind, defaultValue));
391+
return catpuccinKeybind(null, keybind, defaultValue);
392+
}
393+
394+
public WCatpuccinKeybind catpuccinKeybind(String title, Keybind keybind, Keybind defaultValue) {
395+
return w(new WCatpuccinKeybind(title, keybind, defaultValue));
392396
}
393397

394398
public WOpenIndicator openIndicator(boolean open) {
@@ -404,7 +408,7 @@ public WColorPicker colorPicker(Color color, GuiTexture overlayTexture) {
404408
}
405409

406410
public <T> WCatpuccinMultiSelect<T> multiSelect(String title, List<WMultiSelect.ItemInfo<T>> items) {
407-
return w(new WCatpuccinMultiSelect<>(title, items, null));
411+
return multiSelect(title, items, null);
408412
}
409413

410414
public <T> WCatpuccinMultiSelect<T> multiSelect(String title, List<WMultiSelect.ItemInfo<T>> items, WTextBox searchBox) {

src/main/java/me/pindour/catpuccin/gui/themes/catpuccin/CatpuccinSettingsWidgetFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ private void colorW(WTable table, ColorSetting setting) {
277277
private void keybindW(WTable table, KeybindSetting setting) {
278278
WHorizontalList list = table.add(theme.horizontalList()).expandX().widget();
279279

280-
WCatpuccinKeybind keybind = list.add(theme.catpuccinKeybind(setting.get(), setting.getDefaultValue())).expandX().widget();
280+
WCatpuccinKeybind keybind = list.add(theme.catpuccinKeybind(setting.title, setting.get(), setting.getDefaultValue())).expandX().widget();
281+
keybind.tooltip = setting.description;
281282
keybind.action = setting::onChanged;
282283
setting.widget = keybind;
283284
}

src/main/java/me/pindour/catpuccin/gui/themes/catpuccin/widgets/settings/WCatpuccinKeybind.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ public class WCatpuccinKeybind extends WKeybind implements CatpuccinWidget {
1313

1414
private WCatpuccinButton button;
1515

16+
private final String title;
1617
private final Keybind keybind;
1718
private final Keybind defaultValue;
1819

1920
private final String listeningText = "Press any key";
2021
private boolean listening;
2122

22-
public WCatpuccinKeybind(Keybind keybind, Keybind defaultValue) {
23+
public WCatpuccinKeybind(String title, Keybind keybind, Keybind defaultValue) {
2324
super(keybind, defaultValue);
25+
this.title = title != null && !title.isEmpty() ? title : "Bind";
2426
this.keybind = keybind;
2527
this.defaultValue = defaultValue;
2628
}
@@ -84,6 +86,6 @@ public void reset() {
8486
}
8587

8688
private void refreshLabel() {
87-
button.set(RichText.bold("Bind: ").append(keybind.toString()));
89+
button.set(RichText.bold(title + ": ").append(keybind.toString()));
8890
}
8991
}

0 commit comments

Comments
 (0)