File tree Expand file tree Collapse file tree 1 file changed +25
-9
lines changed Expand file tree Collapse file tree 1 file changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -1317,15 +1317,31 @@ pub fn handle_keymap_file_changes(
1317
1317
} )
1318
1318
. detach ( ) ;
1319
1319
1320
- let mut current_layout_id = cx. keyboard_layout ( ) . id ( ) . to_string ( ) ;
1321
- cx. on_keyboard_layout_change ( move |cx| {
1322
- let next_layout_id = cx. keyboard_layout ( ) . id ( ) ;
1323
- if next_layout_id != current_layout_id {
1324
- current_layout_id = next_layout_id. to_string ( ) ;
1325
- keyboard_layout_tx. unbounded_send ( ( ) ) . ok ( ) ;
1326
- }
1327
- } )
1328
- . detach ( ) ;
1320
+ #[ cfg( target_os = "windows" ) ]
1321
+ {
1322
+ let mut current_layout_id = cx. keyboard_layout ( ) . id ( ) . to_string ( ) ;
1323
+ cx. on_keyboard_layout_change ( move |cx| {
1324
+ let next_layout_id = cx. keyboard_layout ( ) . id ( ) ;
1325
+ if next_layout_id != current_layout_id {
1326
+ current_layout_id = next_layout_id. to_string ( ) ;
1327
+ keyboard_layout_tx. unbounded_send ( ( ) ) . ok ( ) ;
1328
+ }
1329
+ } )
1330
+ . detach ( ) ;
1331
+ }
1332
+
1333
+ #[ cfg( not( target_os = "windows" ) ) ]
1334
+ {
1335
+ let mut current_mapping = cx. keyboard_mapper ( ) . get_key_equivalents ( ) . cloned ( ) ;
1336
+ cx. on_keyboard_layout_change ( move |cx| {
1337
+ let next_mapping = cx. keyboard_mapper ( ) . get_key_equivalents ( ) ;
1338
+ if current_mapping. as_ref ( ) != next_mapping {
1339
+ current_mapping = next_mapping. cloned ( ) ;
1340
+ keyboard_layout_tx. unbounded_send ( ( ) ) . ok ( ) ;
1341
+ }
1342
+ } )
1343
+ . detach ( ) ;
1344
+ }
1329
1345
1330
1346
load_default_keymap ( cx) ;
1331
1347
You can’t perform that action at this time.
0 commit comments