PerformanceOverlay: add tray option for desktop overlay behavior

This commit is contained in:
nicklavoie 2026-02-21 22:04:23 -05:00
parent b44c5808c6
commit 2547e23147
2 changed files with 26 additions and 0 deletions

View file

@ -14,6 +14,7 @@ namespace PerformanceOverlay
RTSSSharedMemoryNET.OSD? osd;
System.Windows.Forms.ContextMenuStrip contextMenu;
ToolStripMenuItem showItem;
ToolStripMenuItem showOnDesktopItem;
System.Windows.Forms.NotifyIcon notifyIcon;
System.Windows.Forms.Timer osdTimer;
Sensors sensors = new Sensors();
@ -53,6 +54,16 @@ namespace PerformanceOverlay
showItem.Click += ShowItem_Click;
showItem.Checked = Settings.Default.ShowOSD;
contextMenu.Items.Add(showItem);
showOnDesktopItem = new ToolStripMenuItem("Always show on &desktop");
showOnDesktopItem.Click += delegate
{
Settings.Default.ShowOnDesktop = !Settings.Default.ShowOnDesktop;
updateContextItems(contextMenu);
};
showOnDesktopItem.Checked = Settings.Default.ShowOnDesktop;
contextMenu.Items.Add(showOnDesktopItem);
contextMenu.Items.Add(new ToolStripSeparator());
foreach (var mode in Enum.GetValues<OverlayMode>())
{
@ -158,6 +169,7 @@ namespace PerformanceOverlay
}
showItem.Checked = Settings.Default.ShowOSD;
showOnDesktopItem.Checked = Settings.Default.ShowOnDesktop;
}
private void NotifyIcon_Click(object? sender, EventArgs e)
@ -258,6 +270,13 @@ namespace PerformanceOverlay
return;
}
if (!Settings.Default.ShowOnDesktop && !OSDHelpers.IsOSDForeground())
{
osdTimer.Interval = 1000;
osdReset();
return;
}
osdTimer.Interval = 250;
sensors.Update();

View file

@ -35,6 +35,13 @@ namespace PerformanceOverlay
set { Set("ShowOSD", value); }
}
public bool ShowOnDesktop
{
get { return Get<bool>("ShowOnDesktop", false); }
set { Set("ShowOnDesktop", value); }
}
public bool EnableFullOnPowerControl
{
get { return Get<bool>("EnableFullOnPowerControl", false); }