@@ -103,18 +103,20 @@ workspace.clientActivated.connect(onActivated);
103
103
function onActivated ( client ) {
104
104
if ( client == null || client == undefined ) return ;
105
105
if ( undoAutoReactivate ( client ) ) return ;
106
- debug ( "\nactivated " , client . caption ) ;
106
+ debug ( "activated " , client . caption ) ;
107
107
addActive ( client ) ;
108
108
removeMinimized ( client ) ;
109
- onRegeometrized ( client ) ;
109
+ minimizeOverlapping ( client ) ;
110
+ debug ( "" ) ;
110
111
}
111
112
112
113
// add to watchlist on added and trigger minimize and restore when client is moved or resized or screen geometry changes
113
114
workspace . clientList ( ) . forEach ( client => onAdded ( client ) ) ;
114
115
workspace . clientAdded . connect ( onAdded ) ;
115
116
function onAdded ( client ) {
116
- debug ( "\nadded " , client . caption ) ;
117
+ debug ( "added " , client . caption ) ;
117
118
added = [ client ] ;
119
+ debug ( "" ) ;
118
120
client . geometryChanged . connect ( onRegeometrized ) ;
119
121
client . clientGeometryChanged . connect ( onRegeometrized ) ;
120
122
client . frameGeometryChanged . connect ( onRegeometrized ) ;
@@ -133,32 +135,35 @@ function onAdded(client) {
133
135
}
134
136
function onRegeometrized ( client ) {
135
137
// don't act on windows that are still undergoing geometry change
136
- if ( client == null || client == undefined || client . caption == undefined || client . caption == "Plasma" || client . move || client . resize ) return ;
137
- debug ( "\nregeometrized " , client . caption ) ;
138
+ if ( client == null || client == undefined || client . caption == "Plasma" || client . move || client . resize ) return ;
139
+ debug ( "regeometrized " , client . caption ) ;
138
140
removeMinimized ( client ) ;
139
- onRegeometrized ( client ) ;
140
- restoreMinimized ( ) ;
141
+ minimizeOverlapping ( client ) ;
142
+ restoreMinimized ( client ) ;
143
+ debug ( "" ) ;
141
144
}
142
145
143
146
// trigger minimize, restore and reactivate when client minimized
144
147
workspace . clientMinimized . connect ( onMinimized ) ;
145
148
function onMinimized ( client ) {
146
- debug ( "\nminimized " , client && client . caption ? client . caption : client ) ;
149
+ debug ( "minimized " , client && client . caption ? client . caption : client ) ;
147
150
resetMinimized ( client ) ;
148
151
if ( ! minimized . includes ( client ) ) { // manually minimized
149
152
removeActive ( client ) ;
150
153
}
151
- restoreMinimized ( ) ;
154
+ restoreMinimized ( client ) ;
155
+ debug ( "" ) ;
152
156
}
153
157
154
158
// trigger minimize, restore and reactivate when client is closed
155
159
workspace . clientRemoved . connect ( onRemoved ) ;
156
160
function onRemoved ( client ) {
157
- debug ( "\nclosed " , client && client . caption ? client . caption : client ) ;
161
+ debug ( "closed " , client && client . caption ? client . caption : client ) ;
158
162
removeActive ( client ) ;
159
163
removeMinimized ( client ) ;
160
- restoreMinimized ( ) ;
164
+ restoreMinimized ( client ) ;
161
165
removed = true ;
166
+ debug ( "" ) ;
162
167
}
163
168
164
169
@@ -167,7 +172,7 @@ function onRemoved(client) {
167
172
///////////////////////
168
173
169
174
// minimize all windows overlapped by active window
170
- function onRegeometrized ( active ) {
175
+ function minimizeOverlapping ( active ) {
171
176
// if no window is provided, try the active window, if that fails too abort
172
177
if ( active == null || active == undefined ) active = workspace . activeClient ;
173
178
if ( active == undefined || active == null ) return ;
@@ -187,9 +192,10 @@ function onRegeometrized(active) {
187
192
}
188
193
189
194
// restore all previously minimized windows that are now no longer overlapping
190
- function restoreMinimized ( ) {
195
+ function restoreMinimized ( trigger ) {
191
196
// don't restore if auto-restore is disabled
192
197
if ( ! config . autoRestore ) return ;
198
+ debug ( "try restore for" , trigger . caption ) ;
193
199
194
200
// iterate minimized windows
195
201
minimized = minimized . filter ( client => client != null && client != undefined
0 commit comments