From 9e6b4b9664f8f91cef9b1d569f0a2c2c555ed5cb Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Sat, 22 Jul 2023 16:13:32 -0500 Subject: [PATCH] Add settings to control icon invert --- README.md | 3 ++ RetroBar/App.config | 3 ++ RetroBar/Controls/NotifyIcon.xaml.cs | 7 +++-- RetroBar/Controls/NotifyIconList.xaml.cs | 14 +++++++++ RetroBar/Languages/English.xaml | 6 ++++ RetroBar/Properties/Settings.Designer.cs | 12 ++++++++ RetroBar/Properties/Settings.settings | 3 ++ RetroBar/PropertiesWindow.xaml | 10 +++++++ RetroBar/PropertiesWindow.xaml.cs | 8 ++++++ RetroBar/Utilities/Settings.cs | 36 ++++++++++++++++++++++++ 10 files changed, 99 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a4ca7b89..a76c65e2 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ RetroBar is based on the [ManagedShell](https://github.com/cairoshell/ManagedShe - Quick launch toolbar - Start button opens modern start menu - Ability to show or hide the clock +- Ability to auto-hide the taskbar +- Locked and unlocked taskbar appearances - Display taskbar on any side of the screen (even on Windows 11) - Option to display the taskbar, notification area, and clock on multiple monitors - Ability to show Vista-style window thumbnails @@ -74,6 +76,7 @@ RetroBar is based on the [ManagedShell](https://github.com/cairoshell/ManagedShe - Russian (русский) - Serbian (Cyrillic) (српски) - Serbian (Latin) (srpski) +- Slovak (slovenčina) - Spanish (español) - Swedish (svenska) - Turkish (Türkçe) diff --git a/RetroBar/App.config b/RetroBar/App.config index 3b11d2e2..2c42d133 100644 --- a/RetroBar/App.config +++ b/RetroBar/App.config @@ -73,6 +73,9 @@ False + + 0 + \ No newline at end of file diff --git a/RetroBar/Controls/NotifyIcon.xaml.cs b/RetroBar/Controls/NotifyIcon.xaml.cs index b9503947..874b7001 100644 --- a/RetroBar/Controls/NotifyIcon.xaml.cs +++ b/RetroBar/Controls/NotifyIcon.xaml.cs @@ -33,7 +33,7 @@ public NotifyIcon() private void applyEffects() { - if (!EnvironmentHelper.IsWindows10OrBetter || TrayIcon == null) + if ((!EnvironmentHelper.IsWindows10OrBetter && Settings.Instance.InvertIconsMode == 0) || TrayIcon == null || Settings.Instance.InvertIconsMode == 2) { return; } @@ -53,13 +53,14 @@ private void applyEffects() } bool invertByTheme = Application.Current.FindResource("InvertSystemNotifyIcons") as bool? ?? false; + bool performInvert = invertByTheme || Settings.Instance.InvertIconsMode == 1; - if (NotifyIconImage.Effect == null != invertByTheme) + if (NotifyIconImage.Effect == null != performInvert) { return; } - if (invertByTheme) + if (performInvert) { NotifyIconImage.Effect = new InvertEffect(); } diff --git a/RetroBar/Controls/NotifyIconList.xaml.cs b/RetroBar/Controls/NotifyIconList.xaml.cs index 6295e467..92d8f431 100644 --- a/RetroBar/Controls/NotifyIconList.xaml.cs +++ b/RetroBar/Controls/NotifyIconList.xaml.cs @@ -51,6 +51,20 @@ private void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e) NotifyIcons.ItemsSource = allNotifyIconsSource.View; } } + else if (e.PropertyName == "InvertIconsMode") + { + // Reload icons + NotifyIcons.ItemsSource = null; + + if (Settings.Instance.CollapseNotifyIcons) + { + NotifyIcons.ItemsSource = pinnedNotifyIconsSource.View; + } + else + { + NotifyIcons.ItemsSource = allNotifyIconsSource.View; + } + } } private void NotifyIconList_OnLoaded(object sender, RoutedEventArgs e) diff --git a/RetroBar/Languages/English.xaml b/RetroBar/Languages/English.xaml index 0eed2c3b..ccfb1e45 100644 --- a/RetroBar/Languages/English.xaml +++ b/RetroBar/Languages/English.xaml @@ -41,6 +41,12 @@ Same taskbar as window Same taskbar as window and primary taskbar + _Invert system icons: + + When needed by theme + Always + Never + Version {0} Visit RetroBar on GitHub Taskbar scale diff --git a/RetroBar/Properties/Settings.Designer.cs b/RetroBar/Properties/Settings.Designer.cs index 15834b14..7efd6821 100644 --- a/RetroBar/Properties/Settings.Designer.cs +++ b/RetroBar/Properties/Settings.Designer.cs @@ -287,5 +287,17 @@ public bool LockTaskbar { this["LockTaskbar"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int InvertIconsMode { + get { + return ((int)(this["InvertIconsMode"])); + } + set { + this["InvertIconsMode"] = value; + } + } } } diff --git a/RetroBar/Properties/Settings.settings b/RetroBar/Properties/Settings.settings index f2ab2379..3be62365 100644 --- a/RetroBar/Properties/Settings.settings +++ b/RetroBar/Properties/Settings.settings @@ -68,5 +68,8 @@ False + + 0 + \ No newline at end of file diff --git a/RetroBar/PropertiesWindow.xaml b/RetroBar/PropertiesWindow.xaml index e6b074f3..c879df57 100644 --- a/RetroBar/PropertiesWindow.xaml +++ b/RetroBar/PropertiesWindow.xaml @@ -312,6 +312,16 @@ IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=DebugLogging, UpdateSourceTrigger=PropertyChanged}">