Theme responsive notification icons (#23)
37
CommonHelpers/WindowsDarkMode.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using Microsoft.Win32;
|
||||
|
||||
namespace CommonHelpers
|
||||
{
|
||||
public class WindowsDarkMode
|
||||
{
|
||||
private static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer()
|
||||
{
|
||||
Interval = 1500
|
||||
};
|
||||
|
||||
public static bool IsDarkModeEnabled { get; private set; }
|
||||
|
||||
static WindowsDarkMode()
|
||||
{
|
||||
|
||||
IsDarkModeEnabled = FetchIsDarkModeEnabled();
|
||||
|
||||
timer.Tick += delegate{ IsDarkModeEnabled = FetchIsDarkModeEnabled(); };
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private static bool FetchIsDarkModeEnabled()
|
||||
{
|
||||
try
|
||||
{
|
||||
string RegistryKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
|
||||
int theme = (int?)Registry.GetValue(RegistryKey, "SystemUsesLightTheme", 1) ?? 1;
|
||||
return theme == 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
FanControl/FanControl-white.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -91,7 +91,7 @@ namespace PerformanceOverlay
|
|||
exitItem.Click += ExitItem_Click;
|
||||
|
||||
notifyIcon = new System.Windows.Forms.NotifyIcon(components);
|
||||
notifyIcon.Icon = Resources.poll;
|
||||
notifyIcon.Icon = WindowsDarkMode.IsDarkModeEnabled ? Resources.poll_light : Resources.poll;
|
||||
notifyIcon.Text = TitleWithVersion;
|
||||
notifyIcon.Visible = true;
|
||||
notifyIcon.ContextMenuStrip = contextMenu;
|
||||
|
|
@ -197,7 +197,7 @@ namespace PerformanceOverlay
|
|||
try
|
||||
{
|
||||
notifyIcon.Text = TitleWithVersion + ". RTSS Version: " + OSD.Version;
|
||||
notifyIcon.Icon = Resources.poll;
|
||||
notifyIcon.Icon = WindowsDarkMode.IsDarkModeEnabled ? Resources.poll_light : Resources.poll;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
10
PerformanceOverlay/Resources.Designer.cs
generated
|
|
@ -70,6 +70,16 @@ namespace PerformanceOverlay {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon poll_light {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("poll_light", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@
|
|||
<data name="poll" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\poll.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="poll_light" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\poll_light.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="poll_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\poll_red.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
|
|
|||
BIN
PerformanceOverlay/Resources/poll_light.ico
Normal file
|
After Width: | Height: | Size: 414 KiB |
|
|
@ -1,6 +1,7 @@
|
|||
using CommonHelpers;
|
||||
using ExternalHelpers;
|
||||
using Microsoft.VisualBasic.Logging;
|
||||
using Microsoft.Win32;
|
||||
using PowerControl.External;
|
||||
using PowerControl.Helpers;
|
||||
using RTSSSharedMemoryNET;
|
||||
|
|
@ -89,7 +90,7 @@ namespace PowerControl
|
|||
exitItem.Click += ExitItem_Click;
|
||||
|
||||
notifyIcon = new System.Windows.Forms.NotifyIcon(components);
|
||||
notifyIcon.Icon = Resources.traffic_light_outline;
|
||||
notifyIcon.Icon = WindowsDarkMode.IsDarkModeEnabled ? Resources.traffic_light_outline_light : Resources.traffic_light_outline;
|
||||
notifyIcon.Text = TitleWithVersion;
|
||||
notifyIcon.Visible = true;
|
||||
notifyIcon.ContextMenuStrip = contextMenu;
|
||||
|
|
@ -183,7 +184,7 @@ namespace PowerControl
|
|||
try
|
||||
{
|
||||
notifyIcon.Text = TitleWithVersion + ". RTSS Version: " + OSD.Version;
|
||||
notifyIcon.Icon = Resources.traffic_light_outline;
|
||||
notifyIcon.Icon = WindowsDarkMode.IsDarkModeEnabled ? Resources.traffic_light_outline_light : Resources.traffic_light_outline;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
10
PowerControl/Resources.Designer.cs
generated
|
|
@ -70,6 +70,16 @@ namespace PowerControl {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon traffic_light_outline_light {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("traffic-light-outline_light", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="traffic-light-outline_light" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\traffic-light-outline_light.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="traffic_light_outline" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\traffic-light-outline.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
|
|
|||
BIN
PowerControl/Resources/traffic-light-outline_light.ico
Normal file
|
After Width: | Height: | Size: 422 KiB |
|
|
@ -112,7 +112,7 @@ namespace SteamController
|
|||
exitItem.Click += delegate { Application.Exit(); };
|
||||
|
||||
notifyIcon = new NotifyIcon(components);
|
||||
notifyIcon.Icon = Resources.microsoft_xbox_controller_off;
|
||||
notifyIcon.Icon = WindowsDarkMode.IsDarkModeEnabled ? Resources.microsoft_xbox_controller_off_white : Resources.microsoft_xbox_controller_off;
|
||||
notifyIcon.Text = TitleWithVersion;
|
||||
notifyIcon.Visible = true;
|
||||
notifyIcon.ContextMenuStrip = contextMenu;
|
||||
|
|
@ -149,6 +149,14 @@ namespace SteamController
|
|||
context.Tick();
|
||||
|
||||
var isDesktop = context.CurrentProfile?.IsDesktop ?? false;
|
||||
var monitorOffIco = WindowsDarkMode.IsDarkModeEnabled ? Resources.monitor_off_white : Resources.monitor_off;
|
||||
var monitorOnIco = WindowsDarkMode.IsDarkModeEnabled ? Resources.monitor_white : Resources.monitor;
|
||||
var controllerOffIco = WindowsDarkMode.IsDarkModeEnabled ?
|
||||
Resources.microsoft_xbox_controller_off_white :
|
||||
Resources.microsoft_xbox_controller_off;
|
||||
var controllerOnIco = WindowsDarkMode.IsDarkModeEnabled ?
|
||||
Resources.microsoft_xbox_controller_white :
|
||||
Resources.microsoft_xbox_controller;
|
||||
|
||||
if (!context.KeyboardMouseValid)
|
||||
{
|
||||
|
|
@ -164,12 +172,12 @@ namespace SteamController
|
|||
{
|
||||
if (context.State.SteamUsesSteamInput)
|
||||
{
|
||||
notifyIcon.Icon = isDesktop ? Resources.monitor_off : Resources.microsoft_xbox_controller_off;
|
||||
notifyIcon.Icon = isDesktop ? monitorOffIco : controllerOffIco;
|
||||
notifyIcon.Text = TitleWithVersion + ". Steam uses Steam Input";
|
||||
}
|
||||
else
|
||||
{
|
||||
notifyIcon.Icon = isDesktop ? Resources.monitor : Resources.microsoft_xbox_controller;
|
||||
notifyIcon.Icon = isDesktop ? monitorOnIco : controllerOnIco;
|
||||
notifyIcon.Text = TitleWithVersion;
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +187,7 @@ namespace SteamController
|
|||
}
|
||||
else
|
||||
{
|
||||
notifyIcon.Icon = isDesktop ? Resources.monitor_off : Resources.microsoft_xbox_controller_off;
|
||||
notifyIcon.Icon = isDesktop ? monitorOffIco : controllerOffIco;
|
||||
notifyIcon.Text = TitleWithVersion + ". Disabled";
|
||||
}
|
||||
|
||||
|
|
|
|||
20
SteamController/Resources.Designer.cs
generated
|
|
@ -180,6 +180,26 @@ namespace SteamController {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon monitor_off_white {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("monitor_off_white", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon monitor_white {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("monitor_white", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -154,6 +154,12 @@
|
|||
<data name="monitor_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\monitor-off.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="monitor_off_white" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\monitor-off-white.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="monitor_white" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\monitor-white.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="steam" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\steam.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 422 KiB |
BIN
SteamController/Resources/monitor-off-white.ico
Normal file
|
After Width: | Height: | Size: 422 KiB |
BIN
SteamController/Resources/monitor-white.ico
Normal file
|
After Width: | Height: | Size: 422 KiB |