[PT Run] Run dialog now has monitor positioning options (#9492)

* Run dialog now has monitor positioning options

* add monitor index validation in window position calculation

* correct path in page

* change how radio buttons are declared to resolve them not being set based on setting

* Change "follow mouse" wording

Co-authored-by: htcfreek <61519853+htcfreek@users.noreply.github.com>

* PowerLauncher -> PowerToysRun for new variables/resources

* correct header label id and update wording to PowerToys Run

* only enable custom index if BOTH custom position radio checked and Run is enabled

* retrieve list count of detected monitors to limit selection of MonitorToDisplayOn

* add a link to Windows Display settings

* fix display settings link

* change how we get the number of connected monitors so we're not relying on presentation core, windowsbase etc which seem to fail the build

* combine position and appearance headers

* change references for custom position to "focus"

* restore accidentally removed files

* remove unused directives

* hook up "active window" position with the launcher window

* remove left overs

* remove uneeded itemgroup

* make resource prefixes consistent; using "Run_"

* add etcoreapp to spell check

* undo change to file not modified in the end

* remove unused checkbox post rebase

* remove change to reduce diff size

* changes according to review

* revert whitespace changes post rebase

* revert resources

* add changes back

* Update src/settings-ui/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw

Add comment

Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>

* remove unneeded resource string

Co-authored-by: htcfreek <61519853+htcfreek@users.noreply.github.com>
Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
This commit is contained in:
Adam Short
2021-03-09 17:20:49 +00:00
committed by GitHub
parent 964286ab99
commit 5c45f2c7b8
9 changed files with 160 additions and 4 deletions

View File

@@ -45,6 +45,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("theme")]
public Theme Theme { get; set; }
[JsonPropertyName("startupPosition")]
public StartupPosition Position { get; set; }
public PowerLauncherProperties()
{
OpenPowerLauncher = new HotkeySettings(false, false, true, false, 32);
@@ -57,6 +60,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
ClearInputOnLaunch = false;
MaximumNumberOfResults = 4;
Theme = Theme.System;
Position = StartupPosition.Cursor;
}
}
}

View File

@@ -22,6 +22,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private bool _isLightThemeRadioButtonChecked;
private bool _isSystemThemeRadioButtonChecked;
private bool _isCursorPositionRadioButtonChecked;
private bool _isPrimaryMonitorPositionRadioButtonChecked;
private bool _isFocusPositionRadioButtonChecked;
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
@@ -89,6 +93,19 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
break;
}
switch (settings.Properties.Position)
{
case StartupPosition.Cursor:
_isCursorPositionRadioButtonChecked = true;
break;
case StartupPosition.PrimaryMonitor:
_isPrimaryMonitorPositionRadioButtonChecked = true;
break;
case StartupPosition.Focus:
_isFocusPositionRadioButtonChecked = true;
break;
}
foreach (var plugin in Plugins)
{
plugin.PropertyChanged += OnPluginInfoChange;
@@ -243,6 +260,66 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool IsCursorPositionRadioButtonChecked
{
get
{
return _isCursorPositionRadioButtonChecked;
}
set
{
if (value == true)
{
settings.Properties.Position = StartupPosition.Cursor;
}
_isCursorPositionRadioButtonChecked = value;
UpdateSettings();
}
}
public bool IsPrimaryMonitorPositionRadioButtonChecked
{
get
{
return _isPrimaryMonitorPositionRadioButtonChecked;
}
set
{
if (value == true)
{
settings.Properties.Position = StartupPosition.PrimaryMonitor;
}
_isPrimaryMonitorPositionRadioButtonChecked = value;
UpdateSettings();
}
}
public bool IsFocusPositionRadioButtonChecked
{
get
{
return _isFocusPositionRadioButtonChecked;
}
set
{
if (value == true)
{
settings.Properties.Position = StartupPosition.Focus;
}
_isFocusPositionRadioButtonChecked = value;
UpdateSettings();
}
}
public HotkeySettings OpenPowerLauncher
{
get