mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-22 14:39:42 +01:00
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Adds new "Off" mode for the schedule mode options which disable the schedule. Adds explicit function to disable light switch by default. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist Closes: - #42402 New behavior: "Off" mode added. when off, the regular service loop stops and all actions are event driven to either resume the loop or listen for hotkey. - #42386 New behavior: Disabled explicitly by default - #42389 New behavior: When switching from dark to light mode the system theme will remove the accent color. - #42513 New behavior: Manual mode no longer gets reset. It was being overridden by the sun calculations that were invertedly running when in manual mode. Todo: - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx @alvinashcraft we will need to add this new mode to the documentation. ## Validation Steps Performed - Removed all default settings and tested new logic. Light Switch is set to off by default. - Updated UI and tested new "Off" mode, logs indicate mode switched and ticker stopped. Polling resumes on mode change. (need to check that the shortcut still works) --------- Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com>
67 lines
2.6 KiB
C#
67 lines
2.6 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.Text.Json.Serialization;
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
|
{
|
|
public class LightSwitchProperties
|
|
{
|
|
public const bool DefaultChangeSystem = true;
|
|
public const bool DefaultChangeApps = true;
|
|
public const int DefaultLightTime = 480;
|
|
public const int DefaultDarkTime = 1200;
|
|
public const int DefaultSunriseOffset = 0;
|
|
public const int DefaultSunsetOffset = 0;
|
|
public const string DefaultLatitude = "0.0";
|
|
public const string DefaultLongitude = "0.0";
|
|
public const string DefaultScheduleMode = "Off";
|
|
public static readonly HotkeySettings DefaultToggleThemeHotkey = new HotkeySettings(true, true, false, true, 0x44); // Ctrl+Win+Shift+D
|
|
|
|
public LightSwitchProperties()
|
|
{
|
|
ChangeSystem = new BoolProperty(DefaultChangeSystem);
|
|
ChangeApps = new BoolProperty(DefaultChangeApps);
|
|
LightTime = new IntProperty(DefaultLightTime);
|
|
DarkTime = new IntProperty(DefaultDarkTime);
|
|
Latitude = new StringProperty(DefaultLatitude);
|
|
Longitude = new StringProperty(DefaultLongitude);
|
|
SunriseOffset = new IntProperty(DefaultSunriseOffset);
|
|
SunsetOffset = new IntProperty(DefaultSunsetOffset);
|
|
ScheduleMode = new StringProperty(DefaultScheduleMode);
|
|
ToggleThemeHotkey = new KeyboardKeysProperty(DefaultToggleThemeHotkey);
|
|
}
|
|
|
|
[JsonPropertyName("changeSystem")]
|
|
public BoolProperty ChangeSystem { get; set; }
|
|
|
|
[JsonPropertyName("changeApps")]
|
|
public BoolProperty ChangeApps { get; set; }
|
|
|
|
[JsonPropertyName("lightTime")]
|
|
public IntProperty LightTime { get; set; }
|
|
|
|
[JsonPropertyName("darkTime")]
|
|
public IntProperty DarkTime { get; set; }
|
|
|
|
[JsonPropertyName("sunrise_offset")]
|
|
public IntProperty SunriseOffset { get; set; }
|
|
|
|
[JsonPropertyName("sunset_offset")]
|
|
public IntProperty SunsetOffset { get; set; }
|
|
|
|
[JsonPropertyName("latitude")]
|
|
public StringProperty Latitude { get; set; }
|
|
|
|
[JsonPropertyName("longitude")]
|
|
public StringProperty Longitude { get; set; }
|
|
|
|
[JsonPropertyName("scheduleMode")]
|
|
public StringProperty ScheduleMode { get; set; }
|
|
|
|
[JsonPropertyName("toggle-theme-hotkey")]
|
|
public KeyboardKeysProperty ToggleThemeHotkey { get; set; }
|
|
}
|
|
}
|