@@ -206,7 +206,19 @@ void Panel::updateWinList() {
206
206
});
207
207
}
208
208
else {
209
- if (!desktopInfo.isOnCurrentDesktop ()) {
209
+ if (desktopInfo.isOnCurrentDesktop ()) {
210
+ KWindowInfo nameInfo (*it, NET::WMName);
211
+ QString newName = nameInfo.name ();;
212
+ unsigned short sz = newName.length ();
213
+ newName.truncate (15 );
214
+ if (newName.length () < sz) {
215
+ newName += " ..." ;
216
+ }
217
+ if (winWidgets[*it]->text () != newName) {
218
+ winWidgets[*it]->setText (newName);
219
+ }
220
+ }
221
+ else {
210
222
delete winWidgets[*it];
211
223
winWidgets.remove (*it);
212
224
}
@@ -219,14 +231,16 @@ void Panel::updateWinTitles() {
219
231
for (auto it = winIDs->cbegin (), end = winIDs->cend (); it != end; ++it) {
220
232
KWindowInfo pIDInfo (*it, NET::WMPid);
221
233
if (pIDInfo.pid () != panelPID) {
222
- QString title = KWindowSystem::readNameProperty (*it, 39 );
223
- unsigned short sz = title.length ();
224
- title.truncate (15 );
225
- if (title.length () < sz) {
226
- title += " ..." ;
227
- }
228
- if (winWidgets[*it]->text () != title) {
229
- winWidgets[*it]->setText (title);
234
+ if (winWidgets.contains (*it)) {
235
+ QString title = KWindowSystem::readNameProperty (*it, 39 );
236
+ unsigned short sz = title.length ();
237
+ title.truncate (15 );
238
+ if (title.length () < sz) {
239
+ title += " ..." ;
240
+ }
241
+ if (winWidgets[*it]->text () != title) {
242
+ winWidgets[*it]->setText (title);
243
+ }
230
244
}
231
245
}
232
246
}
@@ -245,6 +259,7 @@ void Panel::accentActiveWindow() {
245
259
246
260
247
261
void Panel::updateWorkspaces () {
262
+ this ->updateWinList ();
248
263
visibleDesktop = KWindowSystem::currentDesktop ();
249
264
for (qint8 workspace = 0 ; workspace < countWorkspaces; ++workspace) {
250
265
if ((workspace+1 ) == visibleDesktop) {
@@ -363,16 +378,7 @@ void Panel::setRepeatingActions() {
363
378
// Window list applet
364
379
if (activeAppletsList.contains (" windowlist" )) {
365
380
if (!QString::compare (getenv (" XDG_SESSION_TYPE" ), " x11" , Qt::CaseInsensitive)) {
366
- /* QTimer* updateWinListTimer = new QTimer(this);
367
- updateWinListTimer->setInterval(400);
368
- this->connect(updateWinListTimer, &QTimer::timeout, this, [this]() {
369
- this->updateWinList();
370
- });
371
- updateWinListTimer->start();
372
- activeTimers.append(updateWinListTimer);*/
373
-
374
381
this ->connect (KWindowSystem::self (), &KWindowSystem::windowAdded, this , &Panel::updateWinList);
375
- // this->connect(KWindowSystem::self(), &KWindowSystem::windowRemoved, this, &Panel::updateWinList);
376
382
this ->connect (KWindowSystem::self (), &KWindowSystem::activeWindowChanged, this , &Panel::accentActiveWindow);
377
383
378
384
QTimer* updateTitleTimer = new QTimer (this );
@@ -382,7 +388,6 @@ void Panel::setRepeatingActions() {
382
388
});
383
389
updateTitleTimer->start ();
384
390
activeTimers.append (updateTitleTimer);
385
-
386
391
}
387
392
else {
388
393
qDebug () << " Window List applet currently works only on X11. Skipping..." ;
@@ -401,7 +406,10 @@ void Panel::setRepeatingActions() {
401
406
updateWorkspacesTimer->start();
402
407
activeTimers.append(updateWorkspacesTimer);*/
403
408
404
- this ->connect (KWindowSystem::self (), &KWindowSystem::currentDesktopChanged, this , &Panel::updateWorkspaces);
409
+ this ->connect (KWindowSystem::self (), &KWindowSystem::currentDesktopChanged, this , [this ]() {
410
+ qDebug () << " WORKSPACE" ;
411
+ this ->updateWorkspaces ();
412
+ });
405
413
}
406
414
407
415
// Local IP applet
0 commit comments