@@ -122,6 +122,8 @@ const PauseOnMaximizeOrFullscreenModule = GObject.registerClass(
122122 private states : {
123123 maximizedOrFullscreenOnAnyMonitor : boolean ;
124124 maximizedOrFullscreenOnAllMonitors : boolean ;
125+ inOverview : boolean ;
126+ onLockScreen : boolean ;
125127 } ;
126128
127129 private conditions : { pauseOnMaximizeOrFullscreen : number } ;
@@ -131,12 +133,18 @@ const PauseOnMaximizeOrFullscreenModule = GObject.registerClass(
131133 private windows : WindowEntry [ ] ;
132134 private windowAddedId : number | null ;
133135 private windowRemovedId : number | null ;
136+ private overviewShowingId : number | null ;
137+ private overviewHiddenId : number | null ;
138+ private sessionModeUpdatedId : number | null ;
139+ private showingDesktopChangedId : number | null ;
134140
135141 constructor ( settings : Gio . Settings ) {
136142 super ( settings , 'maximizeOrFullscreen' ) ;
137143 this . states = {
138144 maximizedOrFullscreenOnAnyMonitor : false ,
139145 maximizedOrFullscreenOnAllMonitors : false ,
146+ inOverview : false ,
147+ onLockScreen : false ,
140148 } ;
141149 this . conditions = {
142150 pauseOnMaximizeOrFullscreen : this . settings . get_int (
@@ -158,15 +166,40 @@ const PauseOnMaximizeOrFullscreenModule = GObject.registerClass(
158166 this . windows = [ ] ;
159167 this . windowAddedId = null ;
160168 this . windowRemovedId = null ;
169+ this . overviewShowingId = null ;
170+ this . overviewHiddenId = null ;
171+ this . sessionModeUpdatedId = null ;
172+ this . showingDesktopChangedId = null ;
161173 }
162174
163175 override enable ( ) : void {
176+ this . overviewShowingId = Main . overview . connect ( 'showing' , ( ) => {
177+ this . logger . debug ( 'overview showing' ) ;
178+ this . update ( ) ;
179+ } ) ;
180+ this . overviewHiddenId = Main . overview . connect ( 'hidden' , ( ) => {
181+ this . logger . debug ( 'overview hidden' ) ;
182+ this . update ( ) ;
183+ } ) ;
184+ this . sessionModeUpdatedId = Main . sessionMode . connect ( 'updated' , ( ) => {
185+ this . update ( ) ;
186+ } ) ;
187+
164188 this . workspaceManager = global . workspace_manager ;
165189 this . activeWorkspace = this . workspaceManager . get_active_workspace ( ) ;
166190 this . activeWorkspaceChangedId = this . workspaceManager . connect (
167191 'active-workspace-changed' ,
168192 ( wm : Meta . WorkspaceManager ) => this . onActiveWorkspaceChanged ( wm )
169193 ) ;
194+ // The show-desktop shortcut hides windows without minimizing them,
195+ // so no per-window signal fires; watch the workspace-level signal.
196+ this . showingDesktopChangedId = this . workspaceManager . connect (
197+ 'showing-desktop-changed' ,
198+ ( ) => {
199+ this . logger . debug ( 'showing-desktop changed' ) ;
200+ this . update ( ) ;
201+ }
202+ ) ;
170203
171204 this . activeWorkspace
172205 . list_windows ( )
@@ -262,9 +295,12 @@ const PauseOnMaximizeOrFullscreenModule = GObject.registerClass(
262295 }
263296
264297 override update ( ) : void {
298+ // showing_on_its_workspace() is false for minimized windows and for
299+ // windows hidden by the show-desktop shortcut, so neither counts as
300+ // covering the wallpaper.
265301 const metaWindows = this . windows
266302 . map ( ( { metaWindow} ) => metaWindow )
267- . filter ( w => ! w . title ?. includes ( APPLICATION_ID ) && ! w . minimized ) ;
303+ . filter ( w => ! w . title ?. includes ( APPLICATION_ID ) && w . showing_on_its_workspace ( ) ) ;
268304
269305 const monitors = Main . layoutManager . monitors ;
270306
@@ -283,10 +319,21 @@ const PauseOnMaximizeOrFullscreenModule = GObject.registerClass(
283319 monitor => monitorsWithMaximized [ monitor . index ]
284320 ) ;
285321
322+ this . states . inOverview = Main . overview . visible ;
323+ this . states . onLockScreen =
324+ Main . sessionMode . currentMode === 'unlock-dialog' ;
325+
286326 super . update ( ) ;
287327 }
288328
289329 override shouldAutoPause ( ) : boolean {
330+ // Maximized/fullscreen windows don't cover the wallpaper while the
331+ // overview or the lock screen is shown.
332+ if ( this . states . inOverview || this . states . onLockScreen ) {
333+ this . logger . debug ( 'shouldAutoPause: false (overview or lock screen)' ) ;
334+ return false ;
335+ }
336+
290337 let res = false ;
291338 if (
292339 this . conditions . pauseOnMaximizeOrFullscreen ===
@@ -306,18 +353,31 @@ const PauseOnMaximizeOrFullscreenModule = GObject.registerClass(
306353
307354 override disable ( ) : void {
308355 this . workspaceManager ?. disconnect ( this . activeWorkspaceChangedId ! ) ;
356+ if ( this . showingDesktopChangedId !== null )
357+ this . workspaceManager ?. disconnect ( this . showingDesktopChangedId ) ;
309358 this . windows . forEach ( ( { metaWindow, signals} ) =>
310359 signals . forEach ( signal => metaWindow . disconnect ( signal ) )
311360 ) ;
312361 this . activeWorkspace ?. disconnect ( this . windowAddedId ! ) ;
313362 this . activeWorkspace ?. disconnect ( this . windowRemovedId ! ) ;
314363
364+ if ( this . overviewShowingId !== null )
365+ Main . overview . disconnect ( this . overviewShowingId ) ;
366+ if ( this . overviewHiddenId !== null )
367+ Main . overview . disconnect ( this . overviewHiddenId ) ;
368+ if ( this . sessionModeUpdatedId !== null )
369+ Main . sessionMode . disconnect ( this . sessionModeUpdatedId ) ;
370+
315371 this . workspaceManager = null ;
316372 this . activeWorkspace = null ;
317373 this . activeWorkspaceChangedId = null ;
318374 this . windows = [ ] ;
319375 this . windowAddedId = null ;
320376 this . windowRemovedId = null ;
377+ this . overviewShowingId = null ;
378+ this . overviewHiddenId = null ;
379+ this . sessionModeUpdatedId = null ;
380+ this . showingDesktopChangedId = null ;
321381 }
322382 }
323383) ;
0 commit comments