mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
added Fancy Zones Settings (#2161)
This commit is contained in:
@@ -6,12 +6,19 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class BoolProperty
|
||||
{
|
||||
public bool value { get; set; }
|
||||
public BoolProperty()
|
||||
{
|
||||
this.Value = false;
|
||||
}
|
||||
|
||||
[JsonPropertyName("value")]
|
||||
public bool Value { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class EnabledModules
|
||||
{
|
||||
public EnabledModules()
|
||||
{
|
||||
this.FancyZones = false;
|
||||
this.ImageResizer = false;
|
||||
this.FileExplorerPreview = false;
|
||||
this.PowerRename = false;
|
||||
this.ShortcutGuide = true;
|
||||
}
|
||||
|
||||
[JsonPropertyName("FancyZones")]
|
||||
public bool FancyZones { get; set; }
|
||||
|
||||
[JsonPropertyName("ImageResizer")]
|
||||
public bool ImageResizer { get; set; }
|
||||
|
||||
[JsonPropertyName("File Explorer Preview")]
|
||||
public bool FileExplorerPreview { get; set; }
|
||||
|
||||
[JsonPropertyName("Shortcut Guide")]
|
||||
public bool ShortcutGuide { get; set; }
|
||||
|
||||
public bool PowerRename { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class FZConfigProperties
|
||||
{
|
||||
public FZConfigProperties()
|
||||
{
|
||||
this.FancyzonesShiftDrag = new BoolProperty();
|
||||
this.FancyzonesOverrideSnapHotkeys = new BoolProperty();
|
||||
this.FancyzonesZoneSetChangeFlashZones = new BoolProperty();
|
||||
this.FancyzonesDisplayChangeMoveWindows = new BoolProperty();
|
||||
this.FancyzonesZoneSetChangeMoveWindows = new BoolProperty();
|
||||
this.FancyzonesVirtualDesktopChangeMoveWindows = new BoolProperty();
|
||||
this.FancyzonesAppLastZoneMoveWindows = new BoolProperty();
|
||||
this.UseCursorposEditorStartupscreen = new BoolProperty();
|
||||
this.FancyzonesShowOnAllMonitors = new BoolProperty();
|
||||
this.FancyzonesZoneHighlightColor = new StringProperty();
|
||||
this.FancyzonesHighlightOpacity = new IntProperty();
|
||||
this.FancyzonesEditorHotkey = new KeyBoardKeysProperty();
|
||||
this.FancyzonesExcludedApps = new StringProperty();
|
||||
}
|
||||
|
||||
[JsonPropertyName("fancyzones_shiftDrag")]
|
||||
public BoolProperty FancyzonesShiftDrag { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_overrideSnapHotkeys")]
|
||||
public BoolProperty FancyzonesOverrideSnapHotkeys { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_zoneSetChange_flashZones")]
|
||||
public BoolProperty FancyzonesZoneSetChangeFlashZones { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_displayChange_moveWindows")]
|
||||
public BoolProperty FancyzonesDisplayChangeMoveWindows { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_zoneSetChange_moveWindows")]
|
||||
public BoolProperty FancyzonesZoneSetChangeMoveWindows { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_virtualDesktopChange_moveWindows")]
|
||||
public BoolProperty FancyzonesVirtualDesktopChangeMoveWindows { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_appLastZone_moveWindows")]
|
||||
public BoolProperty FancyzonesAppLastZoneMoveWindows { get; set; }
|
||||
|
||||
[JsonPropertyName("use_cursorpos_editor_startupscreen")]
|
||||
public BoolProperty UseCursorposEditorStartupscreen { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_show_on_all_monitors")]
|
||||
public BoolProperty FancyzonesShowOnAllMonitors { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_zoneHighlightColor")]
|
||||
public StringProperty FancyzonesZoneHighlightColor { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_highlight_opacity")]
|
||||
public IntProperty FancyzonesHighlightOpacity { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_editor_hotkey")]
|
||||
public KeyBoardKeysProperty FancyzonesEditorHotkey { get; set; }
|
||||
|
||||
[JsonPropertyName("fancyzones_excluded_apps")]
|
||||
public StringProperty FancyzonesExcludedApps { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class FancyZonesSettings
|
||||
{
|
||||
public FancyZonesSettings()
|
||||
{
|
||||
this.Version = string.Empty;
|
||||
this.Name = string.Empty;
|
||||
this.Properties = new FZConfigProperties();
|
||||
}
|
||||
|
||||
[JsonPropertyName("version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public FZConfigProperties Properties { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,44 +3,57 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class GeneralSettings
|
||||
{
|
||||
// Gets or sets a value indicating whether packaged.
|
||||
[JsonPropertyName("packaged")]
|
||||
public bool Packaged { get; set; }
|
||||
|
||||
// Gets or sets a value indicating whether run powertoys on start-up.
|
||||
public bool startup { get; set; }
|
||||
[JsonPropertyName("startup")]
|
||||
public bool Startup { get; set; }
|
||||
|
||||
// Gets or sets a value indicating whether the powertoy elevated.
|
||||
public bool is_elevated { get; set; }
|
||||
[JsonPropertyName("is_elevated")]
|
||||
public bool IsElevated { get; set; }
|
||||
|
||||
// Gets or sets a value indicating whether powertoys should run elevated.
|
||||
public bool run_elevated { get; set; }
|
||||
[JsonPropertyName("run_elevated")]
|
||||
public bool RunElevated { get; set; }
|
||||
|
||||
// Gets or sets a value indicating whether is admin.
|
||||
public bool is_admin { get; set; }
|
||||
[JsonPropertyName("is_admin")]
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
// Gets or sets theme Name.
|
||||
public string theme { get; set; }
|
||||
[JsonPropertyName("theme")]
|
||||
public string Theme { get; set; }
|
||||
|
||||
// Gets or sets system theme name.
|
||||
public string system_theme { get; set; }
|
||||
[JsonPropertyName("system_theme")]
|
||||
public string SystemTheme { get; set; }
|
||||
|
||||
// Gets or sets powertoys version number.
|
||||
public string powertoys_version { get; set; }
|
||||
[JsonPropertyName("powertoys_version")]
|
||||
public string PowertoysVersion { get; set; }
|
||||
|
||||
[JsonPropertyName("enabled")]
|
||||
public EnabledModules Enabled { get; set; }
|
||||
|
||||
public GeneralSettings()
|
||||
{
|
||||
Packaged = false;
|
||||
startup = false;
|
||||
is_admin = false;
|
||||
is_elevated = false;
|
||||
theme = "system";
|
||||
system_theme = "light";
|
||||
powertoys_version = "v0.15.3";
|
||||
this.Packaged = false;
|
||||
this.Startup = false;
|
||||
this.IsAdmin = false;
|
||||
this.IsElevated = false;
|
||||
this.Theme = "system";
|
||||
this.SystemTheme = "light";
|
||||
this.PowertoysVersion = "v0.15.3";
|
||||
this.Enabled = new EnabledModules();
|
||||
}
|
||||
|
||||
// converts the current to a json string.
|
||||
|
||||
@@ -3,48 +3,65 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class HotkeySettings
|
||||
{
|
||||
public bool win { get; set; }
|
||||
public HotkeySettings()
|
||||
{
|
||||
this.Win = false;
|
||||
this.Ctrl = false;
|
||||
this.Alt = false;
|
||||
this.Shift = false;
|
||||
this.Key = string.Empty;
|
||||
this.Code = 0;
|
||||
}
|
||||
|
||||
public bool ctrl { get; set; }
|
||||
[JsonPropertyName("win")]
|
||||
public bool Win { get; set; }
|
||||
|
||||
public bool alt { get; set; }
|
||||
[JsonPropertyName("ctrl")]
|
||||
public bool Ctrl { get; set; }
|
||||
|
||||
public bool shift { get; set; }
|
||||
[JsonPropertyName("alt")]
|
||||
public bool Alt { get; set; }
|
||||
|
||||
public string key { get; set; }
|
||||
[JsonPropertyName("shift")]
|
||||
public bool Shift { get; set; }
|
||||
|
||||
public int code { get; set; }
|
||||
[JsonPropertyName("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonPropertyName("code")]
|
||||
public int Code { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
if (win)
|
||||
if (Win)
|
||||
{
|
||||
output.Append("Win + ");
|
||||
}
|
||||
|
||||
if (ctrl)
|
||||
if (Ctrl)
|
||||
{
|
||||
output.Append("Ctrl + ");
|
||||
}
|
||||
|
||||
if (alt)
|
||||
if (Alt)
|
||||
{
|
||||
output.Append("Alt + ");
|
||||
}
|
||||
|
||||
if (shift)
|
||||
if (Shift)
|
||||
{
|
||||
output.Append("Shift + ");
|
||||
}
|
||||
|
||||
output.Append(key);
|
||||
output.Append(Key);
|
||||
return output.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,21 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
// Represents the configuration property of the settings that store Integer type.
|
||||
public class IntProperty
|
||||
{
|
||||
public IntProperty()
|
||||
{
|
||||
this.Value = 0;
|
||||
}
|
||||
|
||||
// Gets or sets the integer value of the settings configuration.
|
||||
public int value { get; set; }
|
||||
[JsonPropertyName("value")]
|
||||
public int Value { get; set; }
|
||||
|
||||
// Returns a JSON version of the class settings configuration class.
|
||||
public override string ToString()
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class KeyBoardKeysProperty
|
||||
{
|
||||
public KeyBoardKeysProperty()
|
||||
{
|
||||
this.Value = new HotkeySettings();
|
||||
}
|
||||
|
||||
[JsonPropertyName("value")]
|
||||
public HotkeySettings Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class SndFancyZonesSettings
|
||||
{
|
||||
public FancyZonesSettings FancyZones { get; set; }
|
||||
|
||||
public SndFancyZonesSettings(FancyZonesSettings settings)
|
||||
{
|
||||
this.FancyZones = settings;
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
// Represents the configuration property of the settings that store string type.
|
||||
public class StringProperty
|
||||
{
|
||||
public StringProperty()
|
||||
{
|
||||
this.Value = string.Empty;
|
||||
}
|
||||
|
||||
// Gets or sets the integer value of the settings configuration.
|
||||
[JsonPropertyName("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
// Returns a JSON version of the class settings configuration class.
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user