From 5eae4071680020a45302432cc7f7278ab8c20064 Mon Sep 17 00:00:00 2001 From: aljus7 Date: Fri, 27 Feb 2026 18:56:53 +0100 Subject: [PATCH 1/5] Add option for grouping taskbar buttons by program name or executable --- RetroBar/App.xaml.cs | 32 ++++++++++++------- RetroBar/Controls/TaskList.xaml.cs | 9 ++++++ RetroBar/PropertiesWindow.xaml | 3 ++ .../Utilities/ProgramNameTaskbarSorter.cs | 25 +++++++++++++++ RetroBar/Utilities/Settings.cs | 7 ++++ 5 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 RetroBar/Utilities/ProgramNameTaskbarSorter.cs diff --git a/RetroBar/App.xaml.cs b/RetroBar/App.xaml.cs index 76290d29..84f69c26 100644 --- a/RetroBar/App.xaml.cs +++ b/RetroBar/App.xaml.cs @@ -1,17 +1,20 @@ -using System; -using ManagedShell; -using RetroBar.Utilities; -using System.Windows; +using ManagedShell; +using ManagedShell.Common.Enums; using ManagedShell.Common.Helpers; +using ManagedShell.Common.Logging; using ManagedShell.Interop; -using Application = System.Windows.Application; -using System.Windows.Interop; -using System.Windows.Media; -using ManagedShell.Common.Enums; +using ManagedShell.WindowsTasks; +using RetroBar.Utilities; +using System; +using System.Collections; using System.Diagnostics; -using System.Reflection; -using ManagedShell.Common.Logging; using System.Linq; +using System.Reflection; +using System.Windows; +using System.Windows.Data; // Fix for CS0246 +using System.Windows.Interop; +using System.Windows.Media; +using Application = System.Windows.Application; namespace RetroBar { @@ -58,7 +61,7 @@ private void App_OnStartup(object sender, StartupEventArgs e) } _dictionaryManager.SetLanguageFromSettings(); - loadTheme(); + LoadTheme(); // Fixed naming _windowManager = new WindowManager(_dictionaryManager, _explorerMonitor, _shellManager, _startMenuMonitor, _updater, _hotkeyManager); } @@ -89,9 +92,14 @@ private void Settings_PropertyChanged(object sender, System.ComponentModel.Prope { setTaskIconSize(); } + else if (e.PropertyName == nameof(Settings.SortTaskbarByProgramName)) + { + RestartApp(); + } } - private void loadTheme() + // Fix IDE1006: Rename loadTheme to LoadTheme + private void LoadTheme() { _dictionaryManager.SetThemeFromSettings(); setTaskIconSize(); diff --git a/RetroBar/Controls/TaskList.xaml.cs b/RetroBar/Controls/TaskList.xaml.cs index a05ed38d..76203bd1 100644 --- a/RetroBar/Controls/TaskList.xaml.cs +++ b/RetroBar/Controls/TaskList.xaml.cs @@ -6,6 +6,8 @@ using System.ComponentModel; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; +using System.Collections; namespace RetroBar.Controls { @@ -85,6 +87,13 @@ private void SetTasksCollection() { taskbarItems.CollectionChanged += GroupedWindows_CollectionChanged; taskbarItems.Filter = Tasks_Filter; + + if (taskbarItems is ListCollectionView lcv) + { + lcv.CustomSort = (IComparer)(Settings.Instance.SortTaskbarByProgramName + ? new ProgramNameTaskbarSorter() + : null); + } } TasksList.ItemsSource = taskbarItems; diff --git a/RetroBar/PropertiesWindow.xaml b/RetroBar/PropertiesWindow.xaml index 27c78bfe..b4bcab6a 100644 --- a/RetroBar/PropertiesWindow.xaml +++ b/RetroBar/PropertiesWindow.xaml @@ -376,6 +376,9 @@ IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowEndTaskButton, UpdateSourceTrigger=PropertyChanged}">