KWin-Script lauffähig unter Plasma 6: KPackageStructure + frameGeometry-Objekt
- metadata.json: ohne KPackageStructure=KWin/Script verwirft KWin 6 das
Paket schon beim Einsammeln (isScriptLoaded blieb false)
- main.js: KWin-Scripts laufen in reiner QJSEngine ohne QML-Globals,
Qt.rect warf 'Qt is not defined' — die Engine konvertiert ein
{x,y,width,height}-Objekt selbst nach QRectF
This commit is contained in:
@@ -28,7 +28,9 @@ function place(w) {
|
|||||||
if (y < area.y) y = area.y;
|
if (y < area.y) y = area.y;
|
||||||
if (y + height > area.y + area.height) y = area.y + area.height - height;
|
if (y + height > area.y + area.height) y = area.y + area.height - height;
|
||||||
|
|
||||||
w.frameGeometry = Qt.rect(x, y, width, height);
|
// Reine QJSEngine, kein QML: `Qt.rect` gibt es hier nicht; die Engine
|
||||||
|
// konvertiert ein {x,y,width,height}-Objekt selbst nach QRectF.
|
||||||
|
w.frameGeometry = { x: x, y: y, width: width, height: height };
|
||||||
}
|
}
|
||||||
|
|
||||||
// windowAdded feuert beim (erneuten) Mappen des Popups, windowActivated fängt
|
// windowAdded feuert beim (erneuten) Mappen des Popups, windowActivated fängt
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"License": "MIT",
|
"License": "MIT",
|
||||||
"EnabledByDefault": false
|
"EnabledByDefault": false
|
||||||
},
|
},
|
||||||
|
"KPackageStructure": "KWin/Script",
|
||||||
"X-Plasma-API": "javascript",
|
"X-Plasma-API": "javascript",
|
||||||
"X-Plasma-MainScript": "code/main.js"
|
"X-Plasma-MainScript": "code/main.js"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user