6
6
7
7
export app_main_loop
8
8
9
+ """
10
+ check_keystroke(k1::Keystroke, k2::Keystroke) -> Bool
11
+ check_keystroke(k1::Symbol, k2::Symbol) -> Bool
12
+ check_keystroke(k1::Symbol, k2::Keystroke) -> Bool
13
+ check_keystroke(k1::Keystroke, k2::Symbol) -> Bool
14
+
15
+ Evaluate if either keystroke.type or keystroke k1 and k2 match
16
+ """
17
+ check_keystroke (k1:: Keystroke , k2:: Keystroke ) = k1 == k2
18
+ check_keystroke (k1:: Symbol , k2:: Symbol ) = k1 == k2
19
+ check_keystroke (k1:: Keystroke , k2:: Symbol ) = k1. ktype == k2
20
+ check_keystroke (k1:: Symbol , k2:: Keystroke ) = k1 == k2. ktype
21
+
22
+
9
23
"""
10
24
app_main_loop() -> Nothing
11
25
12
26
Start the application main loop.
13
27
"""
14
- function app_main_loop ()
28
+ function app_main_loop (; exitkey = :F1 )
15
29
# If there is no window in focus, try to acquire it.
16
30
isnothing (get_focused_window ()) && move_focus_to_next_window ()
17
31
@@ -28,7 +42,7 @@ function app_main_loop()
28
42
29
43
# Check if the keystroke must be passed or if the signal hijacked it.
30
44
if ! @get_signal_property (tui, keypressed, block, false )
31
- if k . ktype == :F1
45
+ if check_keystroke (k, exitkey)
32
46
break
33
47
else
34
48
process_keystroke (k)
0 commit comments