@@ -1321,14 +1321,42 @@ class CinnamonMenuApplet extends Applet.TextIconApplet {
13211321 }
13221322
13231323 _updateKeybinding ( ) {
1324- Main . keybindingManager . addHotKey ( "overlay-key-" + this . instance_id , this . overlayKey , Lang . bind ( this , function ( ) {
1325- if ( ! Main . overview . visible && ! Main . expo . visible ) {
1326- if ( this . forceShowPanel && ! this . isOpen ) {
1327- this . panel . peekPanel ( ) ;
1324+ const binds = this . overlayKey . split ( '::' ) . filter ( e => e ) ;
1325+ for ( let i = 0 ; i < binds . length ; i ++ ) {
1326+ const bind = binds [ i ] ;
1327+ Main . keybindingManager . addHotKey ( `overlay-key-${ i } -${ this . instance_id } ` , bind , Lang . bind ( this , function ( ) {
1328+ const instancesWithSameBinding = this . _getInstancesWithSameOverlayBinding ( bind ) ;
1329+ if ( ! instancesWithSameBinding . length || this . _mouseOnSameMonitor ( this . actor ) ) {
1330+ this . toggleOverlay ( ) ;
1331+ return ;
13281332 }
1329- this . menu . toggle_with_options ( this . enableAnimation ) ;
1333+ const matchingInstance = instancesWithSameBinding . find ( instance => this . _mouseOnSameMonitor ( instance . actor ) ) ;
1334+ ( matchingInstance ?? this ) . toggleOverlay ( ) ;
1335+ } ) ) ;
1336+ }
1337+ }
1338+
1339+ _getInstancesWithSameOverlayBinding ( bind ) {
1340+ const instances = Main . AppletManager . getRunningInstancesForUuid ( "[email protected] " ) ; 1341+ return instances . filter ( instance => {
1342+ if ( instance === this ) return false ;
1343+ return instance . overlayKey . split ( '::' ) . includes ( bind ) ;
1344+ } ) ;
1345+ }
1346+
1347+ _mouseOnSameMonitor ( actor ) {
1348+ const mouseMonitor = Main . layoutManager . currentMonitor . index ;
1349+ const actorMonitor = Main . layoutManager . findMonitorIndexForActor ( actor ) ;
1350+ return mouseMonitor === actorMonitor ;
1351+ }
1352+
1353+ toggleOverlay ( ) {
1354+ if ( ! Main . overview . visible && ! Main . expo . visible ) {
1355+ if ( this . forceShowPanel && ! this . isOpen ) {
1356+ this . panel . peekPanel ( ) ;
13301357 }
1331- } ) ) ;
1358+ this . menu . toggle_with_options ( this . enableAnimation ) ;
1359+ }
13321360 }
13331361
13341362 _updateCategoryHover ( ) {
0 commit comments