Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions RetroBar/Controls/Toolbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using ManagedShell.Common.Logging;
using ManagedShell.ShellFolders;
using ManagedShell.ShellFolders.Enums;
using RetroBar.Extensions;
using RetroBar.Utilities;

namespace RetroBar.Controls
Expand Down Expand Up @@ -84,6 +85,10 @@ private void Settings_PropertyChanged(object sender, System.ComponentModel.Prope
{
Refresh();
}
else if (e.PropertyName == nameof(Settings.QuickLaunchIconSettings))
{
Refresh();
}
}

private void Refresh()
Expand Down Expand Up @@ -116,9 +121,16 @@ private void SetItemsSource()
ToolbarItems.ItemsSource = Folder.Files;
ListCollectionView cvs = (ListCollectionView)CollectionViewSource.GetDefaultView(Folder.Files);
cvs.CustomSort = new ToolbarSorter(this);
cvs.Filter = ShouldShowIcon;
}
}

private bool ShouldShowIcon(object item)
{
ShellFile file = item as ShellFile;
return file.IsEnabledOnDisplay(Host.Screen.DeviceName);
}

public void SaveItemOrder()
{
List<string> itemPaths = new List<string>();
Expand Down
25 changes: 25 additions & 0 deletions RetroBar/Converters/BoolAndConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Windows.Data;

namespace RetroBar.Converters
{
public class BoolAndConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
foreach (object value in values)
{
if ((value is bool) && (bool)value == false)
{
return false;
}
}
return true;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
74 changes: 74 additions & 0 deletions RetroBar/Extensions/QuickLaunchIconExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using ManagedShell.ShellFolders;
using RetroBar.Utilities;
using System.Collections.Generic;

namespace RetroBar.Extensions
{
public static class QuickLaunchIconExtensions
{
public static bool IsEnabledOnDisplay(this ShellFile file, string deviceName)
{
var setting = Settings.Instance.QuickLaunchIconSettings.Find(s => s.Path == file.Path);

// No setting means show everywhere (default)
if (setting.Path == null)
{
return true;
}

return setting.DisabledOnDisplays == null || !setting.DisabledOnDisplays.Contains(deviceName);
}

public static void SetEnabledOnDisplay(this ShellFile file, string deviceName, bool enabled)
{
var settings = new List<QuickLaunchIconSetting>(Settings.Instance.QuickLaunchIconSettings);
var currentSettingIndex = settings.FindIndex(s => s.Path == file.Path);

if (currentSettingIndex >= 0)
{
var disabledDisplays = new List<string>(settings[currentSettingIndex].DisabledOnDisplays ?? new List<string>());

if (!enabled && !disabledDisplays.Contains(deviceName))
{
disabledDisplays.Add(deviceName);
}
else if (enabled)
{
disabledDisplays.Remove(deviceName);
}

if (disabledDisplays.Count == 0)
{
// Back to default (show everywhere) — remove the entry entirely
settings.RemoveAt(currentSettingIndex);
}
else
{
settings[currentSettingIndex] = new QuickLaunchIconSetting
{
Path = file.Path,
DisabledOnDisplays = disabledDisplays
};
}
}
else
{
if (!enabled)
{
settings.Add(new QuickLaunchIconSetting
{
Path = file.Path,
DisabledOnDisplays = new List<string> { deviceName }
});
}
else
{
// Enabling on a display when no setting exists — already shown everywhere, nothing to do
return;
}
}

Settings.Instance.QuickLaunchIconSettings = settings;
}
}
}
4 changes: 4 additions & 0 deletions RetroBar/Languages/English.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<s:String x:Key="show_clock">Show the cloc_k</s:String>
<s:String x:Key="show_multi_mon">Show on _multiple displays</s:String>
<s:String x:Key="show_start_button_multi_mon">Show _Start button on all taskbars</s:String>
<s:String x:Key="show_quick_launch_multi_mon">Show _Quick Launch on all taskbars</s:String>
<s:String x:Key="show_quick_launch">Show _Quick Launch</s:String>
<s:String x:Key="select_location">_Select location...</s:String>
<s:String x:Key="quick_launch_folder">Quick Launch - Choose a folder</s:String>
Expand Down Expand Up @@ -101,6 +102,9 @@
<s:String x:Key="behavior_heading">Behavior</s:String>
<s:String x:Key="invert_heading">Invert</s:String>

<s:String x:Key="customize_quick_launch">Customize Quick Launch</s:String>
<s:String x:Key="customize_quick_launch_instruction">Select which icons to show on each taskbar per display.</s:String>

<s:String x:Key="start_text">Start</s:String>
<s:String x:Key="start_text_xp">start</s:String>
<s:String x:Key="start_button_tip_98">Click here to begin.</s:String>
Expand Down
67 changes: 50 additions & 17 deletions RetroBar/PropertiesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<converters:DoubleToPercentConverter x:Key="doubleToPercentConverter" />
<converters:EnumConverter x:Key="enumConverter" />
<converters:EdgeOrientationVisibilityConverter x:Key="edgeOrientationVisibilityConverter" />
<converters:BoolAndConverter x:Key="boolAndConverter" />
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment"
Value="Center" />
Expand Down Expand Up @@ -343,23 +344,37 @@
Margin="10">
<StackPanel Orientation="Vertical"
Margin="0,0,0,10">
<CheckBox x:Name="cbAutoStart"
Checked="CbAutoStart_OnChecked"
Unchecked="CbAutoStart_OnChecked">
<Label Content="{DynamicResource autostart}" />
</CheckBox>
<CheckBox x:Name="cbUseSoftwareRendering"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=UseSoftwareRendering, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource use_software_rendering}" />
</CheckBox>
<CheckBox x:Name="cbDebugLogging"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=DebugLogging, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource debug_logging}" />
</CheckBox>
<CheckBox x:Name="cbCheckForUpdates"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=CheckForUpdates, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource check_for_updates}" />
</CheckBox>
<Grid IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="FirstCheckBox" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox x:Name="cbAutoStart"
Grid.Row="0" Grid.Column="0"
Checked="CbAutoStart_OnChecked"
Unchecked="CbAutoStart_OnChecked">
<Label Content="{DynamicResource autostart}" />
</CheckBox>
<CheckBox x:Name="cbUseSoftwareRendering"
Grid.Row="0" Grid.Column="1"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=UseSoftwareRendering, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource use_software_rendering}" />
</CheckBox>
<CheckBox x:Name="cbCheckForUpdates"
Grid.Row="1" Grid.Column="0"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=CheckForUpdates, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource check_for_updates}" />
</CheckBox>
<CheckBox x:Name="cbDebugLogging"
Grid.Row="1" Grid.Column="1"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=DebugLogging, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource debug_logging}" />
</CheckBox>
</Grid>
<CheckBox x:Name="cbAutoHideTransparent"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=AutoHideTransparent, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource auto_hide_transparent}" />
Expand Down Expand Up @@ -432,6 +447,24 @@
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowStartButtonMultiMon, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource show_start_button_multi_mon}" />
</CheckBox>
<DockPanel>
<CheckBox x:Name="cbShowQuickLaunchMultiMon"
IsEnabled="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowMultiMon, UpdateSourceTrigger=PropertyChanged}"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowQuickLaunchMultiMon, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource show_quick_launch_multi_mon}" />
</CheckBox>
<Button HorizontalAlignment="Right"
Content="{DynamicResource customize}"
Click="CustomizeQuickLaunch_OnClick"
>
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource boolAndConverter}">
<Binding Source="{x:Static Settings:Settings.Instance}" Path="ShowMultiMon" UpdateSourceTrigger="PropertyChanged"/>
<Binding Source="{x:Static Settings:Settings.Instance}" Path="ShowQuickLaunchMultiMon" UpdateSourceTrigger="PropertyChanged"/>
</MultiBinding>
</Button.IsEnabled>
</Button>
</DockPanel>
<DockPanel>
<Label VerticalAlignment="Center"
Target="{Binding ElementName=cboMultiMonMode}">
Expand Down
9 changes: 9 additions & 0 deletions RetroBar/PropertiesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using ManagedShell.Common.Logging;
using Microsoft.Win32;
using ManagedShell.AppBar;
using ManagedShell.ShellFolders;
using System.Windows.Forms;
using ManagedShell.WindowsTray;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -319,6 +320,14 @@ private void SetQuickLaunchLocation_OnClick(object sender, RoutedEventArgs e)
}
}

private void CustomizeQuickLaunch_OnClick(object sender, RoutedEventArgs e)
{
QuickLaunchPropertiesWindow.Open(
new ShellFolder(Environment.ExpandEnvironmentVariables(Settings.Instance.QuickLaunchPath), IntPtr.Zero, true),
AppBarScreen.FromAllScreens(),
new Point(Left, Top));
}

private void PropertiesWindow_OnClosing(object sender, CancelEventArgs e)
{
_instance = null;
Expand Down
74 changes: 74 additions & 0 deletions RetroBar/QuickLaunchPropertiesWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<Window x:Class="RetroBar.QuickLaunchPropertiesWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:RetroBar.Converters"
xmlns:Settings="clr-namespace:RetroBar.Utilities"
Title="{DynamicResource customize_quick_launch}"
Height="406"
Width="Auto"
MinWidth="300"
SizeToContent="Width"
ResizeMode="NoResize"
FlowDirection="{DynamicResource flow_direction}"
Style="{DynamicResource PropertiesWindow}"
Closing="Window_Closing">
<Window.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Button}">
<Setter Property="MinHeight"
Value="21" />
<Setter Property="MinWidth"
Value="73" />
<Setter Property="Padding"
Value="10,0" />
<Setter Property="VerticalAlignment"
Value="Center" />
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid Margin="9,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="{DynamicResource customize_quick_launch_instruction}"
TextWrapping="Wrap"
Margin="0,0,0,3" />
<ListView x:Name="QuickLaunchListView"
Grid.Row="1"
VerticalAlignment="Stretch">
<ListView.View>
<GridView x:Name="QuickLaunchGridView">
<GridViewColumn Header="{DynamicResource name_heading}"
Width="160">
<GridViewColumn.CellTemplate>
<DataTemplate>
<DockPanel>
<Image Source="{Binding SmallIcon}"
Width="16"
Height="16"
Margin="0,0,3,0"
VerticalAlignment="Center"
DockPanel.Dock="Left" />
<TextBlock Text="{Binding DisplayName}"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis"
DockPanel.Dock="Left" />
</DockPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right"
Grid.Row="2"
Margin="0,12,0,0">
<Button Content="{DynamicResource ok_dialog}"
Click="OK_OnClick" />
</StackPanel>
</Grid>
</Window>
Loading
Loading