mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[AlwaysOnTop] Proof of concept (#14360)
Co-authored-by: Niels Laute <niels.laute@live.nl>
This commit is contained in:
@@ -62,6 +62,7 @@ namespace PowerToys.Settings
|
||||
switch (args[(int)Arguments.SettingsWindow])
|
||||
{
|
||||
case "Overview": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.GeneralPage); break;
|
||||
case "AlwaysOnTop": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.AlwaysOnTopPage); break;
|
||||
case "Awake": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.AwakePage); break;
|
||||
case "ColorPicker": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.ColorPickerPage); break;
|
||||
case "FancyZones": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.FancyZonesPage); break;
|
||||
|
||||
57
src/settings-ui/Settings.UI.Library/AlwaysOnTopProperties.cs
Normal file
57
src/settings-ui/Settings.UI.Library/AlwaysOnTopProperties.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
// Needs to be kept in sync with src\modules\alwaysontop\AlwaysOnTop\Settings.h
|
||||
public class AlwaysOnTopProperties
|
||||
{
|
||||
public static readonly HotkeySettings DefaultHotkeyValue = new HotkeySettings(true, true, false, false, 0x54);
|
||||
public const bool DefaultFrameEnabled = true;
|
||||
public const int DefaultFrameThickness = 15;
|
||||
public const string DefaultFrameColor = "#0099cc";
|
||||
public const bool DefaultSoundEnabled = true;
|
||||
public const bool DefaultDoNotActivateOnGameMode = true;
|
||||
|
||||
public AlwaysOnTopProperties()
|
||||
{
|
||||
Hotkey = new KeyboardKeysProperty(DefaultHotkeyValue);
|
||||
FrameEnabled = new BoolProperty(DefaultFrameEnabled);
|
||||
FrameThickness = new IntProperty(DefaultFrameThickness);
|
||||
FrameColor = new StringProperty(DefaultFrameColor);
|
||||
SoundEnabled = new BoolProperty(DefaultSoundEnabled);
|
||||
DoNotActivateOnGameMode = new BoolProperty(DefaultDoNotActivateOnGameMode);
|
||||
ExcludedApps = new StringProperty();
|
||||
}
|
||||
|
||||
[JsonPropertyName("hotkey")]
|
||||
public KeyboardKeysProperty Hotkey { get; set; }
|
||||
|
||||
[JsonPropertyName("frame-enabled")]
|
||||
public BoolProperty FrameEnabled { get; set; }
|
||||
|
||||
[JsonPropertyName("frame-thickness")]
|
||||
public IntProperty FrameThickness { get; set; }
|
||||
|
||||
[JsonPropertyName("frame-color")]
|
||||
public StringProperty FrameColor { get; set; }
|
||||
|
||||
[JsonPropertyName("sound-enabled")]
|
||||
public BoolProperty SoundEnabled { get; set; }
|
||||
|
||||
[JsonPropertyName("do-not-activate-on-game-mode")]
|
||||
public BoolProperty DoNotActivateOnGameMode { get; set; }
|
||||
|
||||
[JsonPropertyName("excluded-apps")]
|
||||
public StringProperty ExcludedApps { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/settings-ui/Settings.UI.Library/AlwaysOnTopSettings.cs
Normal file
35
src/settings-ui/Settings.UI.Library/AlwaysOnTopSettings.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class AlwaysOnTopSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "AlwaysOnTop";
|
||||
public const string ModuleVersion = "0.0.1";
|
||||
|
||||
public AlwaysOnTopSettings()
|
||||
{
|
||||
Name = ModuleName;
|
||||
Version = ModuleVersion;
|
||||
Properties = new AlwaysOnTopProperties();
|
||||
}
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public AlwaysOnTopProperties Properties { get; set; }
|
||||
|
||||
public string GetModuleName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool alwaysOnTop = true;
|
||||
|
||||
[JsonPropertyName("AlwaysOnTop")]
|
||||
public bool AlwaysOnTop
|
||||
{
|
||||
get => alwaysOnTop;
|
||||
set
|
||||
{
|
||||
if (alwaysOnTop != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
alwaysOnTop = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
{
|
||||
public class AlwaysOnTopViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
private AlwaysOnTopSettings Settings { get; set; }
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
public AlwaysOnTopViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AlwaysOnTopSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||
{
|
||||
if (settingsUtils == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settingsUtils));
|
||||
}
|
||||
|
||||
SettingsUtils = settingsUtils;
|
||||
|
||||
// To obtain the general settings configurations of PowerToys Settings.
|
||||
if (settingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settingsRepository));
|
||||
}
|
||||
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
// To obtain the settings configurations of AlwaysOnTop.
|
||||
if (moduleSettingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(moduleSettingsRepository));
|
||||
}
|
||||
|
||||
Settings = moduleSettingsRepository.SettingsConfig;
|
||||
|
||||
_isEnabled = GeneralSettingsConfig.Enabled.AlwaysOnTop;
|
||||
_hotkey = Settings.Properties.Hotkey.Value;
|
||||
_frameEnabled = Settings.Properties.FrameEnabled.Value;
|
||||
_frameThickness = Settings.Properties.FrameThickness.Value;
|
||||
_frameColor = Settings.Properties.FrameColor.Value;
|
||||
_soundEnabled = Settings.Properties.SoundEnabled.Value;
|
||||
_doNotActivateOnGameMode = Settings.Properties.DoNotActivateOnGameMode.Value;
|
||||
_excludedApps = Settings.Properties.ExcludedApps.Value;
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _isEnabled)
|
||||
{
|
||||
_isEnabled = value;
|
||||
|
||||
// Set the status in the general settings configuration
|
||||
GeneralSettingsConfig.Enabled.AlwaysOnTop = value;
|
||||
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
|
||||
SendConfigMSG(snd.ToString());
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings Hotkey
|
||||
{
|
||||
get => _hotkey;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _hotkey)
|
||||
{
|
||||
if (value == null || value.IsEmpty())
|
||||
{
|
||||
_hotkey = AlwaysOnTopProperties.DefaultHotkeyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hotkey = value;
|
||||
}
|
||||
|
||||
Settings.Properties.Hotkey.Value = _hotkey;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool FrameEnabled
|
||||
{
|
||||
get => _frameEnabled;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _frameEnabled)
|
||||
{
|
||||
_frameEnabled = value;
|
||||
Settings.Properties.FrameEnabled.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int FrameThickness
|
||||
{
|
||||
get => _frameThickness;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _frameThickness)
|
||||
{
|
||||
_frameThickness = value;
|
||||
Settings.Properties.FrameThickness.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string FrameColor
|
||||
{
|
||||
get => _frameColor;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _frameColor)
|
||||
{
|
||||
_frameColor = value;
|
||||
Settings.Properties.FrameColor.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool SoundEnabled
|
||||
{
|
||||
get => _soundEnabled;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _soundEnabled)
|
||||
{
|
||||
_soundEnabled = value;
|
||||
Settings.Properties.SoundEnabled.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool DoNotActivateOnGameMode
|
||||
{
|
||||
get => _doNotActivateOnGameMode;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _doNotActivateOnGameMode)
|
||||
{
|
||||
_doNotActivateOnGameMode = value;
|
||||
Settings.Properties.DoNotActivateOnGameMode.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ExcludedApps
|
||||
{
|
||||
get => _excludedApps;
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _excludedApps)
|
||||
{
|
||||
_excludedApps = value;
|
||||
Settings.Properties.ExcludedApps.Value = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
SettingsUtils.SaveSettings(Settings.ToJsonString(), AlwaysOnTopSettings.ModuleName);
|
||||
}
|
||||
|
||||
private bool _isEnabled;
|
||||
private HotkeySettings _hotkey;
|
||||
private bool _frameEnabled;
|
||||
private int _frameThickness;
|
||||
private string _frameColor;
|
||||
private bool _soundEnabled;
|
||||
private bool _doNotActivateOnGameMode;
|
||||
private string _excludedApps;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
src/settings-ui/Settings.UI/Assets/Modules/AlwaysOnTop.png
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Modules/AlwaysOnTop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
src/settings-ui/Settings.UI/Assets/Modules/OOBE/AlwaysOnTop.png
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Modules/OOBE/AlwaysOnTop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
@@ -7,6 +7,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
public enum PowerToysModulesEnum
|
||||
{
|
||||
Overview = 0,
|
||||
AlwaysOnTop,
|
||||
Awake,
|
||||
ColorPicker,
|
||||
FancyZones,
|
||||
|
||||
41
src/settings-ui/Settings.UI/OOBE/Views/OobeAlwaysOnTop.xaml
Normal file
41
src/settings-ui/Settings.UI/OOBE/Views/OobeAlwaysOnTop.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeAlwaysOnTop"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls">
|
||||
|
||||
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
|
||||
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
|
||||
ModuleDescription="{x:Bind ViewModel.Description}">
|
||||
|
||||
<controls:OOBEPageControl.ModuleContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
Style="{ThemeResource OobeSubtitleStyle}" />
|
||||
|
||||
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_AlwaysOnTop_HowToUse" />
|
||||
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{ThemeResource OobeSubtitleStyle}"/>
|
||||
|
||||
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_AlwaysOnTop_TipsAndTricks" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
|
||||
<Button x:Uid="OOBE_Settings"
|
||||
Click="SettingsLaunchButton_Click"/>
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Style="{StaticResource TextButtonStyle}">
|
||||
<TextBlock x:Uid="LearnMore_AlwaysOnTop"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</controls:OOBEPageControl.ModuleContent>
|
||||
</controls:OOBEPageControl>
|
||||
</Page>
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
public sealed partial class OobeAlwaysOnTop : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeAlwaysOnTop()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.AlwaysOnTop]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(AlwaysOnTopPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
HotkeyControl.Keys = SettingsRepository<AlwaysOnTopSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.Hotkey.Value.GetKeysList();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,18 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
DescriptionLink = "https://aka.ms/PowerToysOverview",
|
||||
Link = "https://github.com/microsoft/PowerToys/releases/",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.AlwaysOnTop, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_AlwaysOnTop"),
|
||||
Tag = "AlwaysOnTop",
|
||||
IsNew = true,
|
||||
Icon = "\uEC32",
|
||||
Image = "ms-appx:///Assets/Modules/AlwaysOnTop.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsAlwaysOnTop.png",
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/AlwaysOnTop.png",
|
||||
Description = loader.GetString("Oobe_AlwaysOnTop_Description"),
|
||||
Link = "https://aka.ms/PowerToysOverview_AlwaysOnTop",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.Awake, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_Awake"),
|
||||
@@ -230,6 +242,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
switch (selectedItem.Tag)
|
||||
{
|
||||
case "Overview": NavigationFrame.Navigate(typeof(OobeOverview)); break;
|
||||
case "AlwaysOnTop": NavigationFrame.Navigate(typeof(OobeAlwaysOnTop)); break;
|
||||
case "Awake": NavigationFrame.Navigate(typeof(OobeAwake)); break;
|
||||
case "ColorPicker": NavigationFrame.Navigate(typeof(OobeColorPicker)); break;
|
||||
case "FancyZones": NavigationFrame.Navigate(typeof(OobeFancyZones)); break;
|
||||
|
||||
@@ -143,6 +143,9 @@
|
||||
<Compile Include="OOBE\Enums\PowerToysModulesEnum.cs" />
|
||||
<Compile Include="OOBE\ViewModel\OobeShellViewModel.cs" />
|
||||
<Compile Include="OOBE\ViewModel\OobePowerToysModule.cs" />
|
||||
<Compile Include="OOBE\Views\OobeAlwaysOnTop.xaml.cs">
|
||||
<DependentUpon>OobeAlwaysOnTop.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeAwake.xaml.cs">
|
||||
<DependentUpon>OobeAwake.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -186,6 +189,9 @@
|
||||
<Compile Include="Services\NavigationService.cs" />
|
||||
<Compile Include="ViewModels\Commands\ButtonClickCommand.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="Views\AlwaysOnTopPage.xaml.cs">
|
||||
<DependentUpon>AlwaysOnTopPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\AwakePage.xaml.cs">
|
||||
<DependentUpon>AwakePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -233,6 +239,7 @@
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\FluentIcons\FluentIconsAlwaysOnTop.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsColorPicker.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsAwake.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFancyZones.png" />
|
||||
@@ -250,12 +257,14 @@
|
||||
<Content Include="Assets\FluentIcons\FluentIconsShortcutGuide.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsVideoConferenceMute.png" />
|
||||
<Content Include="Assets\Logo.scale-200.png" />
|
||||
<Content Include="Assets\Modules\AlwaysOnTop.png" />
|
||||
<Content Include="Assets\Modules\ColorPicker.png" />
|
||||
<Content Include="Assets\Modules\Awake.png" />
|
||||
<Content Include="Assets\Modules\FancyZones.png" />
|
||||
<Content Include="Assets\Modules\ImageResizer.png" />
|
||||
<Content Include="Assets\Modules\KBM.png" />
|
||||
<Content Include="Assets\Modules\MouseUtils.png" />
|
||||
<Content Include="Assets\Modules\OOBE\AlwaysOnTop.png" />
|
||||
<Content Include="Assets\Modules\OOBE\ColorPicker.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\Awake.png" />
|
||||
<Content Include="Assets\Modules\OOBE\FancyZones.gif" />
|
||||
@@ -368,6 +377,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeAlwaysOnTop.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeAwake.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -440,6 +453,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\AlwaysOnTopPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\AwakePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -1185,10 +1185,10 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
<data name="PowerLauncher_EnablePluginToggle.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Enable plugin</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_EnablePluginToggle.OnContent" xml:space="preserve">
|
||||
<data name="PowerLauncher_EnablePluginToggle.OnContent" xml:space="preserve">
|
||||
<value>On</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_EnablePluginToggle.OffContent" xml:space="preserve">
|
||||
<data name="PowerLauncher_EnablePluginToggle.OffContent" xml:space="preserve">
|
||||
<value>Off</value>
|
||||
</data>
|
||||
<data name="Run_AdditionalOptions.Text" xml:space="preserve">
|
||||
@@ -1550,7 +1550,7 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
|
||||
<data name="EditButton.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Edit</value>
|
||||
</data>
|
||||
<data name="ImageResizer_EditSize.AutomationProperties.Name" xml:space="preserve">
|
||||
<data name="ImageResizer_EditSize.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Edit size</value>
|
||||
</data>
|
||||
<data name="No" xml:space="preserve">
|
||||
@@ -1870,4 +1870,83 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
|
||||
<value>On</value>
|
||||
<comment>The state of a ToggleSwitch when it's on</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop.ModuleDescription" xml:space="preserve">
|
||||
<value>Always On Top is a quick and easy way to pin windows on top.</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop.ModuleTitle" xml:space="preserve">
|
||||
<value>Always On Top </value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_Activation_GroupSettings.Header" xml:space="preserve">
|
||||
<value>Activation</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_EnableToggleControl_HeaderText.Header" xml:space="preserve">
|
||||
<value>Enable Always On Top</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_ExcludedApps.Description" xml:space="preserve">
|
||||
<value>Excludes an application from pinning on top</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_ExcludedApps.Header" xml:space="preserve">
|
||||
<value>Excluded apps</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_ExcludedApps_TextBoxControl.PlaceholderText" xml:space="preserve">
|
||||
<value>Example: outlook.exe</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_FrameColor.Header" xml:space="preserve">
|
||||
<value>Color</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_FrameEnabled.Header" xml:space="preserve">
|
||||
<value>Show a border around the pinned window</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_FrameThickness.Header" xml:space="preserve">
|
||||
<value>Thickness (px)</value>
|
||||
<comment>px = pixels</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_Behavior_GroupSettings.Header" xml:space="preserve">
|
||||
<value>Appearance & behavior</value>
|
||||
</data>
|
||||
<data name="Shell_AlwaysOnTop.Content" xml:space="preserve">
|
||||
<value>Always On Top</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_GameMode.Content" xml:space="preserve">
|
||||
<value>Do not activate when Game Mode is on</value>
|
||||
<comment>Game Mode is a Windows feature</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_SoundTitle.Header" xml:space="preserve">
|
||||
<value>Sound</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_Sound.Content" xml:space="preserve">
|
||||
<value>Play a sound when pinning a window</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_Behavior.Header" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="LearnMore_AlwaysOnTop.Text" xml:space="preserve">
|
||||
<value>Learn more about Always On Top</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_ActivationShortcut.Header" xml:space="preserve">
|
||||
<value>Activation shortcut</value>
|
||||
</data>
|
||||
<data name="AlwaysOnTop_ActivationShortcut.Description" xml:space="preserve">
|
||||
<value>Customize the shortcut to pin or unpin an app window</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="Oobe_AlwaysOnTop" xml:space="preserve">
|
||||
<value>Always On Top</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="Oobe_AlwaysOnTop_Description" xml:space="preserve">
|
||||
<value>Always On Top improves your multitasking workflow by pinning an application window so it's always in front - even when focus changes to another window after that.</value>
|
||||
<comment>"Always On Top" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="Oobe_AlwaysOnTop_HowToUse.Text" xml:space="preserve">
|
||||
<value>to pin or unpin the selected window so it's always on top of all other windows.</value>
|
||||
</data>
|
||||
<data name="Oobe_AlwaysOnTop_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>You can tweak the visual outline of the pinned windows in PowerToys settings.</value>
|
||||
</data>
|
||||
</root>
|
||||
112
src/settings-ui/Settings.UI/Views/AlwaysOnTopPage.xaml
Normal file
112
src/settings-ui/Settings.UI/Views/AlwaysOnTopPage.xaml
Normal file
@@ -0,0 +1,112 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.AlwaysOnTopPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
<controls:SettingsPageControl x:Uid="AlwaysOnTop" IsTabStop="False"
|
||||
ModuleImageSource="ms-appx:///Assets/Modules/AlwaysOnTop.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<controls:Setting x:Uid="AlwaysOnTop_EnableToggleControl_HeaderText">
|
||||
<controls:Setting.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsAlwaysOnTop.png" ShowAsMonochrome="False" />
|
||||
</controls:Setting.Icon>
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<controls:SettingsGroup x:Uid="AlwaysOnTop_Activation_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
|
||||
<controls:SettingExpander IsExpanded="True">
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting x:Uid="AlwaysOnTop_ActivationShortcut" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.Hotkey, Mode=TwoWay}"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingExpander.Header>
|
||||
<controls:SettingExpander.Content>
|
||||
<StackPanel>
|
||||
<CheckBox IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DoNotActivateOnGameMode}" x:Uid="AlwaysOnTop_GameMode" Margin="{StaticResource ExpanderSettingMargin}"/>
|
||||
</StackPanel>
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="AlwaysOnTop_Behavior_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<controls:SettingExpander IsExpanded="True">
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting Icon="" Style="{StaticResource ExpanderHeaderSettingStyle}" x:Uid="AlwaysOnTop_FrameEnabled">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.FrameEnabled}" x:Uid="ToggleSwitch"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingExpander.Header>
|
||||
<controls:SettingExpander.Content>
|
||||
<StackPanel>
|
||||
<controls:Setting x:Uid="AlwaysOnTop_FrameColor" Style="{StaticResource ExpanderContentSettingStyle}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.FrameEnabled}">
|
||||
<controls:Setting.ActionContent>
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FrameColor, Mode=TwoWay}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<controls:Setting x:Uid="AlwaysOnTop_FrameThickness" Style="{StaticResource ExpanderContentSettingStyle}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.FrameEnabled}">
|
||||
<controls:Setting.ActionContent>
|
||||
<Slider Value="{x:Bind ViewModel.FrameThickness, Mode=TwoWay}"
|
||||
Minimum="0"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
HorizontalAlignment="Right"
|
||||
Maximum="30"
|
||||
SmallChange="1"
|
||||
LargeChange="5"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</StackPanel>
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
|
||||
<controls:SettingExpander IsExpanded="True">
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting Style="{StaticResource ExpanderHeaderSettingStyle}" x:Uid="AlwaysOnTop_SoundTitle" Icon=""/>
|
||||
</controls:SettingExpander.Header>
|
||||
<controls:SettingExpander.Content>
|
||||
<StackPanel>
|
||||
<CheckBox IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.SoundEnabled}" x:Uid="AlwaysOnTop_Sound" Margin="{StaticResource ExpanderSettingMargin}"/>
|
||||
</StackPanel>
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="ExcludedApps" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<controls:SettingExpander IsExpanded="True">
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting x:Uid="AlwaysOnTop_ExcludedApps" Icon="" Style="{StaticResource ExpanderHeaderSettingStyle}"/>
|
||||
</controls:SettingExpander.Header>
|
||||
<controls:SettingExpander.Content>
|
||||
<TextBox x:Uid="FancyZones_ExcludedApps_TextBoxControl"
|
||||
Margin="{StaticResource ExpanderSettingMargin}"
|
||||
Text="{x:Bind Mode=TwoWay, Path=ViewModel.ExcludedApps, UpdateSourceTrigger=PropertyChanged}"
|
||||
ScrollViewer.VerticalScrollBarVisibility ="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
TextWrapping="Wrap"
|
||||
AcceptsReturn="True"
|
||||
MinWidth="240"
|
||||
MinHeight="160" />
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink x:Uid="LearnMore_AlwaysOnTop" Link="https://aka.ms/PowerToysOverview_AlwaysOnTop"/>
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
23
src/settings-ui/Settings.UI/Views/AlwaysOnTopPage.xaml.cs
Normal file
23
src/settings-ui/Settings.UI/Views/AlwaysOnTopPage.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class AlwaysOnTopPage : Page
|
||||
{
|
||||
private AlwaysOnTopViewModel ViewModel { get; set; }
|
||||
|
||||
public AlwaysOnTopPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new AlwaysOnTopViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), SettingsRepository<AlwaysOnTopSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,14 @@
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Shell_AlwaysOnTop"
|
||||
helpers:NavHelper.NavigateTo="views:AlwaysOnTopPage">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsAlwaysOnTop.png"
|
||||
ShowAsMonochrome="False" />
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Shell_Awake"
|
||||
helpers:NavHelper.NavigateTo="views:AwakePage">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
|
||||
Reference in New Issue
Block a user