@@ -26,12 +26,20 @@ impl AssetSource for Assets {
2626 }
2727}
2828
29- actions ! ( main_menu, [ Quit ] ) ;
30-
3129fn init ( _: Arc < AppState > , cx : & mut AppContext ) -> Result < ( ) > {
3230 components:: init ( cx) ;
3331
34- cx. bind_keys ( [ KeyBinding :: new ( "cmd-q" , Quit , None ) ] ) ;
32+ if cfg ! ( target_os = "macos" ) {
33+ cx. bind_keys ( vec ! [ KeyBinding :: new( "cmd-q" , actions:: Quit , None ) ] ) ;
34+ cx. bind_keys ( vec ! [ KeyBinding :: new( "cmd-h" , actions:: Hide , None ) ] ) ;
35+ } else {
36+ cx. bind_keys ( vec ! [ KeyBinding :: new( "ctrl-h" , actions:: Hide , None ) ] ) ;
37+ }
38+
39+ cx. set_menus ( app_menus ( ) ) ;
40+
41+ cx. on_action ( |_: & actions:: Quit , cx| cx. quit ( ) ) ;
42+ cx. on_action ( |_: & actions:: Hide , cx| cx. hide ( ) ) ;
3543
3644 Ok ( ( ) )
3745}
@@ -50,11 +58,6 @@ async fn main() {
5058 return ;
5159 }
5260
53- cx. bind_keys ( vec ! [ KeyBinding :: new( "cmd-q" , actions:: Quit , None ) ] ) ;
54-
55- cx. set_menus ( app_menus ( ) ) ;
56- cx. on_action ( |_: & Quit , cx| cx. quit ( ) ) ;
57-
5861 let mut theme = Theme :: from ( ThemeColor :: dark ( ) ) ;
5962 theme. mode = ThemeMode :: Dark ;
6063 theme. accent = hsl ( 335.0 , 97.0 , 61.0 ) ;
0 commit comments