Blob Blame History Raw
diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml
index 77676bf..6772d06 100644
--- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml
+++ b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml
@@ -19,6 +19,29 @@ import org.kde.kwin.decoration 0.1
 import org.kde.kwin.decorations.plastik 1.0
 
 Decoration {
+    function removeDisabledButtons(buttons) {
+        var btns = "";
+        for (var i = 0; i < buttons.length; i++) {
+            if (buttons[i] == 'I') {
+                if (!decoration.minimizeable) {
+                    continue;
+                }
+            }
+            if (buttons[i] == 'A') {
+                if (!decoration.maximizeable) {
+                    continue;
+                }
+            }
+            if (buttons[i] == 'X') {
+                if (!decoration.closeable) {
+                    continue;
+                }
+            }
+            btns += buttons[i];
+        }
+        return btns;
+    }
+    
     function readConfig() {
         switch (decoration.readConfig("BorderSize", DecorationOptions.BorderNormal)) {
         case DecorationOptions.BorderTiny:
@@ -263,11 +286,13 @@ Decoration {
                     shadeButton: shadeButtonComponent
                     allDesktopsButton: stickyButtonComponent
                     closeButton: closeButtonComponent
-                    buttons: options.titleButtonsLeft
                     anchors {
                         top: parent.top
                         left: parent.left
                     }
+                    Component.onCompleted: {
+                        buttons = removeDisabledButtons(options.titleButtonsLeft);
+                    }
                 }
                 Text {
                     id: caption
@@ -304,11 +329,13 @@ Decoration {
                     shadeButton: shadeButtonComponent
                     allDesktopsButton: stickyButtonComponent
                     closeButton: closeButtonComponent
-                    buttons: options.titleButtonsRight
                     anchors {
                         top: parent.top
                         right: parent.right
                     }
+                    Component.onCompleted: {
+                        buttons = removeDisabledButtons(options.titleButtonsRight);
+                    }
                 }
             }
         }