2021-06-23 20:48:54 +08:00
|
|
|
// Copyright (c) Microsoft Corporation
|
2020-04-08 01:19:14 +08:00
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
// See the LICENSE file in the project root for more information.
|
2020-03-31 20:32:22 +08:00
|
|
|
|
2020-08-19 05:46:32 +08:00
|
|
|
using System;
|
2020-04-17 02:45:27 +08:00
|
|
|
using System.Runtime.CompilerServices;
|
2020-10-23 00:45:48 +08:00
|
|
|
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
2022-05-20 00:07:18 +08:00
|
|
|
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
2020-10-23 00:45:48 +08:00
|
|
|
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
2020-08-19 05:46:32 +08:00
|
|
|
|
2020-10-23 00:45:48 +08:00
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
2020-03-31 20:32:22 +08:00
|
|
|
{
|
|
|
|
public class FancyZonesViewModel : Observable
|
|
|
|
{
|
2021-06-23 20:48:54 +08:00
|
|
|
private ISettingsUtils SettingsUtils { get; set; }
|
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
private GeneralSettings GeneralSettingsConfig { get; set; }
|
2020-09-22 01:14:44 +08:00
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
private const string ModuleName = FancyZonesSettings.ModuleName;
|
2020-04-17 02:45:27 +08:00
|
|
|
|
|
|
|
public ButtonClickCommand LaunchEditorEventHandler { get; set; }
|
|
|
|
|
|
|
|
private FancyZonesSettings Settings { get; set; }
|
|
|
|
|
2020-08-19 05:46:32 +08:00
|
|
|
private Func<string, int> SendConfigMSG { get; }
|
|
|
|
|
|
|
|
private string settingsConfigFileFolder = string.Empty;
|
|
|
|
|
2022-05-20 00:07:18 +08:00
|
|
|
private bool _windows11;
|
|
|
|
|
2021-02-03 19:12:53 +08:00
|
|
|
private enum MoveWindowBehaviour
|
|
|
|
{
|
|
|
|
MoveWindowBasedOnZoneIndex = 0,
|
|
|
|
MoveWindowBasedOnPosition,
|
|
|
|
}
|
|
|
|
|
2021-02-25 23:23:05 +08:00
|
|
|
private enum OverlappingZonesAlgorithm
|
|
|
|
{
|
|
|
|
Smallest = 0,
|
|
|
|
Largest = 1,
|
|
|
|
Positional = 2,
|
|
|
|
}
|
|
|
|
|
2021-06-23 20:48:54 +08:00
|
|
|
public FancyZonesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
|
2020-03-31 20:32:22 +08:00
|
|
|
{
|
2021-06-23 20:48:54 +08:00
|
|
|
if (settingsUtils == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(settingsUtils));
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsUtils = settingsUtils;
|
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
// To obtain the general settings configurations of PowerToys Settings.
|
2020-10-20 04:32:05 +08:00
|
|
|
if (settingsRepository == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(settingsRepository));
|
|
|
|
}
|
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
2020-08-19 05:46:32 +08:00
|
|
|
settingsConfigFileFolder = configFileSubfolder;
|
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
// To obtain the settings configurations of Fancy zones.
|
2020-10-20 04:32:05 +08:00
|
|
|
if (moduleSettingsRepository == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
|
|
|
}
|
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
Settings = moduleSettingsRepository.SettingsConfig;
|
2020-08-19 05:46:32 +08:00
|
|
|
|
2020-08-20 06:59:10 +08:00
|
|
|
LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor);
|
|
|
|
|
|
|
|
_shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value;
|
|
|
|
_mouseSwitch = Settings.Properties.FancyzonesMouseSwitch.Value;
|
|
|
|
_overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value;
|
|
|
|
_moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value;
|
2021-02-03 19:12:53 +08:00
|
|
|
_moveWindowBehaviour = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value ? MoveWindowBehaviour.MoveWindowBasedOnPosition : MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
|
2021-02-25 23:23:05 +08:00
|
|
|
_overlappingZonesAlgorithm = (OverlappingZonesAlgorithm)Settings.Properties.FancyzonesOverlappingZonesAlgorithm.Value;
|
2020-08-20 06:59:10 +08:00
|
|
|
_displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value;
|
|
|
|
_zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value;
|
|
|
|
_appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
|
|
|
|
_openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value;
|
|
|
|
_restoreSize = Settings.Properties.FancyzonesRestoreSize.Value;
|
2021-03-25 20:44:55 +08:00
|
|
|
_quickLayoutSwitch = Settings.Properties.FancyzonesQuickLayoutSwitch.Value;
|
|
|
|
_flashZonesOnQuickLayoutSwitch = Settings.Properties.FancyzonesFlashZonesOnQuickSwitch.Value;
|
2020-08-20 06:59:10 +08:00
|
|
|
_useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value;
|
|
|
|
_showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value;
|
2020-09-04 16:11:05 +08:00
|
|
|
_spanZonesAcrossMonitors = Settings.Properties.FancyzonesSpanZonesAcrossMonitors.Value;
|
2020-08-20 06:59:10 +08:00
|
|
|
_makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value;
|
2022-02-23 22:25:28 +08:00
|
|
|
_allowPopupWindowSnap = Settings.Properties.FancyzonesAllowPopupWindowSnap.Value;
|
|
|
|
_allowChildWindowSnap = Settings.Properties.FancyzonesAllowChildWindowSnap.Value;
|
2022-04-02 00:28:19 +08:00
|
|
|
_disableRoundCornersOnSnap = Settings.Properties.FancyzonesDisableRoundCornersOnSnap.Value;
|
2020-08-20 06:59:10 +08:00
|
|
|
_highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value;
|
|
|
|
_excludedApps = Settings.Properties.FancyzonesExcludedApps.Value;
|
2021-11-04 22:30:06 +08:00
|
|
|
_systemTheme = Settings.Properties.FancyzonesSystemTheme.Value;
|
2021-12-21 00:50:51 +08:00
|
|
|
_showZoneNumber = Settings.Properties.FancyzonesShowZoneNumber.Value;
|
2020-08-20 06:59:10 +08:00
|
|
|
EditorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value;
|
2021-11-03 23:11:42 +08:00
|
|
|
_windowSwitching = Settings.Properties.FancyzonesWindowSwitching.Value;
|
|
|
|
NextTabHotkey = Settings.Properties.FancyzonesNextTabHotkey.Value;
|
|
|
|
PrevTabHotkey = Settings.Properties.FancyzonesPrevTabHotkey.Value;
|
2020-08-19 05:46:32 +08:00
|
|
|
|
|
|
|
// set the callback functions value to hangle outgoing IPC message.
|
|
|
|
SendConfigMSG = ipcMSGCallBackFunc;
|
|
|
|
|
2020-05-08 02:24:19 +08:00
|
|
|
string inactiveColor = Settings.Properties.FancyzonesInActiveColor.Value;
|
2021-12-21 00:50:51 +08:00
|
|
|
_zoneInActiveColor = !string.IsNullOrEmpty(inactiveColor) ? inactiveColor : ConfigDefaults.DefaultFancyZonesInActiveColor;
|
2020-05-08 02:24:19 +08:00
|
|
|
|
|
|
|
string borderColor = Settings.Properties.FancyzonesBorderColor.Value;
|
2021-12-21 00:50:51 +08:00
|
|
|
_zoneBorderColor = !string.IsNullOrEmpty(borderColor) ? borderColor : ConfigDefaults.DefaultFancyzonesBorderColor;
|
2020-05-08 02:24:19 +08:00
|
|
|
|
|
|
|
string highlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value;
|
2021-12-21 00:50:51 +08:00
|
|
|
_zoneHighlightColor = !string.IsNullOrEmpty(highlightColor) ? highlightColor : ConfigDefaults.DefaultFancyZonesZoneHighlightColor;
|
|
|
|
|
|
|
|
string numberColor = Settings.Properties.FancyzonesNumberColor.Value;
|
|
|
|
_zoneNumberColor = !string.IsNullOrEmpty(numberColor) ? numberColor : ConfigDefaults.DefaultFancyzonesNumberColor;
|
2020-04-18 06:25:08 +08:00
|
|
|
|
2020-09-24 04:20:32 +08:00
|
|
|
_isEnabled = GeneralSettingsConfig.Enabled.FancyZones;
|
2022-05-20 00:07:18 +08:00
|
|
|
_windows11 = Helper.Windows11();
|
|
|
|
|
|
|
|
// Disable setting on windows 10
|
|
|
|
if (!_windows11 && DisableRoundCornersOnWindowSnap)
|
|
|
|
{
|
|
|
|
DisableRoundCornersOnWindowSnap = false;
|
|
|
|
}
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private bool _isEnabled;
|
|
|
|
private bool _shiftDrag;
|
2020-05-08 04:29:02 +08:00
|
|
|
private bool _mouseSwitch;
|
2020-04-17 02:45:27 +08:00
|
|
|
private bool _overrideSnapHotkeys;
|
2020-05-08 04:29:02 +08:00
|
|
|
private bool _moveWindowsAcrossMonitors;
|
2021-02-03 19:12:53 +08:00
|
|
|
private MoveWindowBehaviour _moveWindowBehaviour;
|
2021-02-25 23:23:05 +08:00
|
|
|
private OverlappingZonesAlgorithm _overlappingZonesAlgorithm;
|
2020-04-17 02:45:27 +08:00
|
|
|
private bool _displayChangemoveWindows;
|
|
|
|
private bool _zoneSetChangeMoveWindows;
|
|
|
|
private bool _appLastZoneMoveWindows;
|
2020-07-08 16:37:42 +08:00
|
|
|
private bool _openWindowOnActiveMonitor;
|
2020-08-07 16:06:25 +08:00
|
|
|
private bool _spanZonesAcrossMonitors;
|
2020-07-01 21:36:05 +08:00
|
|
|
private bool _restoreSize;
|
2021-03-25 20:44:55 +08:00
|
|
|
private bool _quickLayoutSwitch;
|
|
|
|
private bool _flashZonesOnQuickLayoutSwitch;
|
2020-04-17 02:45:27 +08:00
|
|
|
private bool _useCursorPosEditorStartupScreen;
|
|
|
|
private bool _showOnAllMonitors;
|
2020-05-08 04:29:02 +08:00
|
|
|
private bool _makeDraggedWindowTransparent;
|
2021-11-04 22:30:06 +08:00
|
|
|
private bool _systemTheme;
|
2021-12-21 00:50:51 +08:00
|
|
|
private bool _showZoneNumber;
|
2022-02-23 22:25:28 +08:00
|
|
|
private bool _allowPopupWindowSnap;
|
|
|
|
private bool _allowChildWindowSnap;
|
2022-04-02 00:28:19 +08:00
|
|
|
private bool _disableRoundCornersOnSnap;
|
2020-05-08 02:24:19 +08:00
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
private int _highlightOpacity;
|
|
|
|
private string _excludedApps;
|
|
|
|
private HotkeySettings _editorHotkey;
|
2021-11-03 23:11:42 +08:00
|
|
|
private bool _windowSwitching;
|
|
|
|
private HotkeySettings _nextTabHotkey;
|
|
|
|
private HotkeySettings _prevTabHotkey;
|
2020-08-19 05:46:32 +08:00
|
|
|
private string _zoneInActiveColor;
|
|
|
|
private string _zoneBorderColor;
|
|
|
|
private string _zoneHighlightColor;
|
2021-12-21 00:50:51 +08:00
|
|
|
private string _zoneNumberColor;
|
2020-04-17 02:45:27 +08:00
|
|
|
|
|
|
|
public bool IsEnabled
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _isEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _isEnabled)
|
|
|
|
{
|
|
|
|
_isEnabled = value;
|
2020-09-24 04:20:32 +08:00
|
|
|
|
|
|
|
// Set the status of FancyZones in the general settings configuration
|
|
|
|
GeneralSettingsConfig.Enabled.FancyZones = value;
|
|
|
|
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
2020-04-17 02:45:27 +08:00
|
|
|
|
2020-08-19 05:46:32 +08:00
|
|
|
SendConfigMSG(snd.ToString());
|
2020-10-10 08:58:52 +08:00
|
|
|
OnPropertyChanged(nameof(IsEnabled));
|
|
|
|
OnPropertyChanged(nameof(SnapHotkeysCategoryEnabled));
|
2021-03-25 20:44:55 +08:00
|
|
|
OnPropertyChanged(nameof(QuickSwitchEnabled));
|
2021-11-03 23:11:42 +08:00
|
|
|
OnPropertyChanged(nameof(WindowSwitchingCategoryEnabled));
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-21 18:53:03 +08:00
|
|
|
public bool SnapHotkeysCategoryEnabled
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _isEnabled && _overrideSnapHotkeys;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-25 20:44:55 +08:00
|
|
|
public bool QuickSwitchEnabled
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _isEnabled && _quickLayoutSwitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-03 23:11:42 +08:00
|
|
|
public bool WindowSwitchingCategoryEnabled
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _isEnabled && _windowSwitching;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
public bool ShiftDrag
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _shiftDrag;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _shiftDrag)
|
|
|
|
{
|
|
|
|
_shiftDrag = value;
|
|
|
|
Settings.Properties.FancyzonesShiftDrag.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-08 04:29:02 +08:00
|
|
|
public bool MouseSwitch
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _mouseSwitch;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _mouseSwitch)
|
|
|
|
{
|
|
|
|
_mouseSwitch = value;
|
|
|
|
Settings.Properties.FancyzonesMouseSwitch.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-05-08 04:29:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 05:46:32 +08:00
|
|
|
public string GetSettingsSubPath()
|
|
|
|
{
|
|
|
|
return settingsConfigFileFolder + "\\" + ModuleName;
|
|
|
|
}
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
public bool OverrideSnapHotkeys
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _overrideSnapHotkeys;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _overrideSnapHotkeys)
|
|
|
|
{
|
|
|
|
_overrideSnapHotkeys = value;
|
|
|
|
Settings.Properties.FancyzonesOverrideSnapHotkeys.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-10-10 08:58:52 +08:00
|
|
|
OnPropertyChanged(nameof(SnapHotkeysCategoryEnabled));
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-08 04:29:02 +08:00
|
|
|
public bool MoveWindowsAcrossMonitors
|
2020-04-17 02:45:27 +08:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2020-05-08 04:29:02 +08:00
|
|
|
return _moveWindowsAcrossMonitors;
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
2020-05-08 04:29:02 +08:00
|
|
|
if (value != _moveWindowsAcrossMonitors)
|
2020-04-17 02:45:27 +08:00
|
|
|
{
|
2020-05-08 04:29:02 +08:00
|
|
|
_moveWindowsAcrossMonitors = value;
|
|
|
|
Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-21 18:53:03 +08:00
|
|
|
public bool MoveWindowsBasedOnPosition
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2021-02-03 19:12:53 +08:00
|
|
|
return _moveWindowBehaviour == MoveWindowBehaviour.MoveWindowBasedOnPosition;
|
2020-08-21 18:53:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
2021-02-03 19:12:53 +08:00
|
|
|
var settingsValue = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value;
|
|
|
|
if (value != settingsValue)
|
2020-08-21 18:53:03 +08:00
|
|
|
{
|
2021-02-03 19:12:53 +08:00
|
|
|
_moveWindowBehaviour = value ? MoveWindowBehaviour.MoveWindowBasedOnPosition : MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
|
2020-08-21 18:53:03 +08:00
|
|
|
Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-08-21 18:53:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-03 19:12:53 +08:00
|
|
|
public bool MoveWindowsBasedOnZoneIndex
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _moveWindowBehaviour == MoveWindowBehaviour.MoveWindowBasedOnZoneIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
var settingsValue = Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value;
|
|
|
|
if (value == settingsValue)
|
|
|
|
{
|
|
|
|
_moveWindowBehaviour = value ? MoveWindowBehaviour.MoveWindowBasedOnZoneIndex : MoveWindowBehaviour.MoveWindowBasedOnPosition;
|
|
|
|
Settings.Properties.FancyzonesMoveWindowsBasedOnPosition.Value = !value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-25 23:23:05 +08:00
|
|
|
public int OverlappingZonesAlgorithmIndex
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return (int)_overlappingZonesAlgorithm;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != (int)_overlappingZonesAlgorithm)
|
|
|
|
{
|
|
|
|
_overlappingZonesAlgorithm = (OverlappingZonesAlgorithm)value;
|
|
|
|
Settings.Properties.FancyzonesOverlappingZonesAlgorithm.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
public bool DisplayChangeMoveWindows
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _displayChangemoveWindows;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _displayChangemoveWindows)
|
|
|
|
{
|
|
|
|
_displayChangemoveWindows = value;
|
|
|
|
Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool ZoneSetChangeMoveWindows
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _zoneSetChangeMoveWindows;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _zoneSetChangeMoveWindows)
|
|
|
|
{
|
|
|
|
_zoneSetChangeMoveWindows = value;
|
|
|
|
Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool AppLastZoneMoveWindows
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _appLastZoneMoveWindows;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _appLastZoneMoveWindows)
|
|
|
|
{
|
|
|
|
_appLastZoneMoveWindows = value;
|
|
|
|
Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-08 16:37:42 +08:00
|
|
|
public bool OpenWindowOnActiveMonitor
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _openWindowOnActiveMonitor;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _openWindowOnActiveMonitor)
|
|
|
|
{
|
|
|
|
_openWindowOnActiveMonitor = value;
|
|
|
|
Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-07-08 16:37:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-01 21:36:05 +08:00
|
|
|
public bool RestoreSize
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _restoreSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _restoreSize)
|
|
|
|
{
|
|
|
|
_restoreSize = value;
|
|
|
|
Settings.Properties.FancyzonesRestoreSize.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-07-01 21:36:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-25 20:44:55 +08:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
public bool UseCursorPosEditorStartupScreen
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _useCursorPosEditorStartupScreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _useCursorPosEditorStartupScreen)
|
|
|
|
{
|
|
|
|
_useCursorPosEditorStartupScreen = value;
|
|
|
|
Settings.Properties.UseCursorposEditorStartupscreen.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool ShowOnAllMonitors
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _showOnAllMonitors;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _showOnAllMonitors)
|
|
|
|
{
|
|
|
|
_showOnAllMonitors = value;
|
|
|
|
Settings.Properties.FancyzonesShowOnAllMonitors.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-07 16:06:25 +08:00
|
|
|
public bool SpanZonesAcrossMonitors
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _spanZonesAcrossMonitors;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _spanZonesAcrossMonitors)
|
|
|
|
{
|
|
|
|
_spanZonesAcrossMonitors = value;
|
|
|
|
Settings.Properties.FancyzonesSpanZonesAcrossMonitors.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-08-07 16:06:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-08 04:29:02 +08:00
|
|
|
public bool MakeDraggedWindowsTransparent
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _makeDraggedWindowTransparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _makeDraggedWindowTransparent)
|
|
|
|
{
|
|
|
|
_makeDraggedWindowTransparent = value;
|
|
|
|
Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-05-08 04:29:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-04 22:30:06 +08:00
|
|
|
public bool SystemTheme
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _systemTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _systemTheme)
|
|
|
|
{
|
|
|
|
_systemTheme = value;
|
|
|
|
Settings.Properties.FancyzonesSystemTheme.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 00:50:51 +08:00
|
|
|
public bool ShowZoneNumber
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _showZoneNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _showZoneNumber)
|
|
|
|
{
|
|
|
|
_showZoneNumber = value;
|
|
|
|
Settings.Properties.FancyzonesShowZoneNumber.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-23 22:25:28 +08:00
|
|
|
public bool AllowPopupWindowSnap
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _allowPopupWindowSnap;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _allowPopupWindowSnap)
|
|
|
|
{
|
|
|
|
_allowPopupWindowSnap = value;
|
|
|
|
Settings.Properties.FancyzonesAllowPopupWindowSnap.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool AllowChildWindowSnap
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _allowChildWindowSnap;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _allowChildWindowSnap)
|
|
|
|
{
|
|
|
|
_allowChildWindowSnap = value;
|
|
|
|
Settings.Properties.FancyzonesAllowChildWindowSnap.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-02 00:28:19 +08:00
|
|
|
public bool DisableRoundCornersOnWindowSnap
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _disableRoundCornersOnSnap;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (_disableRoundCornersOnSnap != value)
|
|
|
|
{
|
|
|
|
_disableRoundCornersOnSnap = value;
|
|
|
|
Settings.Properties.FancyzonesDisableRoundCornersOnSnap.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-20 04:32:05 +08:00
|
|
|
// For the following setters we use OrdinalIgnoreCase string comparison since
|
|
|
|
// we expect value to be a hex code.
|
2020-08-19 05:46:32 +08:00
|
|
|
public string ZoneHighlightColor
|
2020-04-17 02:45:27 +08:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _zoneHighlightColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
2020-10-20 04:32:05 +08:00
|
|
|
// The fallback value is based on ToRGBHex's behavior, which returns
|
|
|
|
// #FFFFFF if any exceptions are encountered, e.g. from passing in a null value.
|
|
|
|
// This extra handling is added here to deal with FxCop warnings.
|
2021-11-22 21:31:31 +08:00
|
|
|
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF";
|
2020-10-20 04:32:05 +08:00
|
|
|
if (!value.Equals(_zoneHighlightColor, StringComparison.OrdinalIgnoreCase))
|
2020-04-17 02:45:27 +08:00
|
|
|
{
|
|
|
|
_zoneHighlightColor = value;
|
2020-08-19 05:46:32 +08:00
|
|
|
Settings.Properties.FancyzonesZoneHighlightColor.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 05:46:32 +08:00
|
|
|
public string ZoneBorderColor
|
2020-04-18 06:25:08 +08:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _zoneBorderColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
2020-10-20 04:32:05 +08:00
|
|
|
// The fallback value is based on ToRGBHex's behavior, which returns
|
|
|
|
// #FFFFFF if any exceptions are encountered, e.g. from passing in a null value.
|
|
|
|
// This extra handling is added here to deal with FxCop warnings.
|
2021-11-22 21:31:31 +08:00
|
|
|
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF";
|
2020-08-19 05:46:32 +08:00
|
|
|
if (!value.Equals(_zoneBorderColor, StringComparison.OrdinalIgnoreCase))
|
2020-04-18 06:25:08 +08:00
|
|
|
{
|
|
|
|
_zoneBorderColor = value;
|
2020-08-19 05:46:32 +08:00
|
|
|
Settings.Properties.FancyzonesBorderColor.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-18 06:25:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 05:46:32 +08:00
|
|
|
public string ZoneInActiveColor
|
2020-04-18 06:25:08 +08:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _zoneInActiveColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
2020-10-20 04:32:05 +08:00
|
|
|
// The fallback value is based on ToRGBHex's behavior, which returns
|
|
|
|
// #FFFFFF if any exceptions are encountered, e.g. from passing in a null value.
|
|
|
|
// This extra handling is added here to deal with FxCop warnings.
|
2021-11-22 21:31:31 +08:00
|
|
|
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF";
|
2020-10-20 04:32:05 +08:00
|
|
|
if (!value.Equals(_zoneInActiveColor, StringComparison.OrdinalIgnoreCase))
|
2020-04-18 06:25:08 +08:00
|
|
|
{
|
|
|
|
_zoneInActiveColor = value;
|
2020-08-19 05:46:32 +08:00
|
|
|
Settings.Properties.FancyzonesInActiveColor.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2021-12-21 00:50:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string ZoneNumberColor
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _zoneNumberColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
// The fallback value is based on ToRGBHex's behavior, which returns
|
|
|
|
// #FFFFFF if any exceptions are encountered, e.g. from passing in a null value.
|
|
|
|
// This extra handling is added here to deal with FxCop warnings.
|
|
|
|
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF";
|
|
|
|
if (!value.Equals(_zoneNumberColor, StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
_zoneNumberColor = value;
|
|
|
|
Settings.Properties.FancyzonesNumberColor.Value = value;
|
|
|
|
NotifyPropertyChanged();
|
2020-04-18 06:25:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
public int HighlightOpacity
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _highlightOpacity;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _highlightOpacity)
|
|
|
|
{
|
|
|
|
_highlightOpacity = value;
|
|
|
|
Settings.Properties.FancyzonesHighlightOpacity.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public HotkeySettings EditorHotkey
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _editorHotkey;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _editorHotkey)
|
|
|
|
{
|
2020-10-20 04:32:05 +08:00
|
|
|
if (value == null || value.IsEmpty())
|
2020-06-05 05:52:04 +08:00
|
|
|
{
|
2021-11-03 23:11:42 +08:00
|
|
|
_editorHotkey = FZConfigProperties.DefaultEditorHotkeyValue;
|
2020-06-05 05:52:04 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_editorHotkey = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings.Properties.FancyzonesEditorHotkey.Value = _editorHotkey;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-03 23:11:42 +08:00
|
|
|
public bool WindowSwitching
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _windowSwitching;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _windowSwitching)
|
|
|
|
{
|
|
|
|
_windowSwitching = value;
|
|
|
|
|
|
|
|
Settings.Properties.FancyzonesWindowSwitching.Value = _windowSwitching;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
OnPropertyChanged(nameof(WindowSwitchingCategoryEnabled));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public HotkeySettings NextTabHotkey
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _nextTabHotkey;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _nextTabHotkey)
|
|
|
|
{
|
|
|
|
if (value == null || value.IsEmpty())
|
|
|
|
{
|
|
|
|
_nextTabHotkey = FZConfigProperties.DefaultNextTabHotkeyValue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_nextTabHotkey = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings.Properties.FancyzonesNextTabHotkey.Value = _nextTabHotkey;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public HotkeySettings PrevTabHotkey
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _prevTabHotkey;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _prevTabHotkey)
|
|
|
|
{
|
|
|
|
if (value == null || value.IsEmpty())
|
|
|
|
{
|
|
|
|
_prevTabHotkey = FZConfigProperties.DefaultPrevTabHotkeyValue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_prevTabHotkey = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings.Properties.FancyzonesPrevTabHotkey.Value = _prevTabHotkey;
|
|
|
|
NotifyPropertyChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
public string ExcludedApps
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _excludedApps;
|
|
|
|
}
|
|
|
|
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value != _excludedApps)
|
|
|
|
{
|
|
|
|
_excludedApps = value;
|
|
|
|
Settings.Properties.FancyzonesExcludedApps.Value = value;
|
2020-10-20 04:32:05 +08:00
|
|
|
NotifyPropertyChanged();
|
2020-04-17 02:45:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-20 00:07:18 +08:00
|
|
|
public bool Windows11 => _windows11;
|
|
|
|
|
2020-04-17 02:45:27 +08:00
|
|
|
private void LaunchEditor()
|
|
|
|
{
|
|
|
|
// send message to launch the zones editor;
|
2020-08-19 05:46:32 +08:00
|
|
|
SendConfigMSG("{\"action\":{\"FancyZones\":{\"action_name\":\"ToggledFZEditor\", \"value\":\"\"}}}");
|
2020-04-18 06:25:08 +08:00
|
|
|
}
|
|
|
|
|
2020-10-20 04:32:05 +08:00
|
|
|
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
2020-04-17 02:45:27 +08:00
|
|
|
{
|
|
|
|
OnPropertyChanged(propertyName);
|
2021-06-23 20:48:54 +08:00
|
|
|
SettingsUtils.SaveSettings(Settings.ToJsonString(), GetSettingsSubPath());
|
2020-03-31 20:32:22 +08:00
|
|
|
}
|
|
|
|
}
|
2020-04-11 06:22:07 +08:00
|
|
|
}
|