File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ This will produce an executable file at `target/release/bluetui` that you can co
7777
7878` s ` : Start/Stop scanning.
7979
80- ` ctrl+c ` or ` q ` or ` <Esc> ` : Quit the app.
80+ ` ctrl+c ` or ` q ` : Quit the app. (Note: ` <Esc> ` can also quit if ` esc_quit = true ` is set in config)
8181
8282### Adapters
8383
@@ -114,6 +114,7 @@ layout = "SpaceAround"
114114width = " auto"
115115
116116toggle_scanning = " s"
117+ esc_quit = false # Set to true to enable Esc key to quit the app
117118
118119[adapter ]
119120toggle_pairing = " p"
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ pub struct Config {
2121 #[ serde( default = "default_toggle_scanning" ) ]
2222 pub toggle_scanning : char ,
2323
24+ #[ serde( default = "default_esc_quit" ) ]
25+ pub esc_quit : bool ,
26+
2427 #[ serde( default ) ]
2528 pub adapter : Adapter ,
2629
@@ -166,6 +169,10 @@ fn default_toggle_scanning() -> char {
166169 's'
167170}
168171
172+ fn default_esc_quit ( ) -> bool {
173+ false
174+ }
175+
169176fn default_toggle_adapter_pairing ( ) -> char {
170177 'p'
171178}
Original file line number Diff line number Diff line change @@ -264,7 +264,11 @@ pub async fn handle_key_events(
264264 app. quit ( ) ;
265265 }
266266
267- KeyCode :: Char ( 'q' ) | KeyCode :: Esc => {
267+ KeyCode :: Char ( 'q' ) => {
268+ app. quit ( ) ;
269+ }
270+
271+ KeyCode :: Esc if app. config . esc_quit => {
268272 app. quit ( ) ;
269273 }
270274
You can’t perform that action at this time.
0 commit comments