Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch/Open/GoTo: Code #32516

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/common/utils/elevation.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,14 @@ struct ProcessInfo

inline std::optional<ProcessInfo> RunNonElevatedFailsafe(const std::wstring& file, const std::wstring& params, const std::wstring& working_dir, DWORD handleAccess = 0)
{
bool launched = RunNonElevatedEx(file, params, working_dir);
if (!launched)
bool opened = RunNonElevatedEx(file, params, working_dir);
if (!opened)
{
Logger::warn(L"RunNonElevatedEx() failed. Trying fallback");
std::wstring action_runner_path = get_module_folderpath() + L"\\PowerToys.ActionRunner.exe";
std::wstring newParams = fmt::format(L"-run-non-elevated -target \"{}\" {}", file, params);
launched = run_non_elevated(action_runner_path, newParams, nullptr, working_dir.c_str());
if (launched)
opened = run_non_elevated(action_runner_path, newParams, nullptr, working_dir.c_str());
if (opened)
{
Logger::trace(L"Started {}", file);
}
Expand Down
4 changes: 0 additions & 4 deletions src/modules/Hosts/Hosts/HostsXAML/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ public App()
UnhandledException += App_UnhandledException;
}

/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we deleting these comments? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm, I have forgotten now. But I would guess that this comment is so obvious?

{
var cmdArgs = Environment.GetCommandLineArgs();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/PowerOCR/PowerOCR/Helpers/WindowUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void LaunchOCROverlayOnEveryScreen()
{
if (IsOCROverlayCreated())
{
Logger.LogWarning("Tried to launch the overlay, but it has been already created.");
Logger.LogWarning("Tried to open the overlay, but it has been already created.");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/awake/Awake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static int Main(string[] args)
Exit(Core.Constants.AppName + " is already running! Exiting the application.", 1, _exitSignal, true);
}

Logger.LogInfo($"Launching {Core.Constants.AppName}...");
Logger.LogInfo($"Opening {Core.Constants.AppName}...");
Logger.LogInfo(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion);
Logger.LogInfo($"Build: {BuildId}");
Logger.LogInfo($"OS: {Environment.OSVersion}");
Expand Down
2 changes: 1 addition & 1 deletion src/modules/fancyzones/UITests-FancyZones/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Init
public static void SetupAll(TestContext context)
{
string winAppDriverPath = "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe";
context.WriteLine($"Attempting to launch WinAppDriver at: {winAppDriverPath}");
context.WriteLine($"Attempting to open WinAppDriver at: {winAppDriverPath}");
appDriver = Process.Start(winAppDriverPath);
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/fancyzones/UITests-FancyZonesEditor/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Init
public static void SetupAll(TestContext context)
{
string winAppDriverPath = "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe";
context.WriteLine($"Attempting to launch WinAppDriver at: {winAppDriverPath}");
context.WriteLine($"Attempting to open WinAppDriver at: {winAppDriverPath}");
appDriver = Process.Start(winAppDriverPath);
}

Expand Down
16 changes: 8 additions & 8 deletions src/modules/peek/Peek.UI/PeekXAML/Views/TitleBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="SystemLeftPaddingColumn" Width="0" />
<ColumnDefinition x:Name="DraggableColumn" Width="*" />
<ColumnDefinition x:Name="LaunchAppButtonColumn" Width="Auto" />
<ColumnDefinition x:Name="OpenAppButtonColumn" Width="Auto" />
<ColumnDefinition x:Name="AppRightPaddingColumn" Width="8" />
<ColumnDefinition x:Name="PinButtonColumn" Width="Auto" />
<ColumnDefinition x:Name="SystemRightPaddingColumn" Width="180" />
Expand Down Expand Up @@ -65,7 +65,7 @@
</Grid>

<Button
x:Name="LaunchAppButton"
x:Name="OpenAppButton"
Grid.Column="2"
VerticalAlignment="Center"
Command="{x:Bind LaunchDefaultAppButtonCommand, Mode=OneWay}"
Expand All @@ -74,11 +74,11 @@
<Button.Content>
<StackPanel Orientation="Horizontal" Spacing="4">
<FontIcon
x:Name="LaunchAppButton_Icon"
x:Name="OpenAppButton_Icon"
FontSize="16"
Glyph="&#xE8E5;" />
<TextBlock
x:Name="LaunchAppButton_Text"
x:Name="OpenAppButton_Text"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind OpenWithAppText, Mode=OneWay}" />
</StackPanel>
Expand Down Expand Up @@ -109,24 +109,24 @@
<AdaptiveTrigger MinWindowWidth="560" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="LaunchAppButton_Text.Visibility" Value="Visible" />
<Setter Target="OpenAppButton_Text.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="MediumLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="340" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="LaunchAppButton_Text.Visibility" Value="Collapsed" />
<Setter Target="OpenAppButton_Text.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="MinimumLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="LaunchAppButton_Text.Visibility" Value="Collapsed" />
<Setter Target="LaunchAppButton.Visibility" Value="Collapsed" />
<Setter Target="OpenAppButton_Text.Visibility" Value="Collapsed" />
<Setter Target="OpenAppButton.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/modules/peek/Peek.UI/PeekXAML/Views/TitleBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public TitleBar()
InitializeComponent();
TitleBarRootContainer.SizeChanged += TitleBarRootContainer_SizeChanged;

LaunchAppButton.RegisterPropertyChangedCallback(VisibilityProperty, LaunchAppButtonVisibilityChangedCallback);
OpenAppButton.RegisterPropertyChangedCallback(VisibilityProperty, OpenAppButtonVisibilityChangedCallback);
}

public IFileSystemItem Item
Expand Down Expand Up @@ -213,7 +213,7 @@ private void UpdateDragRegion()
dragRectangleLeft.Width = (int)(DraggableColumn.ActualWidth * scale);
dragRectangleLeft.Height = (int)(TitleBarRootContainer.ActualHeight * scale);

dragRectangleRight.X = (int)((SystemLeftPaddingColumn.ActualWidth + DraggableColumn.ActualWidth + LaunchAppButtonColumn.ActualWidth) * scale);
dragRectangleRight.X = (int)((SystemLeftPaddingColumn.ActualWidth + DraggableColumn.ActualWidth + OpenAppButtonColumn.ActualWidth) * scale);
dragRectangleRight.Y = 0;
dragRectangleRight.Width = (int)(AppRightPaddingColumn.ActualWidth * scale);
dragRectangleRight.Height = (int)(TitleBarRootContainer.ActualHeight * scale);
Expand Down Expand Up @@ -289,7 +289,7 @@ private void UpdateDefaultAppToLaunch()
/// <summary>
/// Ensure the drag region of the title bar is updated when the visibility of the launch app button changes.
/// </summary>
private async void LaunchAppButtonVisibilityChangedCallback(DependencyObject sender, DependencyProperty dp)
private async void OpenAppButtonVisibilityChangedCallback(DependencyObject sender, DependencyProperty dp)
{
// Ensure the ActualWidth is updated
await Task.Delay(100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@
</Button>
<!--<AppBarSeparator />
<Button
x:Name="QuitBtn"
x:Name="CloseBtn"
Style="{StaticResource FlyoutButtonStyle}"
ToolTipService.ToolTip="Quit"
Click="QuitButton_Click">
ToolTipService.ToolTip="Close"
Click="CloseButton_Click">
<FontIcon FontSize="16" Glyph="&#xe894;" />
</Button>-->
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private void AllAppButton_Click(object sender, RoutedEventArgs e)
Frame.Navigate(typeof(AppsListPage), null, new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromRight });
}

private void QuitButton_Click(object sender, RoutedEventArgs e)
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
ViewModel.KillRunner();
this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_AlwaysOnTop_TipsAndTricks" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_AlwaysOnTop" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_AlwaysOnTop" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OobeAlwaysOnTop()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_Awake_TipsAndTricks" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_Awake" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_Awake" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public OobeAwake()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_CmdNotFound_HowToUse" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_CmdNotFound" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_CmdNotFound" TextWrapping="Wrap" />
</HyperlinkButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OobeCmdNotFound()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
x:Uid="Launch_ColorPicker"
Click="Start_ColorPicker_Click"
Style="{StaticResource AccentButtonStyle}" />
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ColorPicker" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_ColorPicker" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void Start_ColorPicker_Click(object sender, Microsoft.UI.Xaml.RoutedEven
ViewModel.LogRunningModuleEvent();
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<controls:ShortcutWithTextLabelControl x:Name="ReparentHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Reparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_CropAndLock" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_CropAndLock" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OobeCropAndLock()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_FancyZones_TipsAndTricks" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_FancyZones" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_FancyZones" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public OobeFancyZones()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_FileExplorer_HowToEnable" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_FileExplorerAddOns" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_PowerPreview" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public OobeFileExplorer()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_FileLocksmith_TipsAndTricks" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_FileLocksmith" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_FileLocksmith" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public OobeFileLocksmith()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_ImageResizer_TipsAndTricks" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ImageResizer" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_ImageResizer" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public OobeImageResizer()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_KBM_TipsAndTricks" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_KeyboardManager" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_KBM" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public OobeKBM()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<tk7controls:MarkdownTextBlock x:Uid="Oobe_MeasureTool_HowToLaunch" Background="Transparent" />

<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
<Button x:Uid="OOBE_Settings" Click="GoToSettingsButton_Click" />

<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ScreenRuler" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_MeasureTool" TextWrapping="Wrap" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public OobeMeasureTool()
DataContext = ViewModel;
}

private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
private void GoToSettingsButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
Expand Down