@@ -191,13 +191,16 @@ export class EngineImpl implements Engine {
191
191
const srf = basis . surface ;
192
192
const layout = this . layouts . getCurrentLayout ( srf ) ;
193
193
if ( layout . adjust ) {
194
- const area = srf . workingArea . gap (
195
- this . config . screenGapLeft ,
196
- this . config . screenGapRight ,
197
- this . config . screenGapTop ,
198
- this . config . screenGapBottom
199
- ) ;
200
194
const tiles = this . windows . visibleTiledWindowsOn ( srf ) ;
195
+ const noGaps = tiles . length == 1 && this . config . smartGaps ;
196
+ const area = noGaps
197
+ ? srf . workingArea
198
+ : srf . workingArea . gap (
199
+ this . config . screenGapLeft ,
200
+ this . config . screenGapRight ,
201
+ this . config . screenGapTop ,
202
+ this . config . screenGapBottom
203
+ ) ;
201
204
layout . adjust ( area , tiles , basis , basis . geometryDelta ) ;
202
205
}
203
206
}
@@ -285,18 +288,17 @@ export class EngineImpl implements Engine {
285
288
286
289
const layout = this . layouts . getCurrentLayout ( srf ) ;
287
290
if ( layout . adjust ) {
288
- const area = srf . workingArea . gap (
289
- this . config . screenGapLeft ,
290
- this . config . screenGapRight ,
291
- this . config . screenGapTop ,
292
- this . config . screenGapBottom
293
- ) ;
294
- layout . adjust (
295
- area ,
296
- this . windows . visibleTileableWindowsOn ( srf ) ,
297
- basis ,
298
- delta
299
- ) ;
291
+ const tiles = this . windows . visibleTiledWindowsOn ( srf ) ;
292
+ const noGaps = tiles . length == 1 && this . config . smartGaps ;
293
+ const area = noGaps
294
+ ? srf . workingArea
295
+ : srf . workingArea . gap (
296
+ this . config . screenGapLeft ,
297
+ this . config . screenGapRight ,
298
+ this . config . screenGapTop ,
299
+ this . config . screenGapBottom
300
+ ) ;
301
+ layout . adjust ( area , tiles , basis , delta ) ;
300
302
}
301
303
}
302
304
@@ -330,9 +332,8 @@ export class EngineImpl implements Engine {
330
332
const layout = this . layouts . getCurrentLayout ( screenSurface ) ;
331
333
332
334
const workingArea = screenSurface . workingArea ;
333
- const tilingArea = this . getTilingArea ( workingArea , layout ) ;
334
-
335
335
const visibleWindows = this . windows . visibleWindowsOn ( screenSurface ) ;
336
+ const tilingArea = this . getTilingArea ( workingArea , layout , visibleWindows ) ;
336
337
337
338
// Set correct window state for new windows
338
339
visibleWindows . forEach ( ( win : EngineWindow ) => {
@@ -740,9 +741,17 @@ export class EngineImpl implements Engine {
740
741
*
741
742
* @param workingArea area in which we are allowed to work. @see DriverSurface#workingArea
742
743
* @param layout windows layout used
744
+ * @param visibleWindows the windows visible in the working area.
743
745
*/
744
- private getTilingArea ( workingArea : Rect , layout : WindowsLayout ) : Rect {
745
- if ( this . config . monocleMaximize && layout instanceof MonocleLayout ) {
746
+ private getTilingArea (
747
+ workingArea : Rect ,
748
+ layout : WindowsLayout ,
749
+ visibleWindows : EngineWindow [ ]
750
+ ) : Rect {
751
+ if (
752
+ ( this . config . monocleMaximize && layout instanceof MonocleLayout ) ||
753
+ ( visibleWindows . length == 1 && this . config . smartGaps )
754
+ ) {
746
755
return workingArea ;
747
756
} else {
748
757
return workingArea . gap (
0 commit comments