@@ -357,19 +357,36 @@ var WindowManager = class WindowManager {
357357 this . _cinnamonwm . connect ( 'filter-keybinding' , this . _filterKeybinding . bind ( this ) ) ;
358358 global . window_manager . connect ( 'switch-workspace' , ( c , f , t , d ) => this . _switchWorkspace ( c , f , t , d ) ) ;
359359
360- Meta . keybindings_set_custom_handler ( 'move-to-workspace-left' , ( d , w , b ) => this . _moveWindowToWorkspaceLeft ( d , w , b ) ) ;
361- Meta . keybindings_set_custom_handler ( 'move-to-workspace-right' , ( d , w , b ) => this . _moveWindowToWorkspaceRight ( d , w , b ) ) ;
362-
363- Meta . keybindings_set_custom_handler ( 'switch-to-workspace-left' , ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) ) ;
364- Meta . keybindings_set_custom_handler ( 'switch-to-workspace-right' , ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) ) ;
365- Meta . keybindings_set_custom_handler ( 'switch-to-workspace-up' , ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) ) ;
366- Meta . keybindings_set_custom_handler ( 'switch-to-workspace-down' , ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) ) ;
367- Meta . keybindings_set_custom_handler ( 'switch-windows' , ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) ) ;
368- Meta . keybindings_set_custom_handler ( 'switch-group' , ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) ) ;
369- Meta . keybindings_set_custom_handler ( 'switch-windows-backward' , ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) ) ;
370- Meta . keybindings_set_custom_handler ( 'switch-group-backward' , ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) ) ;
371- Meta . keybindings_set_custom_handler ( 'switch-panels' , ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) ) ;
372- Meta . keybindings_set_custom_handler ( 'switch-panels-backward' , ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) ) ;
360+ let kbm = Main . keybindingManager ;
361+ let WORKSPACE_MODES = Cinnamon . ActionMode . NORMAL |
362+ Cinnamon . ActionMode . OVERVIEW |
363+ Cinnamon . ActionMode . EXPO ;
364+
365+ kbm . setBuiltinHandler ( 'move-to-workspace-left' , Meta . KeyBindingAction . MOVE_TO_WORKSPACE_LEFT ,
366+ ( d , w , b ) => this . _moveWindowToWorkspaceLeft ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
367+ kbm . setBuiltinHandler ( 'move-to-workspace-right' , Meta . KeyBindingAction . MOVE_TO_WORKSPACE_RIGHT ,
368+ ( d , w , b ) => this . _moveWindowToWorkspaceRight ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
369+
370+ kbm . setBuiltinHandler ( 'switch-to-workspace-left' , Meta . KeyBindingAction . WORKSPACE_LEFT ,
371+ ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) , WORKSPACE_MODES ) ;
372+ kbm . setBuiltinHandler ( 'switch-to-workspace-right' , Meta . KeyBindingAction . WORKSPACE_RIGHT ,
373+ ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) , WORKSPACE_MODES ) ;
374+ kbm . setBuiltinHandler ( 'switch-to-workspace-up' , Meta . KeyBindingAction . WORKSPACE_UP ,
375+ ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) , WORKSPACE_MODES ) ;
376+ kbm . setBuiltinHandler ( 'switch-to-workspace-down' , Meta . KeyBindingAction . WORKSPACE_DOWN ,
377+ ( d , w , b ) => this . _showWorkspaceSwitcher ( d , w , b ) , WORKSPACE_MODES ) ;
378+ kbm . setBuiltinHandler ( 'switch-windows' , Meta . KeyBindingAction . SWITCH_WINDOWS ,
379+ ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
380+ kbm . setBuiltinHandler ( 'switch-group' , Meta . KeyBindingAction . SWITCH_GROUP ,
381+ ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
382+ kbm . setBuiltinHandler ( 'switch-windows-backward' , Meta . KeyBindingAction . SWITCH_WINDOWS_BACKWARD ,
383+ ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
384+ kbm . setBuiltinHandler ( 'switch-group-backward' , Meta . KeyBindingAction . SWITCH_GROUP_BACKWARD ,
385+ ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
386+ kbm . setBuiltinHandler ( 'switch-panels' , Meta . KeyBindingAction . SWITCH_PANELS ,
387+ ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
388+ kbm . setBuiltinHandler ( 'switch-panels-backward' , Meta . KeyBindingAction . SWITCH_PANELS_BACKWARD ,
389+ ( d , w , b ) => this . _startAppSwitcher ( d , w , b ) , Cinnamon . ActionMode . NORMAL ) ;
373390
374391 global . display . connect ( 'show-resize-popup' , this . _showResizePopup . bind ( this ) ) ;
375392 this . _cinnamonwm . connect ( 'create-close-dialog' , this . _createCloseDialog . bind ( this ) ) ;
@@ -835,15 +852,9 @@ var WindowManager = class WindowManager {
835852 }
836853
837854 _filterKeybinding ( shellwm , binding ) {
838- // Builtin keybindings (defined by Muffin) work in NORMAL mode by default
839- if ( Main . actionMode == Cinnamon . ActionMode . NORMAL && binding . is_builtin ( ) )
840- return false ;
841-
842- // Look up the binding in our keybinding manager
843855 let bindingName = binding . get_name ( ) ;
844- let [ action_id , entry ] = Main . keybindingManager . _lookupEntry ( bindingName ) ;
856+ let [ , entry ] = Main . keybindingManager . _lookupEntry ( bindingName ) ;
845857
846- // Use the common filtering logic from main.js
847858 return Main . _shouldFilterKeybinding ( entry ) ;
848859 }
849860
@@ -1382,12 +1393,23 @@ var WindowManager = class WindowManager {
13821393
13831394 _showWorkspaceSwitcher ( display , window , binding ) {
13841395 let bindingName = binding . get_name ( ) ;
1396+
13851397 if ( bindingName === 'switch-to-workspace-up' ) {
1386- Main . expo . toggle ( ) ;
1398+ if ( Main . overview . visible || Main . expo . visible ) {
1399+ Main . overview . hide ( ) ;
1400+ Main . expo . hide ( ) ;
1401+ } else {
1402+ Main . expo . toggle ( ) ;
1403+ }
13871404 return ;
13881405 }
13891406 if ( bindingName === 'switch-to-workspace-down' ) {
1390- Main . overview . toggle ( ) ;
1407+ if ( Main . overview . visible || Main . expo . visible ) {
1408+ Main . overview . hide ( ) ;
1409+ Main . expo . hide ( ) ;
1410+ } else {
1411+ Main . overview . toggle ( ) ;
1412+ }
13911413 return ;
13921414 }
13931415
0 commit comments