mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[Peek]Create Setting to run not elevated (#26308)
* [Peek]Create Setting to run not elevated * Optionally add access permissions to the handles
This commit is contained in:
@@ -11,10 +11,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public PeekProperties()
|
||||
{
|
||||
ActivationShortcut = new HotkeySettings(false, true, false, false, 0x20);
|
||||
AlwaysRunNotElevated = new BoolProperty(true);
|
||||
}
|
||||
|
||||
public HotkeySettings ActivationShortcut { get; set; }
|
||||
|
||||
public BoolProperty AlwaysRunNotElevated { get; set; }
|
||||
|
||||
public override string ToString() => JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2833,6 +2833,16 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Enable Peek</value>
|
||||
<comment>Peek is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="Peek_BehaviorHeader.Header" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="Peek_AlwaysRunNotElevated.Header" xml:space="preserve">
|
||||
<value>Always run not elevated, even when PowerToys is elevated</value>
|
||||
</data>
|
||||
<data name="Peek_AlwaysRunNotElevated.Description" xml:space="preserve">
|
||||
<value>Tries to run Peek without elevated permissions, to fix access to network shares. You need to disable and re-enable Peek for changes to this value to take effect.</value>
|
||||
<comment>Peek is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="FancyZones_DisableRoundCornersOnWindowSnap.Content" xml:space="preserve">
|
||||
<value>Disable round corners when window is snapped</value>
|
||||
</data>
|
||||
|
||||
@@ -109,6 +109,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool AlwaysRunNotElevated
|
||||
{
|
||||
get => _peekSettings.Properties.AlwaysRunNotElevated.Value;
|
||||
set
|
||||
{
|
||||
if (_peekSettings.Properties.AlwaysRunNotElevated.Value != value)
|
||||
{
|
||||
_peekSettings.Properties.AlwaysRunNotElevated.Value = value;
|
||||
OnPropertyChanged(nameof(AlwaysRunNotElevated));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifySettingsChanged()
|
||||
{
|
||||
// Using InvariantCulture as this is an IPC message
|
||||
|
||||
@@ -31,6 +31,14 @@
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="Peek_BehaviorHeader" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<labs:SettingsCard x:Uid="Peek_AlwaysRunNotElevated" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.AlwaysRunNotElevated}" />
|
||||
</labs:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
|
||||
Reference in New Issue
Block a user