feat(ui): separate opacity for focused and unfocused chat window

This commit is contained in:
2026-05-22 15:03:56 +02:00
parent 921dd701c4
commit d05770fd6d
3 changed files with 32 additions and 1 deletions
+5
View File
@@ -44,6 +44,10 @@ public class Configuration : IPluginConfiguration
// Global window opacity, applied across all themes.
public float WindowOpacity = 0.85f;
// UI-12: background opacity of the main chat window while unfocused.
// WindowOpacity above stays the focused value.
public float WindowOpacityInactive = 0.65f;
// Reserved for future UI toggles; pre-declared to avoid a migration later.
public bool ReduceMotion;
@@ -360,6 +364,7 @@ public class Configuration : IPluginConfiguration
// v1.1.0 theme engine fields
Theme = other.Theme;
WindowOpacity = other.WindowOpacity;
WindowOpacityInactive = other.WindowOpacityInactive;
ReduceMotion = other.ReduceMotion;
UseCompactDensity = other.UseCompactDensity;
+9 -1
View File
@@ -709,7 +709,15 @@ public sealed class ChatLogWindow : Window
// Window-Deckkraft eingestellt hat, hat dieses Per-Window-Override
// Vorrang über unseren Slider — wir dokumentieren das im HelpMarker.
if (LastViewport == ImGuiHelpers.MainViewport.Handle && !WasDocked)
BgAlpha = Plugin.Config.WindowOpacity;
{
// UI-12: focus-dependent opacity. PreOpenCheck runs before Begin();
// Window.IsFocused holds last frame's RootAndChildWindows focus, set
// by Dalamud's WindowHost after Begin(). One-frame latency is
// accepted.
BgAlpha = IsFocused
? Plugin.Config.WindowOpacity
: Plugin.Config.WindowOpacityInactive;
}
LastViewport = ImGui.GetWindowViewport().Handle;
WasDocked = ImGui.IsWindowDocked();
@@ -296,6 +296,24 @@ internal sealed class ThemeAndLayout : ISettingsTab
}
ImGuiUtil.HelpMarker(HellionStrings.Settings_ThemeAndLayout_WindowOpacity_Description);
// UI-12: inactive-window opacity, same 50-100% range and clamp.
var inactiveOpacityPercent = Mutable.WindowOpacityInactive * 100f;
if (
ImGuiUtil.DragFloatVertical(
HellionStrings.Settings_ThemeAndLayout_WindowOpacityInactive_Name,
ref inactiveOpacityPercent,
.25f,
50f,
100f,
$"{inactiveOpacityPercent:N0}%%",
ImGuiSliderFlags.AlwaysClamp
)
)
{
Mutable.WindowOpacityInactive = inactiveOpacityPercent / 100f;
}
ImGuiUtil.HelpMarker(HellionStrings.Settings_ThemeAndLayout_WindowOpacityInactive_Description);
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();