[FancyZones Editor] Quick layout switch hotkeys (#10437)

Co-authored-by: Ivan Stošić <ivan100sic@gmail.com>
This commit is contained in:
Seraphima Zykova
2021-03-25 15:44:55 +03:00
committed by GitHub
parent 7ba03ed24f
commit 13c4c188fa
34 changed files with 986 additions and 376 deletions

View File

@@ -14,5 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
// Fancy Zones Default Flags.
public static readonly bool DefaultFancyzonesShiftDrag = true;
public static readonly bool DefaultUseCursorposEditorStartupscreen = true;
public static readonly bool DefaultFancyzonesQuickLayoutSwitch = true;
public static readonly bool DefaultFancyzonesFlashZonesOnQuickSwitch = true;
}
}

View File

@@ -24,6 +24,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
FancyzonesAppLastZoneMoveWindows = new BoolProperty();
FancyzonesOpenWindowOnActiveMonitor = new BoolProperty();
FancyzonesRestoreSize = new BoolProperty();
FancyzonesQuickLayoutSwitch = new BoolProperty(ConfigDefaults.DefaultFancyzonesQuickLayoutSwitch);
FancyzonesFlashZonesOnQuickSwitch = new BoolProperty(ConfigDefaults.DefaultFancyzonesFlashZonesOnQuickSwitch);
UseCursorposEditorStartupscreen = new BoolProperty(ConfigDefaults.DefaultUseCursorposEditorStartupscreen);
FancyzonesShowOnAllMonitors = new BoolProperty();
FancyzonesSpanZonesAcrossMonitors = new BoolProperty();
@@ -69,6 +71,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("fancyzones_restoreSize")]
public BoolProperty FancyzonesRestoreSize { get; set; }
[JsonPropertyName("fancyzones_quickLayoutSwitch")]
public BoolProperty FancyzonesQuickLayoutSwitch { get; set; }
[JsonPropertyName("fancyzones_flashZonesOnQuickSwitch")]
public BoolProperty FancyzonesFlashZonesOnQuickSwitch { get; set; }
[JsonPropertyName("use_cursorpos_editor_startupscreen")]
public BoolProperty UseCursorposEditorStartupscreen { get; set; }

View File

@@ -71,6 +71,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
_openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value;
_restoreSize = Settings.Properties.FancyzonesRestoreSize.Value;
_quickLayoutSwitch = Settings.Properties.FancyzonesQuickLayoutSwitch.Value;
_flashZonesOnQuickLayoutSwitch = Settings.Properties.FancyzonesFlashZonesOnQuickSwitch.Value;
_useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value;
_showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value;
_spanZonesAcrossMonitors = Settings.Properties.FancyzonesSpanZonesAcrossMonitors.Value;
@@ -107,6 +109,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private bool _openWindowOnActiveMonitor;
private bool _spanZonesAcrossMonitors;
private bool _restoreSize;
private bool _quickLayoutSwitch;
private bool _flashZonesOnQuickLayoutSwitch;
private bool _useCursorPosEditorStartupScreen;
private bool _showOnAllMonitors;
private bool _makeDraggedWindowTransparent;
@@ -138,6 +142,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
SendConfigMSG(snd.ToString());
OnPropertyChanged(nameof(IsEnabled));
OnPropertyChanged(nameof(SnapHotkeysCategoryEnabled));
OnPropertyChanged(nameof(QuickSwitchEnabled));
}
}
}
@@ -150,6 +155,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool QuickSwitchEnabled
{
get
{
return _isEnabled && _quickLayoutSwitch;
}
}
public bool ShiftDrag
{
get
@@ -374,6 +387,43 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool QuickLayoutSwitch
{
get
{
return _quickLayoutSwitch;
}
set
{
if (value != _quickLayoutSwitch)
{
_quickLayoutSwitch = value;
Settings.Properties.FancyzonesQuickLayoutSwitch.Value = value;
NotifyPropertyChanged();
OnPropertyChanged(nameof(QuickSwitchEnabled));
}
}
}
public bool FlashZonesOnQuickSwitch
{
get
{
return _flashZonesOnQuickLayoutSwitch;
}
set
{
if (value != _flashZonesOnQuickLayoutSwitch)
{
_flashZonesOnQuickLayoutSwitch = value;
Settings.Properties.FancyzonesFlashZonesOnQuickSwitch.Value = value;
NotifyPropertyChanged();
}
}
}
public bool UseCursorPosEditorStartupScreen
{
get

View File

@@ -1176,4 +1176,13 @@ Win + Shift + O to toggle your video</value>
<data name="ColorPicker_ButtonUp.AutomationProperties.Name" xml:space="preserve">
<value>Move the color up</value>
</data>
<data name="FancyZones_FlashZonesOnQuickSwitch.Content" xml:space="preserve">
<value>Flash zones when switching layout</value>
</data>
<data name="FancyZones_QuickLayoutSwitch.Content" xml:space="preserve">
<value>Enable quick layout switch</value>
</data>
<data name="FancyZones_QuickLayoutSwitch_GroupSettings.Text" xml:space="preserve">
<value>Quick layout switch</value>
</data>
</root>

View File

@@ -189,6 +189,20 @@
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
<TextBlock x:Uid="FancyZones_QuickLayoutSwitch_GroupSettings"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
<CheckBox x:Uid="FancyZones_QuickLayoutSwitch"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.QuickLayoutSwitch}"
Margin="{StaticResource XSmallTopMargin}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
<CheckBox x:Uid="FancyZones_FlashZonesOnQuickSwitch"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.FlashZonesOnQuickSwitch}"
Margin="24,8,0,0"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.QuickSwitchEnabled}"/>
<TextBlock x:Uid="Appearance_GroupSettings"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>