feat: add autohide after inactivity
After not receiving a message for X seconds (configurable) in the current tab or any tab with unread mode enabled, the chat will be hidden. Focus can be returned with return or slash as usual. Having input focus or hovering the mouse over the chat window "bumps" it every frame. Also fixes a bug that prevented focus from being restored to tabs with input disabled. The chat window will be brought back but the activated event won't be fully processed. Co-authored-by: Auri <me@aurieh.me>
This commit is contained in:
@@ -20,6 +20,8 @@ internal class Configuration : IPluginConfiguration
|
||||
public bool HideWhenUiHidden = true;
|
||||
public bool HideInLoadingScreens;
|
||||
public bool HideInBattle;
|
||||
public bool HideWhenInactive;
|
||||
public int InactivityHideTimeout = 10;
|
||||
public bool ShowHideButton = true;
|
||||
public bool NativeItemTooltips = true;
|
||||
public bool PrettierTimestamps = true;
|
||||
@@ -78,6 +80,8 @@ internal class Configuration : IPluginConfiguration
|
||||
HideWhenUiHidden = other.HideWhenUiHidden;
|
||||
HideInLoadingScreens = other.HideInLoadingScreens;
|
||||
HideInBattle = other.HideInBattle;
|
||||
HideWhenInactive = other.HideWhenInactive;
|
||||
InactivityHideTimeout = other.InactivityHideTimeout;
|
||||
ShowHideButton = other.ShowHideButton;
|
||||
NativeItemTooltips = other.NativeItemTooltips;
|
||||
PrettierTimestamps = other.PrettierTimestamps;
|
||||
@@ -168,6 +172,9 @@ internal class Tab
|
||||
[NonSerialized]
|
||||
public uint Unread;
|
||||
|
||||
[NonSerialized]
|
||||
public long LastMessageTime;
|
||||
|
||||
[NonSerialized]
|
||||
public MessageList Messages = new();
|
||||
|
||||
@@ -192,7 +199,10 @@ internal class Tab
|
||||
{
|
||||
Messages.AddPrune(message, MessageManager.MessageDisplayLimit);
|
||||
if (unread)
|
||||
{
|
||||
Unread += 1;
|
||||
LastMessageTime = Environment.TickCount64;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Clear()
|
||||
|
||||
Reference in New Issue
Block a user