mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
* Init EnvironmentVariables UI project * Models TitleBar MainPage init Icon * User and system variables * Profiles init * XAML cleanup * Missing ItemTemplate * EditDialog * ModuleInterface * Signing and processes lists * Installer * spellcheck * Fix ARM64 build and consolidate packages * spellcheck2 * Fix installer * Single instance. C# telemetry. Wait on PT pid * ElevationHelper * Add profile wip * Init EnvironmentVariables UI project * Models TitleBar MainPage init Icon * User and system variables * Profiles init * XAML cleanup * Missing ItemTemplate * EditDialog * ModuleInterface * Signing and processes lists * Installer * spellcheck * Fix ARM64 build and consolidate packages * spellcheck2 * Fix installer * Single instance. C# telemetry. Wait on PT pid * ElevationHelper * Add profile wip * show run as administrator in title (#28516) * Environment Variables added to Run plugin (#28466) * UI tweaks * Remove style * Add profile - init working * Applied variables * Read/Write profiles * Fixes * Add separator and fix loading profiles * Only allow to edit System vars if running elevated * Add tmp progress ring to show applying changes progress Ignore not needed json fields * Remove variable and profile logic * Do not read data async Update System and User variables on change * Add isCorrectlyApplied() * Sort variables in Applied variables * WIP WndProc * spellcheck * Revert "WIP WndProc" This reverts commit0c0b6c67de. * WHY CRASH??? * UI tweaks * WIP modified state warning * Add cancel button in dialogs * Add buttons validations * Set variables - fire and forget notify * Revert "Revert "WIP WndProc"" This reverts commit1b2306eeb7. * Listen to WM_SETTINGSCHANGED Add Infobar reload button * spellcheck * spellcheck again * Fix build * InfoBar runAsAdmin visibility * Fix comment * Confirm dialog when deleting variable Fix add variable button when creating profile * Edit profile * Sort variables on Load * Select existing variables on edit * Add default variable * Fix adding existing vars to profile * update notice.md * Handle PATH properly * Add tooltips and fix dialogs text wrapping * Fix applied values for duplicates Fix add/eddit variable txt box validation * Add horizontal scroll bar for applied values * Fix duplicate variables handling Fix user variable handling and preview * spellcheck * Try fix spellcheck * Revert "spellcheck" This reverts commitee76231974. * Revert "Try fix spellcheck" This reverts commitdc8f04afb9. * Fix path and duplicates conflict * Fix PATH handling Fix unapply on delete active variable Fix ordering in applied variables * Show variables as lists and add drag-to-reorder feature * Only show specific variables as list Update list in edit dialog on editing the value * spellcheck * Update GPO policy * Add Edit and Remove variable buttons Remove context menu * Remove drag&drop when editing list variable and add buttons to move up/down * Fix Edit profile dialog title * Fix backup and restore variables when editing variable from applied profile * Apply var to system WIP * Tweaks * Simplify edit variable logic * Minor fixes * Spellcheck * Update src/modules/EnvironmentVariables/EnvironmentVariables/app.manifest Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> * spellcheck 2 * Remove unneeded string * Add more telemetry * Do not allow adding existing variables with the same name into the profile * Adding icon * Fix the crash when opening existing variables dialog * Update Settings and OOBE screenshots * Fix crash when malformed profiles.json and jsonignore not needed properties * Fix selecting duplicates in existing variables dialog * Add user variable name limit (<255 chars) Check if profile is applicable on apply Show message if profile is not applicable * XamlStyling * Better Flyout positioning Add Cancel button to the flyout * Fix UI glitches by using ItemsControl (no virtualization) * Fix spellcheck * Fix XAML style * Add horizontal scrollbar to applied variables * Revert to ItemsRepeater * Fix UI glitches by adding a decent minimum cache * Fixing UI bugs * Fix spellcheck * Fix crash while trying to edit a User variable when there's no Parent profile * Fix issue overwriting backup var when you edit var on applied profile * Fix nuking of variables when adding to applied profile * Fix profile not being saved when deleting a variable * Fix ValuesList empty crash, issues and no serialization * fix spellcheck * Allow in-line edit of list variables * Fix xaml style * Fix add profile variable cancel button logic * Fix add profile variable cancel button logic - clean the list * Bump VerticalCacheLength to 10 as in some cases UI glitch on expanding System variables was still present * Fix profile Add variable button enable/disable logic * Remove unneeded using * Add to Dashboard --------- Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
472 lines
11 KiB
C#
472 lines
11 KiB
C#
// 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.Runtime.CompilerServices;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using Microsoft.PowerToys.Settings.Telemetry;
|
|
using Microsoft.PowerToys.Telemetry;
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
|
{
|
|
public class EnabledModules
|
|
{
|
|
private Action notifyEnabledChangedAction;
|
|
|
|
public EnabledModules()
|
|
{
|
|
}
|
|
|
|
private bool fancyZones = true;
|
|
|
|
[JsonPropertyName("FancyZones")]
|
|
public bool FancyZones
|
|
{
|
|
get => fancyZones;
|
|
set
|
|
{
|
|
if (fancyZones != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
fancyZones = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool imageResizer = true;
|
|
|
|
[JsonPropertyName("Image Resizer")]
|
|
public bool ImageResizer
|
|
{
|
|
get => imageResizer;
|
|
set
|
|
{
|
|
if (imageResizer != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
imageResizer = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool fileExplorerPreview = true;
|
|
|
|
[JsonPropertyName("File Explorer Preview")]
|
|
public bool FileExplorerPreview
|
|
{
|
|
get => fileExplorerPreview;
|
|
set
|
|
{
|
|
if (fileExplorerPreview != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
fileExplorerPreview = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool shortcutGuide = true;
|
|
|
|
[JsonPropertyName("Shortcut Guide")]
|
|
public bool ShortcutGuide
|
|
{
|
|
get => shortcutGuide;
|
|
set
|
|
{
|
|
if (shortcutGuide != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
shortcutGuide = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool videoConference; // defaulting to off https://github.com/microsoft/PowerToys/issues/14507
|
|
|
|
[JsonPropertyName("Video Conference")]
|
|
public bool VideoConference
|
|
{
|
|
get => this.videoConference;
|
|
set
|
|
{
|
|
if (this.videoConference != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
this.videoConference = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool powerRename = true;
|
|
|
|
public bool PowerRename
|
|
{
|
|
get => powerRename;
|
|
set
|
|
{
|
|
if (powerRename != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
powerRename = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool keyboardManager = true;
|
|
|
|
[JsonPropertyName("Keyboard Manager")]
|
|
public bool KeyboardManager
|
|
{
|
|
get => keyboardManager;
|
|
set
|
|
{
|
|
if (keyboardManager != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
keyboardManager = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool powerLauncher = true;
|
|
|
|
[JsonPropertyName("PowerToys Run")]
|
|
public bool PowerLauncher
|
|
{
|
|
get => powerLauncher;
|
|
set
|
|
{
|
|
if (powerLauncher != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
powerLauncher = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool colorPicker = true;
|
|
|
|
[JsonPropertyName("ColorPicker")]
|
|
public bool ColorPicker
|
|
{
|
|
get => colorPicker;
|
|
set
|
|
{
|
|
if (colorPicker != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
colorPicker = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool cropAndLock = true;
|
|
|
|
[JsonPropertyName("CropAndLock")]
|
|
public bool CropAndLock
|
|
{
|
|
get => cropAndLock;
|
|
set
|
|
{
|
|
if (cropAndLock != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
cropAndLock = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool awake;
|
|
|
|
[JsonPropertyName("Awake")]
|
|
public bool Awake
|
|
{
|
|
get => awake;
|
|
set
|
|
{
|
|
if (awake != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
awake = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool mouseWithoutBorders = true;
|
|
|
|
[JsonPropertyName("MouseWithoutBorders")]
|
|
public bool MouseWithoutBorders
|
|
{
|
|
get => mouseWithoutBorders;
|
|
set
|
|
{
|
|
if (mouseWithoutBorders != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
mouseWithoutBorders = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool findMyMouse = true;
|
|
|
|
[JsonPropertyName("FindMyMouse")]
|
|
public bool FindMyMouse
|
|
{
|
|
get => findMyMouse;
|
|
set
|
|
{
|
|
if (findMyMouse != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
findMyMouse = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool mouseHighlighter = true;
|
|
|
|
[JsonPropertyName("MouseHighlighter")]
|
|
public bool MouseHighlighter
|
|
{
|
|
get => mouseHighlighter;
|
|
set
|
|
{
|
|
if (mouseHighlighter != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
mouseHighlighter = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool mouseJump = true;
|
|
|
|
[JsonPropertyName("MouseJump")]
|
|
public bool MouseJump
|
|
{
|
|
get => mouseJump;
|
|
set
|
|
{
|
|
if (mouseJump != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
mouseJump = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool alwaysOnTop = true;
|
|
|
|
[JsonPropertyName("AlwaysOnTop")]
|
|
public bool AlwaysOnTop
|
|
{
|
|
get => alwaysOnTop;
|
|
set
|
|
{
|
|
if (alwaysOnTop != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
alwaysOnTop = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool mousePointerCrosshairs = true;
|
|
|
|
[JsonPropertyName("MousePointerCrosshairs")]
|
|
public bool MousePointerCrosshairs
|
|
{
|
|
get => mousePointerCrosshairs;
|
|
set
|
|
{
|
|
if (mousePointerCrosshairs != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
mousePointerCrosshairs = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool powerAccent;
|
|
|
|
[JsonPropertyName("QuickAccent")]
|
|
public bool PowerAccent
|
|
{
|
|
get => powerAccent;
|
|
set
|
|
{
|
|
if (powerAccent != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
powerAccent = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool powerOCR = true;
|
|
|
|
[JsonPropertyName("TextExtractor")]
|
|
public bool PowerOCR
|
|
{
|
|
get => powerOCR;
|
|
set
|
|
{
|
|
if (powerOCR != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
powerOCR = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool pastePlain = true;
|
|
|
|
[JsonPropertyName("PastePlain")]
|
|
public bool PastePlain
|
|
{
|
|
get => pastePlain;
|
|
set
|
|
{
|
|
if (pastePlain != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
pastePlain = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool measureTool = true;
|
|
|
|
[JsonPropertyName("Measure Tool")]
|
|
public bool MeasureTool
|
|
{
|
|
get => measureTool;
|
|
set
|
|
{
|
|
if (measureTool != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
measureTool = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool hosts = true;
|
|
|
|
[JsonPropertyName("Hosts")]
|
|
public bool Hosts
|
|
{
|
|
get => hosts;
|
|
set
|
|
{
|
|
if (hosts != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
hosts = value;
|
|
NotifyChange();
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool fileLocksmith = true;
|
|
|
|
[JsonPropertyName("File Locksmith")]
|
|
public bool FileLocksmith
|
|
{
|
|
get => fileLocksmith;
|
|
set
|
|
{
|
|
if (fileLocksmith != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
fileLocksmith = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool peek = true;
|
|
|
|
[JsonPropertyName("Peek")]
|
|
public bool Peek
|
|
{
|
|
get => peek;
|
|
set
|
|
{
|
|
if (peek != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
peek = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool registryPreview = true;
|
|
|
|
[JsonPropertyName("RegistryPreview")]
|
|
public bool RegistryPreview
|
|
{
|
|
get => registryPreview;
|
|
set
|
|
{
|
|
if (registryPreview != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
registryPreview = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool environmentVariables = true;
|
|
|
|
[JsonPropertyName("EnvironmentVariables")]
|
|
public bool EnvironmentVariables
|
|
{
|
|
get => environmentVariables;
|
|
set
|
|
{
|
|
if (environmentVariables != value)
|
|
{
|
|
LogTelemetryEvent(value);
|
|
environmentVariables = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void NotifyChange()
|
|
{
|
|
notifyEnabledChangedAction?.Invoke();
|
|
}
|
|
|
|
public string ToJsonString()
|
|
{
|
|
return JsonSerializer.Serialize(this);
|
|
}
|
|
|
|
private static void LogTelemetryEvent(bool value, [CallerMemberName] string moduleName = null)
|
|
{
|
|
var dataEvent = new SettingsEnabledEvent()
|
|
{
|
|
Value = value,
|
|
Name = moduleName,
|
|
};
|
|
PowerToysTelemetry.Log.WriteEvent(dataEvent);
|
|
}
|
|
|
|
internal void AddEnabledModuleChangeNotification(Action callBack)
|
|
{
|
|
notifyEnabledChangedAction = callBack;
|
|
}
|
|
}
|
|
}
|