@@ -64,6 +64,12 @@ function Tile(firstClient, tileIndex) {
6464 * desktop.
6565 */
6666 this . desktopChanged = new Signal ( ) ;
67+ /**
68+ * Signal which is triggered whenever the tile's presence across
69+ * activities changes. Two parameters are passed to the handlers, the
70+ * tile's current desktop and the tile's current screen.
71+ */
72+ this . activitiesChanged = new Signal ( ) ;
6773 /**
6874 * List of the clients in this tile.
6975 */
@@ -94,6 +100,8 @@ function Tile(firstClient, tileIndex) {
94100 */
95101 this . _currentDesktop = util . getClientDesktop ( firstClient ) ;
96102
103+ this . _activities = Array . from ( firstClient . activities ) ;
104+
97105 this . rectangle = null ;
98106
99107 this . respectMinMax = KWin . readConfig ( "respectMinMax" , true ) ;
@@ -320,6 +328,29 @@ Tile.prototype.setClientGeometry = function(client) {
320328 }
321329} ;
322330
331+ Tile . prototype . onClientActivitiesChanged = function ( client ) {
332+ try {
333+ var activities = Array . from ( client . activities ) ;
334+ var emit = false ;
335+ if ( this . _activities . length == activities . length ) {
336+ for ( var i = 0 ; i < activities . length ; i ++ ) {
337+ if ( ! this . _activities . includes ( activities [ i ] ) ) {
338+ emit = true ;
339+ break ;
340+ }
341+ }
342+ } else {
343+ emit = true ;
344+ }
345+ if ( emit ) {
346+ this . _activities = activities ;
347+ this . activitiesChanged . emit ( ) ;
348+ }
349+ } catch ( err ) {
350+ print ( err , "in Tile.onClientActivitiesChanged" ) ;
351+ }
352+ } ;
353+
323354Tile . prototype . onClientDesktopChanged = function ( client ) {
324355 try {
325356 var oldDesktop = this . _currentDesktop ;
@@ -432,24 +463,32 @@ Tile.prototype.hasClient = function(client) {
432463 return ( this . clients . indexOf ( client ) > - 1 ) ;
433464} ;
434465
466+ Tile . prototype . getActivities = function ( ) {
467+ return Array . from ( this . _activities ) ;
468+ } ;
469+
435470Tile . prototype . getDesktop = function ( ) {
436471 return this . _currentDesktop ;
437- }
472+ } ;
438473
439474Tile . prototype . getScreen = function ( ) {
440475 return this . _currentScreen ;
441- }
476+ } ;
442477
443478Tile . prototype . unmaximize = function ( ) {
444479 if ( this . _canSetMaximize == true && this . maximized == true ) {
445480 this . clients . forEach ( function ( c ) {
446481 c . setMaximize ( false , false ) ;
447482 } ) ;
448483 }
449- }
484+ } ;
450485
451486Tile . prototype . setKeepBelow = function ( setting ) {
452487 this . clients . forEach ( function ( c ) {
453488 c . keepBelow = setting ;
454489 } ) ;
455- }
490+ } ;
491+
492+ Tile . prototype . onAllActivities = function ( ) {
493+ return this . _activities . length == 0 ;
494+ } ;
0 commit comments