Skip to content

Commit 1863cbd

Browse files
committed
enhance: close all windows with ESC
1 parent 4bfcfb8 commit 1863cbd

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

src/Views/ChromelessWindow.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,13 @@ private void OnWindowBorderPointerPressed(object sender, PointerPressedEventArgs
7373
if (sender is Border { Tag: WindowEdge edge } && CanResize)
7474
BeginResizeDrag(edge, e);
7575
}
76+
77+
protected override void OnKeyDown(KeyEventArgs e)
78+
{
79+
base.OnKeyDown(e);
80+
81+
if (e is { Handled: false, Key: Key.Escape })
82+
Close();
83+
}
7684
}
7785
}

src/Views/Hotkeys.axaml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Avalonia.Input;
2-
31
namespace SourceGit.Views
42
{
53
public partial class Hotkeys : ChromelessWindow
@@ -8,13 +6,5 @@ public Hotkeys()
86
{
97
InitializeComponent();
108
}
11-
12-
protected override void OnKeyDown(KeyEventArgs e)
13-
{
14-
base.OnKeyDown(e);
15-
16-
if (!e.Handled && e.Key == Key.Escape)
17-
Close();
18-
}
199
}
2010
}

src/Views/RepositoryConfigure.axaml.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ public RepositoryConfigure()
1212
InitializeComponent();
1313
}
1414

15-
protected override void OnKeyDown(KeyEventArgs e)
16-
{
17-
base.OnKeyDown(e);
18-
19-
if (!e.Handled && e.Key == Key.Escape)
20-
Close();
21-
}
22-
2315
protected override async void OnClosing(WindowClosingEventArgs e)
2416
{
2517
base.OnClosing(e);

0 commit comments

Comments
 (0)