feat(ui): keyboard shortcuts (/ Ctrl+N Space Esc)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<TextBlock FontFamily="{DynamicResource SansFamily}" FontSize="18"
|
||||
FontWeight="SemiBold" Foreground="{DynamicResource TextBrush}"
|
||||
Text="Lists"/>
|
||||
<TextBox Classes="search" Margin="0,8,0,0" PlaceholderText="Search…"
|
||||
<TextBox x:Name="SearchBox" Classes="search" Margin="0,8,0,0" PlaceholderText="Search…"
|
||||
Text="{Binding SearchText, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -6,7 +6,15 @@ namespace ClaudeDo.Ui.Views.Islands;
|
||||
|
||||
public partial class ListsIslandView : UserControl
|
||||
{
|
||||
public ListsIslandView() { InitializeComponent(); }
|
||||
public ListsIslandView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContextChanged += (_, _) =>
|
||||
{
|
||||
if (DataContext is ListsIslandViewModel vm)
|
||||
vm.FocusSearchRequested += (_, _) => SearchBox.Focus();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnItemTapped(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<!-- Add-task row -->
|
||||
<Border DockPanel.Dock="Top" Margin="18,8,18,4">
|
||||
<TextBox Watermark="Add a task…" Text="{Binding NewTaskTitle, Mode=TwoWay}">
|
||||
<TextBox x:Name="AddTaskBox" Watermark="Add a task…" Text="{Binding NewTaskTitle, Mode=TwoWay}">
|
||||
<TextBox.KeyBindings>
|
||||
<KeyBinding Gesture="Enter" Command="{Binding AddCommand}"/>
|
||||
</TextBox.KeyBindings>
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
using Avalonia.Controls;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
namespace ClaudeDo.Ui.Views.Islands;
|
||||
|
||||
public partial class TasksIslandView : UserControl
|
||||
{
|
||||
public TasksIslandView() { InitializeComponent(); }
|
||||
public TasksIslandView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContextChanged += (_, _) =>
|
||||
{
|
||||
if (DataContext is TasksIslandViewModel vm)
|
||||
vm.FocusAddTaskRequested += (_, _) => AddTaskBox.Focus();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
SystemDecorations="None"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
ExtendClientAreaTitleBarHeightHint="-1">
|
||||
<Window.KeyBindings>
|
||||
<KeyBinding Gesture="OemQuestion" Command="{Binding FocusSearchCommand}"/>
|
||||
<KeyBinding Gesture="Shift+OemQuestion" Command="{Binding FocusSearchCommand}"/>
|
||||
<KeyBinding Gesture="Ctrl+N" Command="{Binding FocusAddTaskCommand}"/>
|
||||
</Window.KeyBindings>
|
||||
<Grid RowDefinitions="36,*">
|
||||
<!-- Custom title bar -->
|
||||
<Border Grid.Row="0" Background="{DynamicResource DeepBrush}" PointerPressed="OnTitleBarPressed">
|
||||
|
||||
@@ -6,7 +6,22 @@ namespace ClaudeDo.Ui.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow() { InitializeComponent(); }
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
KeyDown += OnWindowKeyDown;
|
||||
}
|
||||
|
||||
private void OnWindowKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Space
|
||||
&& FocusManager?.GetFocusedElement() is not TextBox
|
||||
&& DataContext is IslandsShellViewModel vm)
|
||||
{
|
||||
e.Handled = true;
|
||||
_ = vm.ToggleSelectedDoneAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user