disable apps for shortcut guide (#10123)

This commit is contained in:
Davide Giacometti
2021-04-02 16:29:48 +02:00
committed by GitHub
parent 6561290bde
commit bc28a3f5e3
6 changed files with 152 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
OverlayOpacity = new IntProperty(90);
PressTime = new IntProperty(900);
Theme = new StringProperty("system");
DisabledApps = new StringProperty();
}
[JsonPropertyName("overlay_opacity")]
@@ -23,5 +24,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("theme")]
public StringProperty Theme { get; set; }
[JsonPropertyName("disabled_apps")]
public StringProperty DisabledApps { get; set; }
}
}

View File

@@ -20,6 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private Func<string, int> SendConfigMSG { get; }
private string _settingsConfigFileFolder = string.Empty;
private string _disabledApps;
public ShortcutGuideViewModel(ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<ShortcutGuideSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
@@ -49,6 +50,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_isEnabled = GeneralSettingsConfig.Enabled.ShortcutGuide;
_pressTime = Settings.Properties.PressTime.Value;
_opacity = Settings.Properties.OverlayOpacity.Value;
_disabledApps = Settings.Properties.DisabledApps.Value;
string theme = Settings.Properties.Theme.Value;
@@ -170,6 +172,24 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public string DisabledApps
{
get
{
return _disabledApps;
}
set
{
if (value != _disabledApps)
{
_disabledApps = value;
Settings.Properties.DisabledApps.Value = value;
NotifyPropertyChanged();
}
}
}
public string GetSettingsSubPath()
{
return _settingsConfigFileFolder + "\\" + ModuleName;

View File

@@ -491,6 +491,16 @@
<data name="ShortcutGuide_OverlayOpacity.Header" xml:space="preserve">
<value>Opacity of background</value>
</data>
<data name="ShortcutGuide_DisabledApps.Text" xml:space="preserve">
<value>Disable for apps</value>
</data>
<data name="ShortcutGuide_DisabledApps_TextBoxControl.Header" xml:space="preserve">
<value>Turn off Shortcut Guide when these applications have focus. Add one application name per line.</value>
</data>
<data name="ShortcutGuide_DisabledApps_TextBoxControl.PlaceholderText" xml:space="preserve">
<value>Example: outlook.exe</value>
<comment>Don't translate outlook.exe</comment>
</data>
<data name="ImageResizer_CustomSizes.Text" xml:space="preserve">
<value>Image sizes</value>
</data>
@@ -793,6 +803,7 @@
</data>
<data name="FancyZones_ExcludeApps_TextBoxControl.PlaceholderText" xml:space="preserve">
<value>Example: outlook.exe</value>
<comment>Don't translate outlook.exe</comment>
</data>
<data name="ImageResizer_FilenameFormatPlaceholder.PlaceholderText" xml:space="preserve">
<value>Example: %1 (%2)</value>

View File

@@ -111,6 +111,23 @@
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<TextBlock x:Uid="Windows_Color_Settings" />
</HyperlinkButton>
<TextBlock x:Uid="ShortcutGuide_DisabledApps"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
<TextBox x:Uid="ShortcutGuide_DisabledApps_TextBoxControl"
Margin="{StaticResource SmallTopMargin}"
Text="{x:Bind Mode=TwoWay, Path=ViewModel.DisabledApps}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
ScrollViewer.VerticalScrollBarVisibility ="Visible"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.IsVerticalRailEnabled="True"
TextWrapping="Wrap"
AcceptsReturn="True"
HorizontalAlignment="Left"
MinWidth="240"
MinHeight="160" />
</StackPanel>
<RelativePanel x:Name="SidePanel"