Compare commits

...

14 Commits

Author SHA1 Message Date
Mike Griese
f69c07cfe9 compact mode, but fewer templates 2026-04-19 21:44:42 -05:00
Niels Laute
e7a093391d Fix for icon only states in compact mode 2026-04-16 16:10:32 +02:00
Niels Laute
11ed0b36ee Merge branch 'main' into niels9001/compact-mode 2026-04-14 16:53:19 +02:00
Niels Laute
2185180be8 Update Resources.resw 2026-04-14 16:52:53 +02:00
Niels Laute
968cfce9c4 XAML styler 2026-04-14 16:48:58 +02:00
Niels Laute
5a426480a2 Update DockControl.xaml 2026-04-14 16:41:28 +02:00
Niels Laute
3d715b66ce Push 2026-04-14 10:52:37 +02:00
Niels Laute
b31f94d6a4 Merge branch 'main' into niels9001/compact-mode 2026-04-08 16:44:03 +02:00
Niels Laute
fbebac92e6 Merge branch 'main' into niels9001/compact-mode 2026-04-03 11:26:17 +02:00
Niels Laute
7b1bbe851e Merge branch 'main' into niels9001/compact-mode 2026-04-03 11:25:23 +02:00
copilot-swe-agent[bot]
6e5202e29c Fix spell check: change 'appbar' to 'app bar' in comment
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/64b81652-1ea1-44f6-8700-0b8bbda1706f

Co-authored-by: niels9001 <9866362+niels9001@users.noreply.github.com>
2026-04-02 18:22:18 +00:00
Niels Laute
391cd62a0d Merge branch 'main' into niels9001/compact-mode 2026-04-01 15:11:25 +02:00
Niels Laute
621846bfc8 Compact mode working 2026-03-30 20:25:23 +02:00
Niels Laute
3a9578af56 Compact mode 2026-03-30 10:58:40 +02:00
12 changed files with 227 additions and 80 deletions

View File

@@ -18,9 +18,7 @@ public record DockSettings
{
public DockSide Side { get; init; } = DockSide.Top;
public DockSize DockSize { get; init; } = DockSize.Small;
public DockSize DockIconsSize { get; init; } = DockSize.Small;
public DockSize DockSize { get; init; } = DockSize.Default;
public bool AlwaysOnTop { get; set; } = true;
@@ -139,9 +137,8 @@ public enum DockSide
public enum DockSize
{
Small,
Medium,
Large,
Default,
Compact,
}
public enum DockBackdrop

View File

@@ -17,12 +17,9 @@
<UserControl.Resources>
<ResourceDictionary>
<StackLayout
x:Key="ItemsOrientationLayout"
Orientation="{x:Bind ItemsOrientation, Mode=OneWay}"
Spacing="4" />
<StackLayout x:Key="ItemsOrientationLayout" Orientation="{x:Bind ItemsOrientation, Mode=OneWay}" />
<ItemsPanelTemplate x:Key="HorizontalItemsPanel">
<StackPanel Orientation="Horizontal" Spacing="4" />
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="VerticalItemsPanel">
<StackPanel Orientation="Vertical" Spacing="4" />
@@ -76,7 +73,7 @@
<Style x:Key="DockBandListViewItemStyle" TargetType="ListViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0,0,4,0" />
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -209,13 +206,13 @@
<Grid
x:Name="RootGrid"
Background="Transparent"
BorderBrush="{ThemeResource SurfaceStrokeColorDefaultBrush}"
BorderThickness="0,0,0,1"
RightTapped="RootGrid_RightTapped">
<!-- Dock content with Start / Center / End sections -->
<local:DockContentControl
x:Name="ContentGrid"
Margin="4"
Background="Transparent"
IsEditMode="{x:Bind IsEditMode, Mode=OneWay}"
RightTapped="RootGrid_RightTapped">
<local:DockContentControl.StartSource>
@@ -247,7 +244,6 @@
<FontIcon FontSize="12" Glyph="&#xE710;" />
</Button>
</local:DockContentControl.StartActionButton>
<local:DockContentControl.CenterSource>
<ListView
x:Name="CenterListView"
@@ -282,6 +278,8 @@
<ListView
x:Name="EndListView"
MinWidth="48"
MinHeight="0"
HorizontalContentAlignment="Stretch"
DragEnter="BandListView_DragEnter"
DragItemsCompleted="BandListView_DragItemsCompleted"
DragItemsStarting="BandListView_DragItemsStarting"
@@ -311,7 +309,6 @@
</Button>
</local:DockContentControl.EndActionButton>
</local:DockContentControl>
<TeachingTip
x:Name="EditButtonsTeachingTip"
MinWidth="0"
@@ -344,7 +341,7 @@
<ui:IsEqualStateTrigger Value="{x:Bind DockSide, Mode=OneWay}" To="Top" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ContentGrid.Margin" Value="4,0,4,4" />
<Setter Target="ContentGrid.Margin" Value="4,0,4,0" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="DockOnBottom">
@@ -391,6 +388,25 @@
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<!--
Compact overrides: zeroes margins/borders set by DockOrientation.
Declared after DockOrientation so its setters win when both groups
target the same property.
-->
<VisualStateGroup x:Name="DockSizeStates">
<VisualState x:Name="DefaultSize" />
<VisualState x:Name="CompactSize">
<VisualState.StateTriggers>
<ui:IsEqualStateTrigger Value="{x:Bind DockSize, Mode=OneWay}" To="Compact" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ContentGrid.Margin" Value="0" />
<Setter Target="ContentGrid.Padding" Value="0" />
<Setter Target="RootGrid.BorderThickness" Value="0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

View File

@@ -47,6 +47,15 @@ public sealed partial class DockControl : UserControl, IRecipient<CloseContextMe
set => SetValue(DockSideProperty, value);
}
public static readonly DependencyProperty DockSizeProperty =
DependencyProperty.Register(nameof(DockSize), typeof(DockSize), typeof(DockControl), new PropertyMetadata(DockSize.Default));
public DockSize DockSize
{
get => (DockSize)GetValue(DockSizeProperty);
set => SetValue(DockSizeProperty, value);
}
public static readonly DependencyProperty IsEditModeProperty =
DependencyProperty.Register(nameof(IsEditMode), typeof(bool), typeof(DockControl), new PropertyMetadata(false, OnIsEditModeChanged));
@@ -234,7 +243,10 @@ public sealed partial class DockControl : UserControl, IRecipient<CloseContextMe
{
DockSide = settings.Side;
// Compact mode is only supported for Top/Bottom positions
var isHorizontal = settings.Side == DockSide.Top || settings.Side == DockSide.Bottom;
var effectiveSize = isHorizontal ? settings.DockSize : DockSize.Default;
DockSize = effectiveSize;
ItemsOrientation = isHorizontal ? Orientation.Horizontal : Orientation.Vertical;
@@ -290,6 +302,11 @@ public sealed partial class DockControl : UserControl, IRecipient<CloseContextMe
ShowTitlesMenuItem.IsChecked = _editModeContextBand.ShowTitles;
ShowSubtitlesMenuItem.IsChecked = _editModeContextBand.ShowSubtitles;
// Hide subtitle toggle in compact mode — no subtitle in the template
ShowSubtitlesMenuItem.Visibility = DockSize == DockSize.Compact
? Visibility.Collapsed
: Visibility.Visible;
PreparePopupForShow(EditModeContextMenu, dockItem);
EditModeContextMenu.ShowAt(
dockItem,

View File

@@ -43,7 +43,7 @@
<CornerRadius x:Key="DockItemCornerRadius">4</CornerRadius>
<Thickness x:Key="DockItemPadding">4,0,4,0</Thickness>
<Thickness x:Key="DockItemMargin">2,0,2,0</Thickness>
<Style BasedOn="{StaticResource DefaultDockItemControlStyle}" TargetType="local:DockItemControl" />
<Style x:Key="DefaultDockItemControlStyle" TargetType="local:DockItemControl">
@@ -60,12 +60,13 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:DockItemControl">
<Grid x:Name="PART_HitTestGrid" Background="Transparent">
<Grid
x:Name="PART_RootGrid"
Padding="{StaticResource DockItemMargin}"
Background="Transparent">
<Grid
x:Name="PART_RootGrid"
x:Name="PART_BackPlate"
MinWidth="32"
MinHeight="30"
Margin="{TemplateBinding InnerMargin}"
Padding="{TemplateBinding Padding}"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
@@ -128,20 +129,20 @@
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="PART_RootGrid.Background" Value="{ThemeResource DockItemBackgroundPointerOver}" />
<Setter Target="PART_RootGrid.BorderBrush" Value="{ThemeResource DockItemBorderBrushPointerOver}" />
<Setter Target="PART_BackPlate.Background" Value="{ThemeResource DockItemBackgroundPointerOver}" />
<Setter Target="PART_BackPlate.BorderBrush" Value="{ThemeResource DockItemBorderBrushPointerOver}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="PART_RootGrid.Background" Value="{ThemeResource DockItemBackgroundPointerOver}" />
<Setter Target="PART_RootGrid.BorderBrush" Value="{ThemeResource DockItemBorderBrushPressed}" />
<Setter Target="PART_BackPlate.Background" Value="{ThemeResource DockItemBackgroundPointerOver}" />
<Setter Target="PART_BackPlate.BorderBrush" Value="{ThemeResource DockItemBorderBrushPressed}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="PART_RootGrid.Background" Value="{ThemeResource DockItemBackground}" />
<Setter Target="PART_RootGrid.BorderBrush" Value="{ThemeResource DockItemBackground}" />
<Setter Target="PART_BackPlate.Background" Value="{ThemeResource DockItemBackground}" />
<Setter Target="PART_BackPlate.BorderBrush" Value="{ThemeResource DockItemBackground}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ButtonForegroundDisabled}" />
<Setter Target="TitleText.Foreground" Value="{ThemeResource ButtonForegroundDisabled}" />
<Setter Target="SubtitleText.Foreground" Value="{ThemeResource ButtonForegroundDisabled}" />
@@ -192,6 +193,16 @@
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CompactStates">
<VisualState x:Name="DefaultLayout" />
<VisualState x:Name="Compact">
<VisualState.Setters>
<Setter Target="PART_RootGrid.Padding" Value="0" />
<Setter Target="SubtitleText.Visibility" Value="Collapsed" />
<Setter Target="TitleText.Margin" Value="0,-1,0,0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>

View File

@@ -84,12 +84,35 @@ public sealed partial class DockItemControl : Control
set => SetValue(TextVisibilityProperty, value);
}
public static readonly DependencyProperty IsCompactProperty =
DependencyProperty.Register(nameof(IsCompact), typeof(bool), typeof(DockItemControl), new PropertyMetadata(false, OnIsCompactPropertyChanged));
public bool IsCompact
{
get => (bool)GetValue(IsCompactProperty);
set => SetValue(IsCompactProperty, value);
}
private static void OnIsCompactPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is DockItemControl control)
{
control.UpdateCompactState();
}
}
private void UpdateCompactState()
{
VisualStateManager.GoToState(this, IsCompact ? "Compact" : "DefaultLayout", true);
}
private const string IconPresenterName = "IconPresenter";
private FrameworkElement? _iconPresenter;
private DockControl? _parentDock;
private ToolTip? _toolTip;
private long _dockSideCallbackToken = -1;
private long _dockSizeCallbackToken = -1;
private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@@ -122,6 +145,14 @@ public sealed partial class DockItemControl : Control
private void UpdateTextVisibilityState()
{
// When TextVisibility is Collapsed, always hide text and collapse the
// grid column/spacing so the icon-only layout doesn't waste space.
if (TextVisibility == Visibility.Collapsed)
{
VisualStateManager.GoToState(this, "TextHidden", true);
return;
}
// Determine which visual state to use based on title/subtitle presence
var stateName = (HasTitle, HasSubtitle) switch
{
@@ -184,6 +215,7 @@ public sealed partial class DockItemControl : Control
UpdateIconVisibility();
UpdateToolTip();
UpdateAlignment();
UpdateCompactState();
}
private void UpdateToolTip()
@@ -249,10 +281,14 @@ public sealed partial class DockItemControl : Control
{
_parentDock = dock;
UpdateInnerMarginForDockSide(dock.DockSide);
UpdateCompactFromParent(dock);
UpdateAllVisibility();
_dockSideCallbackToken = dock.RegisterPropertyChangedCallback(
DockControl.DockSideProperty,
OnParentDockSideChanged);
_dockSizeCallbackToken = dock.RegisterPropertyChangedCallback(
DockControl.DockSizeProperty,
OnParentDockSizeChanged);
}
UpdateToolTip();
@@ -266,12 +302,24 @@ public sealed partial class DockItemControl : Control
private void DockItemControl_Unloaded(object sender, RoutedEventArgs e)
{
if (_parentDock is not null && _dockSideCallbackToken >= 0)
if (_parentDock is not null)
{
_parentDock.UnregisterPropertyChangedCallback(
DockControl.DockSideProperty,
_dockSideCallbackToken);
_dockSideCallbackToken = -1;
if (_dockSideCallbackToken >= 0)
{
_parentDock.UnregisterPropertyChangedCallback(
DockControl.DockSideProperty,
_dockSideCallbackToken);
_dockSideCallbackToken = -1;
}
if (_dockSizeCallbackToken >= 0)
{
_parentDock.UnregisterPropertyChangedCallback(
DockControl.DockSizeProperty,
_dockSizeCallbackToken);
_dockSizeCallbackToken = -1;
}
_parentDock = null;
}
@@ -283,11 +331,24 @@ public sealed partial class DockItemControl : Control
{
if (sender is DockControl dock)
{
UpdateInnerMarginForDockSide(dock.DockSide);
// UpdateInnerMarginForDockSide(dock.DockSide);
UpdateAlignment();
}
}
private void OnParentDockSizeChanged(DependencyObject sender, DependencyProperty dp)
{
if (sender is DockControl dock)
{
UpdateCompactFromParent(dock);
}
}
private void UpdateCompactFromParent(DockControl dock)
{
IsCompact = dock.DockSize == DockSize.Compact;
}
private void UpdateInnerMarginForDockSide(DockSide side)
{
// Push the visual (PART_RootGrid) inward on the screen-edge side so
@@ -296,7 +357,7 @@ public sealed partial class DockItemControl : Control
// DockControl's ContentGrid on the screen-edge side.
InnerMargin = side switch
{
DockSide.Top => new Thickness(0, 4, 0, 0),
DockSide.Top => new Thickness(0, 0, 0, 0),
DockSide.Bottom => new Thickness(0, 0, 0, 4),
DockSide.Left => new Thickness(8, 0, 0, 0),
DockSide.Right => new Thickness(0, 0, 8, 0),

View File

@@ -13,9 +13,8 @@ internal static class DockSettingsToViews
{
return size switch
{
DockSize.Small => 128,
DockSize.Medium => 192,
DockSize.Large => 256,
DockSize.Default => 86,
DockSize.Compact => 86,
_ => throw new NotImplementedException(),
};
}
@@ -24,9 +23,8 @@ internal static class DockSettingsToViews
{
return size switch
{
DockSize.Small => 38,
DockSize.Medium => 54,
DockSize.Large => 76,
DockSize.Default => 38,
DockSize.Compact => 24,
_ => throw new NotImplementedException(),
};
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<winuiex:WindowEx
x:Class="Microsoft.CmdPal.UI.Dock.DockWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

View File

@@ -77,7 +77,7 @@ public sealed partial class DockWindow : WindowEx,
_settingsService = serviceProvider.GetRequiredService<ISettingsService>();
_settingsService.SettingsChanged += SettingsChangedHandler;
_settings = mainSettings.DockSettings;
_lastSize = _settings.DockSize;
_lastSize = EffectiveDockSize(_settings);
viewModel = serviceProvider.GetService<DockViewModel>()!;
_themeService = serviceProvider.GetRequiredService<IThemeService>();
@@ -174,7 +174,7 @@ public sealed partial class DockWindow : WindowEx,
if (_appBarData.hWnd != IntPtr.Zero)
{
var sameEdge = _appBarData.uEdge == side;
var sameSize = _lastSize == _settings.DockSize;
var sameSize = _lastSize == EffectiveDockSize(_settings);
if (sameEdge && sameSize)
{
UpdateTopmostState();
@@ -332,7 +332,7 @@ public sealed partial class DockWindow : WindowEx,
// Stash the last size we created the bar at, so we know when to hot-
// reload it
_lastSize = _settings.DockSize;
_lastSize = EffectiveDockSize(_settings);
UpdateWindowPosition();
}
@@ -384,15 +384,9 @@ public sealed partial class DockWindow : WindowEx,
var dpi = PInvoke.GetDpiForWindow(_hwnd);
var screenWidth = PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CXSCREEN);
// Get system border metrics
var borderWidth = PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CXBORDER);
var edgeWidth = PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CXEDGE);
var frameWidth = PInvoke.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CXFRAME);
var scaleFactor = dpi / 96.0;
UpdateAppBarDataForEdge(_settings.Side, _settings.DockSize, scaleFactor);
var effectiveSize = EffectiveDockSize(_settings);
UpdateAppBarDataForEdge(_settings.Side, effectiveSize, scaleFactor);
// Query and set position
PInvoke.SHAppBarMessage(PInvoke.ABM_QUERYPOS, ref _appBarData);
@@ -406,16 +400,16 @@ public sealed partial class DockWindow : WindowEx,
switch (_settings.Side)
{
case DockSide.Top:
_appBarData.rc.bottom = _appBarData.rc.top + (int)(DockSettingsToViews.HeightForSize(_settings.DockSize) * scaleFactor);
_appBarData.rc.bottom = _appBarData.rc.top + (int)(DockSettingsToViews.HeightForSize(effectiveSize) * scaleFactor);
break;
case DockSide.Bottom:
_appBarData.rc.top = _appBarData.rc.bottom - (int)(DockSettingsToViews.HeightForSize(_settings.DockSize) * scaleFactor);
_appBarData.rc.top = _appBarData.rc.bottom - (int)(DockSettingsToViews.HeightForSize(effectiveSize) * scaleFactor);
break;
case DockSide.Left:
_appBarData.rc.right = _appBarData.rc.left + (int)(DockSettingsToViews.WidthForSize(_settings.DockSize) * scaleFactor);
_appBarData.rc.right = _appBarData.rc.left + (int)(DockSettingsToViews.WidthForSize(effectiveSize) * scaleFactor);
break;
case DockSide.Right:
_appBarData.rc.left = _appBarData.rc.right - (int)(DockSettingsToViews.WidthForSize(_settings.DockSize) * scaleFactor);
_appBarData.rc.left = _appBarData.rc.right - (int)(DockSettingsToViews.WidthForSize(effectiveSize) * scaleFactor);
break;
}
@@ -428,23 +422,28 @@ public sealed partial class DockWindow : WindowEx,
// PInvoke.SHAppBarMessage(ABM_SETSTATE, ref _appBarData);
// PInvoke.SHAppBarMessage(PInvoke.ABM_SETAUTOHIDEBAR, ref _appBarData);
// Account for system borders when moving the window
// Adjust position to account for window frame/border
var adjustedLeft = _appBarData.rc.left - frameWidth;
var adjustedTop = _appBarData.rc.top - frameWidth;
var adjustedWidth = (_appBarData.rc.right - _appBarData.rc.left) + (2 * frameWidth);
var adjustedHeight = (_appBarData.rc.bottom - _appBarData.rc.top) + (2 * frameWidth);
// Move the actual window
// The dock window is borderless (SetBorderAndTitleBar(false, false),
// IsResizable = false) so no frame compensation is needed — the
// app bar rect matches the window rect exactly.
PInvoke.MoveWindow(
_hwnd,
adjustedLeft,
adjustedTop,
adjustedWidth,
adjustedHeight,
_appBarData.rc.left,
_appBarData.rc.top,
_appBarData.rc.right - _appBarData.rc.left,
_appBarData.rc.bottom - _appBarData.rc.top,
true);
}
/// <summary>
/// Compact mode is only supported for Top/Bottom dock positions.
/// For Left/Right, always use Default size.
/// </summary>
private static DockSize EffectiveDockSize(DockSettings settings)
{
var isHorizontal = settings.Side == DockSide.Top || settings.Side == DockSide.Bottom;
return isHorizontal ? settings.DockSize : DockSize.Default;
}
private void UpdateAppBarDataForEdge(DockSide side, DockSize size, double scaleFactor)
{
Logger.LogDebug("UpdateAppBarDataForEdge");
@@ -587,11 +586,21 @@ public sealed partial class DockWindow : WindowEx,
}
}
// Handle WM_GETMINMAXINFO to control window size limits
// Handle WM_GETMINMAXINFO to allow the dock to be smaller than
// the default minimum window size (SM_CYMINTRACK ~36px).
else if (msg == PInvoke.WM_GETMINMAXINFO)
{
// We can modify the min/max tracking info here if needed
// For now, let it pass through but we could restrict max size
// Call the original WndProc first so it fills default values,
// then override the minimum tracking size.
var result = PInvoke.CallWindowProc(_originalWndProc, hwnd, msg, wParam, lParam);
unsafe
{
var minMaxInfo = (MINMAXINFO*)lParam.Value;
minMaxInfo->ptMinTrackSize.X = 1;
minMaxInfo->ptMinTrackSize.Y = 1;
}
return result;
}
// Handle the AppBarMessage message

View File

@@ -94,6 +94,7 @@ WM_WINDOWPOSCHANGING
WM_SHOWWINDOW
WM_SIZE
WM_GETMINMAXINFO
MINMAXINFO
SetWinEventHook
WINDOW_STYLE
SC_MINIMIZE

View File

@@ -67,6 +67,20 @@
</ComboBox>
</controls:SettingsCard>
<!-- Dock Size (only for Top/Bottom positions) -->
<controls:SettingsCard
x:Name="DockSizeSettingsCard"
x:Uid="DockAppearance_DockSize_SettingsCard"
HeaderIcon="{ui:FontIcon Glyph=&#xE799;}">
<ComboBox
x:Name="DockSizeComboBox"
MinWidth="{StaticResource SettingActionControlMinWidth}"
SelectedIndex="{x:Bind SelectedDockSizeIndex, Mode=TwoWay}">
<ComboBoxItem x:Uid="DockAppearance_DockSize_Default" />
<ComboBoxItem x:Uid="DockAppearance_DockSize_Compact" />
</ComboBox>
</controls:SettingsCard>
<controls:SettingsCard x:Uid="DockAppearance_AppTheme_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=&#xE793;}">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.DockAppearance.ThemeIndex, Mode=TwoWay}">
<ComboBoxItem x:Uid="Settings_GeneralPage_AppTheme_Mode_System_Automation" Tag="Default">

View File

@@ -42,7 +42,9 @@ public sealed partial class DockSettingsPage : Page
{
// Initialize UI controls to match current settings
DockPositionComboBox.SelectedIndex = SelectedSideIndex;
DockSizeComboBox.SelectedIndex = SelectedDockSizeIndex;
BackdropComboBox.SelectedIndex = SelectedBackdropIndex;
UpdateDockSizeCardVisibility();
}
private async void PickBackgroundImage_Click(object sender, RoutedEventArgs e)
@@ -108,7 +110,11 @@ public sealed partial class DockSettingsPage : Page
public int SelectedSideIndex
{
get => SideToSelectedIndex(ViewModel.Dock_Side);
set => ViewModel.Dock_Side = SelectedIndexToSide(value);
set
{
ViewModel.Dock_Side = SelectedIndexToSide(value);
UpdateDockSizeCardVisibility();
}
}
public int SelectedBackdropIndex
@@ -126,18 +132,16 @@ public sealed partial class DockSettingsPage : Page
// Conversion methods for ComboBox bindings
private static int DockSizeToSelectedIndex(DockSize size) => size switch
{
DockSize.Small => 0,
DockSize.Medium => 1,
DockSize.Large => 2,
DockSize.Default => 0,
DockSize.Compact => 1,
_ => 0,
};
private static DockSize SelectedIndexToDockSize(int index) => index switch
{
0 => DockSize.Small,
1 => DockSize.Medium,
2 => DockSize.Large,
_ => DockSize.Small,
0 => DockSize.Default,
1 => DockSize.Compact,
_ => DockSize.Default,
};
private static int SideToSelectedIndex(DockSide side) => side switch
@@ -172,6 +176,13 @@ public sealed partial class DockSettingsPage : Page
_ => DockBackdrop.Acrylic,
};
private void UpdateDockSizeCardVisibility()
{
var side = ViewModel.Dock_Side;
var isTopOrBottom = side == DockSide.Top || side == DockSide.Bottom;
DockSizeSettingsCard.Visibility = isTopOrBottom ? Visibility.Visible : Visibility.Collapsed;
}
private List<TopLevelViewModel> GetAllBands()
{
var allBands = new List<TopLevelViewModel>();

View File

@@ -939,6 +939,18 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="DockAppearance_DockPosition_Bottom.Content" xml:space="preserve">
<value>Bottom</value>
</data>
<data name="DockAppearance_DockSize_SettingsCard.Header" xml:space="preserve">
<value>Size</value>
</data>
<data name="DockAppearance_DockSize_SettingsCard.Description" xml:space="preserve">
<value>Choose the dock size; subtitles of dock items are hidden in compact mode</value>
</data>
<data name="DockAppearance_DockSize_Default.Content" xml:space="preserve">
<value>Default</value>
</data>
<data name="DockAppearance_DockSize_Compact.Content" xml:space="preserve">
<value>Compact</value>
</data>
<data name="top_level_pin_command_name" xml:space="preserve">
<value>Pin to home</value>
<comment>Command name for pinning an item to the top level list of commands</comment>