This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Script "Minimize All"

Tags: None
(comma "," separated)
openmind
Registered Member
Posts
10
Karma
0

Script "Minimize All"

Sat Nov 28, 2015 10:42 am
As the subject line doesn't allow enough characters:
Plasma 5: Instead of minimizing a single open window, "Minimize All" brings up the formerly minimized ones

Hi!

Up to a point the script "Minimize All" works like expected/wanted:

When applied, it minimizes all windows. When I then open one of the minimized ones or start a new program, only this one shows up - so far, so good.

However, when I now apply Minimize All again to minimize this window, the formerly minimized ones show up again. So I have to apply it twice to min. the window.

That's a bit inconvenient.

Is there a way to improve this, in order to achieve exactly the same as "ShowDesktopIsMinimizeAll=true" in Plasma 4?

In addition, is there a way to connect "Minimize All" with the widget "Show desktop"? Because "Show desktop" is exactly what I do NOT want. ;)

Regards!

OpenMind
luebking
Karma
0

Re: Script "Minimize All"

Sat Nov 28, 2015 8:45 pm
Apply this patch to /usr/share/kwin/scripts/minimizeall/contents/code/main.js and restart "kwin_x11 --replace &"

I don't know whether it's an improvement or the behavior of ShowDesktopIsMinimizeAll, but it will reverse the toggle logic (preferring the hide)

If you feel the current behavior is wrong, please open a bug/wish on bugs.kde.org, so it will be fixed (or improved ;-) upstream.
Unfortunately, we're post the 5.5 freeze and this is a behvaioral change, so we can only add an option or alter the behavior for 5.6, so you might want to temporarily shadow the script with a local copy in ~/.local/share/kwin/scripts (to prevent the patch from being overridden with every package update)

About the plasmoid: it's possible to bind plasmoids to shortcuts (many do just that), but i don't think is possible to configure the existing one in this way.
(I lack experience in this context, though)


Code: Select all
--- /home/src/KDE/kwin/scripts/minimizeall/contents/code/main.js       2015-04-07 23:59:17.398362783 +0200
+++ /usr/share/kwin/scripts/minimizeall/contents/code/main.js   2015-11-28 21:33:51.653440924 +0100
@@ -27,12 +27,12 @@ function isRelevant(client) {
 var minimizeAllWindows = function() {
     var allClients = workspace.clientList();
     var clients = [];
-    var minimize = true;
+    var minimize = false;
     for (var i = 0; i < allClients.length; ++i) {
         if (isRelevant(allClients[i])) {
             clients.push(allClients[i]);
-            if (allClients[i].minimizedForMinimizeAll === true) {
-                minimize = false;
+            if (allClients[i].minimizedForMinimizeAll !== true) {
+                minimize = true;
             }
         }
     }
openmind
Registered Member
Posts
10
Karma
0

Re: Script "Minimize All"

Sun Nov 29, 2015 1:55 pm
luebking wrote:Apply this patch to /usr/share/kwin/scripts/minimizeall/contents/code/main.js and restart "kwin_x11 --replace &"

I don't know whether it's an improvement or the behavior of ShowDesktopIsMinimizeAll, but it will reverse the toggle logic (preferring the hide)

If you feel the current behavior is wrong, please open a bug/wish on bugs.kde.org, so it will be fixed (or improved ;-) upstream.
Unfortunately, we're post the 5.5 freeze and this is a behvaioral change, so we can only add an option or alter the behavior for 5.6, so you might want to temporarily shadow the script with a local copy in ~/.local/share/kwin/scripts (to prevent the patch from being overridden with every package update)

About the plasmoid: it's possible to bind plasmoids to shortcuts (many do just that), but i don't think is possible to configure the existing one in this way.
(I lack experience in this context, though)


Code: Select all
--- /home/src/KDE/kwin/scripts/minimizeall/contents/code/main.js       2015-04-07 23:59:17.398362783 +0200
+++ /usr/share/kwin/scripts/minimizeall/contents/code/main.js   2015-11-28 21:33:51.653440924 +0100
@@ -27,12 +27,12 @@ function isRelevant(client) {
 var minimizeAllWindows = function() {
     var allClients = workspace.clientList();
     var clients = [];
-    var minimize = true;
+    var minimize = false;
     for (var i = 0; i < allClients.length; ++i) {
         if (isRelevant(allClients[i])) {
             clients.push(allClients[i]);
-            if (allClients[i].minimizedForMinimizeAll === true) {
-                minimize = false;
+            if (allClients[i].minimizedForMinimizeAll !== true) {
+                minimize = true;
             }
         }
     }


Thank you for your instant support!

The patch did not quite achieve the desired result: When - after a "Minimize All" - I opened a window and then applied "MA" again, the minimized windows came up again.

So I modified it a bit. Now it also mins this single window. Not yet OK: When applied again, the formerly minim. windows also come up again.
It now looks like this:

Code: Select all
var minimizeAllWindows = function() {
    var allClients = workspace.clientList();
    var clients = [];
    var minimize = false;
    for (var i = 0; i < allClients.length; ++i) {
        if (isRelevant(allClients[i])) {
            clients.push(allClients[i]);
            if (allClients[i].minimizedForMinimizeAll !== true || allClients[i].minimized !== true) {
                minimize = true;
            }
        }
    }


Bit in a hurry.

CU!

OpenMind
luebking
Karma
0

Re: Script "Minimize All"

Sun Nov 29, 2015 2:02 pm
Leaving aside that I tried the patch, your modification would imply that a window is marked as minimizedForMinimizeAll yet is *not* minimized, what should no way happen.

Did you shadow the script and if so, did you copy the entire script folder or only this one file into the local position (for afair the latter won't work)
openmind
Registered Member
Posts
10
Karma
0

Re: Script "Minimize All"

Sun Nov 29, 2015 4:22 pm
luebking wrote:Leaving aside that I tried the patch, your modification would imply that a window is marked as minimizedForMinimizeAll yet is *not* minimized, what should no way happen.

Did you shadow the script and if so, did you copy the entire script folder or only this one file into the local position (for afair the latter won't work)


I left it all in place.

The patch applied cleanly, this is the relevant part of main.js afterwards:

Code: Select all
var minimizeAllWindows = function() {
    var allClients = workspace.clientList();
    var clients = [];
    var minimize = false;
    for (var i = 0; i < allClients.length; ++i) {
        if (isRelevant(allClients[i])) {
            clients.push(allClients[i]);
            if (allClients[i].minimizedForMinimizeAll !== true) {
                minimize = true;
            }
        }
    }


This is what I did then and the results:
Reboot (because "kwin_x11 --replace &" did not work, desktop no longer responsive)

3 windows open
MA: all minimized
MA: all there again (OK)
MA: all min.
open one of min. windows
MA: all 3 windows visible (not OK)

With my modif.:
Reboot.

3 windows open
MA: all minimized
MA: all there again (OK)
MA: all min.
open one of min. windows
MA: all minimized (OK)
MA: all there again (not OK, only the last one visible should open)

That's what I see here.
openmind
Registered Member
Posts
10
Karma
0

Re: Script "Minimize All"

Sun Nov 29, 2015 6:47 pm
luebking wrote:Leaving aside that I tried the patch, your modification would imply that a window is marked as minimizedForMinimizeAll yet is *not* minimized, what should no way happen.


I was wondering why the patch didn't work as I expected and thought that perhaps "minimized" and "minimizedForMinimizeAll" might be independent of each other. So if I open a window after having applied MA it would no longer be minimized (obviously) but still be marked as "minimizedForMinimizeAll". That's why I adapted the code accordingly. And as it worked, I thought that was right. ;)

What is the "minimizedForMinimizeAll" - property good for, BTW?
I left it out in the following example and that works, too:

Code: Select all
var minimizeAllWindows = function() {
    var allClients = workspace.clientList();
    var clients = [];
    var minimize = false;
    for (var i = 0; i < allClients.length; ++i) {
        if (isRelevant(allClients[i])) {
            clients.push(allClients[i]);
            if (allClients[i].minimized !== true) {
                minimize = true;
            }
        }
    }
    for (var i = 0; i < clients.length; ++i) {
        if (minimize && clients[i].minimized)
            continue;
        clients[i].minimized = minimize;
        /* clients[i].minimizedForMinimizeAll = minimize; */
    }
    clients = [];
}
luebking
Karma
0

Re: Script "Minimize All"

Mon Nov 30, 2015 1:53 pm
openmind wrote:MA: all minimized (OK)
MA: all there again (not OK, only the last one visible should open)


Ok. No idea whether that's how the SDIMA key worked (or this is actually desired), but the script doesn't try to reach that.
For this behavior the minimizedForMinimizeAll property needs to be removed from all windows (except the newly minimized) on the second minimization. (That's also why the property exists, we don't restore windows which are randomly minimized, but only the ones the script actually minimized on invocation)

=> please file a bug against kwin on bugs.kde.org, since I'd like the maintainer to have a brief look and we can also link all reporters of "show desktop should be minimize all" to say a word. We might end up keeping the one we have or a variation and ship -other- variations via GHNS only (ie. user installation)
I'll attach script variants to the bug then (that's better than stashing them in some forum)
openmind
Registered Member
Posts
10
Karma
0

Re: Script "Minimize All"

Mon Nov 30, 2015 9:48 pm
luebking wrote:=> please file a bug against kwin on bugs.kde.org, since I'd like the maintainer to have a brief look and we can also link all reporters of "show desktop should be minimize all" to say a word. We might end up keeping the one we have or a variation and ship -other- variations via GHNS only (ie. user installation)
I'll attach script variants to the bug then (that's better than stashing them in some forum)


Alright, filed a bug report (356128) - but it's to be seen as a suggestion to improve plasma-5-usability.

So long!

OpenMind
luebking
Karma
0

Re: Script "Minimize All"

Mon Nov 30, 2015 10:17 pm
Noticed.

Please don't feel offended by the reply, but if we do not take this under strict control, the topic has proven to be very flamewar prone (for more than a decade and 3 KWin maintainers) and that won't be any constructive on topic, ok?
Show Desktop was *not* specified for janitorial purposes.
SDIMA was just added because some users really nagged the **** out of the maintainer who introuced it at the time (and imo it should never have been added this way, ie. by altering the spec implementation)


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft