Skip to content

Commit

Permalink
Use Cmd+P to open search box on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Havret authored and cezarypiatek committed Jul 31, 2023
1 parent f4197b7 commit 7e635f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Threading;
using DynamicData;
using MessageBox.Avalonia.Enums;
Expand Down Expand Up @@ -126,6 +127,20 @@ public ScriptConfig? SelectedAction
}
}
}

public KeyGesture SearchBoxHotKey
{
get
{
if (OperatingSystem.IsMacOS())
{
// Cmd+P
return new KeyGesture(Key.P, KeyModifiers.Meta);
}
// Ctrl+P
return new KeyGesture(Key.P, KeyModifiers.Control);
}
}

private bool IsActionInstalled(string valueName)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ScriptRunner/ScriptRunner.GUI/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<Button i:Attached.Icon="fas fa-cog" Margin="5" Height="35" Width="50" FontSize="18" Command="{Binding OpenSettingsWindow}" ToolTip.Tip="Configure actions sources"/>
<Button i:Attached.Icon="fas fa-sync" Margin="0,0,5,0" Height="35" Width="50" FontSize="18" Command="{Binding RefreshSettings}" ToolTip.Tip="Refresh actions" />
<Button i:Attached.Icon="fas fa-lock" Margin="0,0,5,0" Height="35" Width="50" FontSize="18" Command="{Binding OpenVaultWindow}" ToolTip.Tip="Open Vault" />
<Button i:Attached.Icon="fas fa-search" Height="35" Width="50" FontSize="18" Click="OpenSearchBox" HotKey="Ctrl+P" ToolTip.Tip="Open Search Box (Ctrl+P)" />
<Button i:Attached.Icon="fas fa-search" Height="35" Width="50" FontSize="18" Click="OpenSearchBox" HotKey="{Binding SearchBoxHotKey}" ToolTip.Tip="Open Search Box (Ctrl+P)" />
</StackPanel>
</Grid>
<GridSplitter Grid.Column="1" Grid.Row="1" ResizeDirection="Columns" IsTabStop="False"></GridSplitter>
Expand Down

0 comments on commit 7e635f5

Please sign in to comment.