feat(settings): restore the tab-cycle keybind binder UI

This commit is contained in:
2026-06-16 01:21:05 +02:00
parent 3878869904
commit 6578c10b13
@@ -1,4 +1,5 @@
using Dalamud.Bindings.ImGui;
using HellionChat.Util;
namespace HellionChat.Ui.Components.Settings.Tabs;
@@ -27,6 +28,23 @@ internal sealed class GeneralTab
);
}
if (ImGui.CollapsingHeader("Keybinds", ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.TextDisabled("Click a button, then press the key combination. Esc clears.");
DrawKeybind(
"Cycle to next chat tab",
"ChatTabForwardKeybind",
() => Plugin.Config.ChatTabForward,
v => Plugin.Config.ChatTabForward = v
);
DrawKeybind(
"Cycle to previous chat tab",
"ChatTabBackwardKeybind",
() => Plugin.Config.ChatTabBackward,
v => Plugin.Config.ChatTabBackward = v
);
}
if (ImGui.CollapsingHeader("Notifications", ImGuiTreeNodeFlags.DefaultOpen))
{
DrawToggle(
@@ -68,4 +86,27 @@ internal sealed class GeneralTab
_plugin.SaveConfig();
}
}
// Wires the already-present ImGuiUtil.KeybindInput capture widget (dead/unwired
// since the v1.6.0 rewrite) back into the settings, so ChatTabForward/Backward
// are bindable again. ConfigKeyBind is a reference type, so a capture (new
// instance) or an Esc-clear (null) changes the reference — persist only then.
private void DrawKeybind(
string label,
string id,
Func<ConfigKeyBind?> get,
Action<ConfigKeyBind?> set
)
{
ImGui.TextUnformatted(label);
ImGui.SetNextItemWidth(-1);
var keybind = get();
var before = keybind;
ImGuiUtil.KeybindInput(id, ref keybind);
if (!ReferenceEquals(before, keybind))
{
set(keybind);
_plugin.SaveConfig();
}
}
}