Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings V2: new FancyZones XAML and general UX improvements #1779

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/core/Microsoft.PowerToys.Settings.UI/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ResourceDictionary Source="/Styles/_Colors.xaml" />
<ResourceDictionary Source="/Styles/_FontSizes.xaml" />
<ResourceDictionary Source="/Styles/_Thickness.xaml" />

<ResourceDictionary Source="/Styles/_Sizes.xaml" />
<ResourceDictionary Source="/Styles/TextBlock.xaml" />
<ResourceDictionary Source="/Styles/Page.xaml"/>
</ResourceDictionary.MergedDictionaries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<Compile Include="Services\ActivationService.cs" />
<Compile Include="Services\NavigationService.cs" />
<Compile Include="ViewModels\GeneralViewModel.cs" />
<Compile Include="ViewModels\FancyZonesViewModel.cs" />
<Compile Include="ViewModels\PowerRenameViewModel.cs" />
<Compile Include="ViewModels\PowerLauncherViewModel.cs" />
<Compile Include="ViewModels\ShellViewModel.cs" />
Expand All @@ -74,6 +75,9 @@
<Compile Include="Views\PowerLauncherPage.xaml.cs">
<DependentUpon>PowerLauncherPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\FancyZonesPage.xaml.cs">
<DependentUpon>FancyZonesPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PowerRenamePage.xaml.cs">
<DependentUpon>PowerRenamePage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -141,6 +145,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Styles\_Sizes.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\_Thickness.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -153,6 +161,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FancyZonesPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\PowerRenamePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,8 @@
<value>Shortcut Guide</value>
<comment>Navigation view item name for Shortcut Guide</comment>
</data>
<data name="Shell_FancyZones.Content" xml:space="preserve">
<value>FancyZones</value>
<comment>Navigation view item name for FancyZones</comment>
</data>
</root>
13 changes: 13 additions & 0 deletions src/core/Microsoft.PowerToys.Settings.UI/Styles/_Sizes.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Styles">

<x:Double x:Key="SidePanelWidth">180</x:Double>

<!-- Breakpoint for wide layout (side panel next to content) -->
<x:Double x:Key="WideLayoutMinWidth">1100</x:Double>

<!-- Breakpoint for small layout (side panel under content) -->
<x:Double x:Key="SmallLayoutMinWidth">480</x:Double>
</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

using Microsoft.PowerToys.Settings.UI.Helpers;

namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
public class FancyZonesViewModel : Observable
{
public FancyZonesViewModel()
{
}
}
}
146 changes: 146 additions & 0 deletions src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.FancyZonesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid ColumnSpacing="32" RowSpacing="32">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LayoutVisualStates">
<VisualState x:Name="WideLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SidePanel.(Grid.Column)" Value="1" />
<Setter Target="SidePanel.(Grid.Row)" Value="0" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="SmallLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SidePanel.(Grid.Column)" Value="0" />
<Setter Target="SidePanel.(Grid.Row)" Value="1" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<StackPanel Orientation="Vertical">
<TextBlock Text="Create window layouts to help make multi-tasking easy."
TextWrapping="Wrap"/>

<ToggleSwitch Header="Enable FancyZones"
IsOn="True"
Margin="{StaticResource SmallTopMargin}" />

<TextBlock Text="Zone behaviour"
Style="{StaticResource SettingsGroupTitleStyle}"/>

<CheckBox Content="Hold Shift key or any non-primary mouse button to enable zones while dragging"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="Override Windows Snap hotkeys (Win + arrow) to move windows between zones"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="Flash zones when the active FancyZones layout changes"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="Keep windows in their zones when the screen resolution changes"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="During zone layout changes, windows assigned to a zone will match new size/positions"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="Keep windows pinned to multiple desktops in the same zone when the active desktop changes"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="Move newly created windows to their last known zone"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>

<CheckBox Content="Follow mouse cursor instead of focus when launching editor in a multi screen environment"
IsChecked="True"
Margin="{StaticResource SmallTopMargin}"/>




<TextBlock Text="Appearance"
Style="{StaticResource SettingsGroupTitleStyle}"/>

<!-- TO DO: Do we still need this numberbox? The colorpicker has an Alpha/Opacity option as well so we could use that -->
<muxc:NumberBox Header="Zone highlight opacity (%)"
Value="90"
Minimum="0"
Maximum="100"
SpinButtonPlacementMode="Inline"
HorizontalAlignment="Left"
Margin="{StaticResource SmallTopMargin}" />

<TextBlock Text="Zone highlight color (default: #0078D7)"
Style="{StaticResource BodyTextBlockStyle}"
Margin="{StaticResource SmallTopMargin}" />

<muxc:ColorPicker Margin="0,6,0,0"
HorizontalAlignment="Left"
IsMoreButtonVisible="True"
IsColorSliderVisible="True"
IsColorChannelTextInputVisible="True"
IsHexInputVisible="True"
IsAlphaEnabled="True"
IsAlphaSliderVisible="True"
IsAlphaTextInputVisible="True" />

<TextBlock Text="Excluded apps"
Style="{StaticResource SettingsGroupTitleStyle}"/>

<TextBox Header="To exclude an application from snapping to zones add its name here (one per line). Excluded apps will react to the Windows Snap regardless of all other settings."
Margin="{StaticResource SmallTopMargin}"/>

</StackPanel>

<StackPanel x:Name="SidePanel"
Orientation="Vertical"
HorizontalAlignment="Left"
Width="{StaticResource SidePanelWidth}"
Grid.Column="1">

<TextBlock Text="About this feature"
Style="{StaticResource SettingsGroupTitleStyle}"
Margin="{StaticResource XSmallBottomMargin}"/>

<HyperlinkButton Content="Module overview" NavigateUri="https://github.com/microsoft/PowerToys/blob/master/src/modules/fancyzones/README.md"/>
<HyperlinkButton Content="Video demo" NavigateUri="https://www.youtube.com/watch?v=rTtGzZYAXgY"/>
<HyperlinkButton Content="Give feedback"/>

<TextBlock Text="Contributors"
Style="{StaticResource SettingsGroupTitleStyle}"/>

<HyperlinkButton Content="Contributor name"/>
<HyperlinkButton Content="Contributor name"/>
<HyperlinkButton Content="Contributor name"/>
</StackPanel>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Microsoft.PowerToys.Settings.UI.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class FancyZonesPage : Page
{
public FancyZonesViewModel ViewModel { get; } = new FancyZonesViewModel();

public FancyZonesPage()
{
this.InitializeComponent();
}
}
}
87 changes: 66 additions & 21 deletions src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,56 @@
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>
<ScrollViewer>
<StackPanel Orientation="Vertical">
<Grid ColumnSpacing="32" RowSpacing="32">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LayoutVisualStates">
<VisualState x:Name="WideLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SidePanel.(Grid.Column)" Value="1" />
<Setter Target="SidePanel.(Grid.Row)" Value="0" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="SmallLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="SidePanel.(Grid.Column)" Value="0" />
<Setter Target="SidePanel.(Grid.Row)" Value="1" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical">

<ToggleSwitch Header="Run at startup" x:Name="ToggleSwitch_RunAtStartUp" Margin="{StaticResource SmallTopMargin}" Toggled="ToggleSwitch_RunAtStartUp_Toggled" />
<ToggleSwitch Header="Run at startup" x:Name="ToggleSwitch_RunAtStartUp" Margin="{StaticResource SmallTopMargin}" Toggled="ToggleSwitch_RunAtStartUp_Toggled" />

<muxc:RadioButtons Header="Theme" Margin="{StaticResource SmallTopMargin}">
<RadioButton x:Name="Rodio_Theme_Dark" Content="Dark" Tag="Dark" Checked="Theme_Changed"/>
<RadioButton x:Name="Rodio_Theme_Light" Content="Light" Tag="Light" Checked="Theme_Changed"/>
<RadioButton x:Name="Rodio_Theme_Default" Content="System default" Tag="System" Checked="Theme_Changed"/>
</muxc:RadioButtons>
<muxc:RadioButtons Header="Theme" Margin="{StaticResource SmallTopMargin}">
<RadioButton x:Name="Radio_Theme_Dark" Content="Dark" Tag="Dark" Checked="Theme_Changed"/>
<RadioButton x:Name="Radio_Theme_Light" Content="Light" Tag="Light" Checked="Theme_Changed"/>
<RadioButton x:Name="Radio_Theme_Default" Content="System default" Tag="System" Checked="Theme_Changed"/>
</muxc:RadioButtons>

<!--
<!--
<TextBlock Text="Default apps" Style="{StaticResource SettingsGroupTitleStyle}"/>
<ToggleSwitch Header="Disable telemetry" IsOn="True" Margin="0,14,0,0" />
<TextBlock Text="PowerToys currently respects the Windows data &amp; feedback setting" Opacity="0.8" Margin="0,0,0,0" />
-->

<Button Background="{ThemeResource SystemAccentColor}" Content="Restart as admin" Margin="{StaticResource SmallTopMargin}" Foreground="White" Click="Restart_Elevated" />
<Button Content="Restart as admin" Margin="{StaticResource SmallTopMargin}" Style="{StaticResource AccentButtonStyle}" Click="Restart_Elevated" />

<!--
<!--
<TextBlock Text="Default apps" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
<ComboBox Header="Shell" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
<ComboBoxItem>PowerShell</ComboBoxItem>
Expand All @@ -39,15 +68,31 @@
</ComboBox>
-->

<TextBlock Text="About PowerToys" Style="{StaticResource SettingsGroupTitleStyle}"/>
<TextBlock Text="Version 0.15.1.0" FontWeight="Bold" Margin="{StaticResource SmallTopMargin}" />
<!--<Button Background="{ThemeResource SystemAccentColor}" Content="Check for updates" Margin="0,10,0,0" Foreground="White" />
TO DO: The styling of this button should be improved so the hover/pressed states are representing the SystemAccentColor -->
</StackPanel>

<HyperlinkButton Content="Report a bug" NavigateUri="https://github.com/microsoft/PowerToys/issues" />
<HyperlinkButton Content="Request a feature" NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
<HyperlinkButton Content="Privacy statement" NavigateUri=" http://go.microsoft.com/fwlink/?LinkId=521839" />
</StackPanel>
</ScrollViewer>
<StackPanel x:Name="SidePanel"
Orientation="Vertical"
HorizontalAlignment="Left"
Width="{StaticResource SidePanelWidth}"
Grid.Column="1">

<TextBlock Text="About PowerToys"
Style="{StaticResource SettingsGroupTitleStyle}"
Margin="{StaticResource XSmallBottomMargin}"/>
<TextBlock Text="Version 0.15.2" FontWeight="Bold" Margin="{StaticResource SmallTopMargin}" />
<Button Content="Check for updates" Margin="{StaticResource SmallTopMargin}" Foreground="White" Style="{StaticResource AccentButtonStyle}" Click="CheckForUpdates_Click" />

<HyperlinkButton Content="Report a bug" NavigateUri="https://github.com/microsoft/PowerToys/issues" Margin="{StaticResource SmallTopMargin}" />
<HyperlinkButton Content="Request a feature" NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
<HyperlinkButton Content="Privacy statement" NavigateUri=" http://go.microsoft.com/fwlink/?LinkId=521839" />



<TextBlock Text="Contributors" Style="{StaticResource SettingsGroupTitleStyle}"/>

<HyperlinkButton Content="Contributor name"/>
<HyperlinkButton Content="Contributor name"/>
<HyperlinkButton Content="Contributor name"/>
</StackPanel>
</Grid>
</Page>
Loading