Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

KWin script: open the donut on the Activity and desktop in use (#557) (#610)

Cre8ive Marketing2d562869aee7
diff --git a/installer/linux/kwin/filee-donut/contents/code/main.js b/installer/linux/kwin/filee-donut/contents/code/main.js
index ee2ec0f6..7e18394e 100644
--- a/installer/linux/kwin/filee-donut/contents/code/main.js
+++ b/installer/linux/kwin/filee-donut/contents/code/main.js
@@ -1,6 +1,6 @@
// KWin script (Plasma 6) for the experimental Wayland gesture. Wayland gives Filee no cursor position and no say
-// over where its window opens, so this moves the donut window (class "Filee", title "Filee Donut") to the cursor
-// whenever it is mapped. Install it with kpackagetool6 and enable it; see installer/linux/INSTALL.txt.
+// over where its window opens, so this moves the donut window (class "Filee", title "Filee Donut") to the cursor,
+// on the Activity and desktop in use, whenever it is mapped. Install it with kpackagetool6 and enable it; see installer/linux/INSTALL.txt.
function isDonut(w) {
return String(w.resourceClass).toLowerCase() === "filee" && w.caption === "Filee Donut";
@@ -16,6 +16,19 @@ function centreOnCursor(w) {
}
}
+function onCurrentActivityAndDesktop(w) {
+ // Filee's donut belongs to the Activity and desktop where Filee's main window was, and raising it there makes
+ // KWin switch to them (#557): it goes where the user is instead. Without the Activities service the current
+ // Activity is "", and [""] would put the donut on none, so it's left alone then.
+ var activity = workspace.currentActivity;
+ if (activity) {
+ w.activities = [activity];
+ }
+ if (workspace.currentDesktop) {
+ w.desktops = [workspace.currentDesktop];
+ }
+}
+
function bringToFront(w) {
// A Wayland popup can otherwise be stacked behind the file manager that
// owns the drag, making the donut appear not to have opened.
@@ -29,6 +42,7 @@ workspace.windowAdded.connect(function (w) {
}
// Filee also positions the window itself (twice, to cope with DPI changes), so win the last few moves.
var left = 4;
+ onCurrentActivityAndDesktop(w); // before it's raised, or KWin goes to its Activity
centreOnCursor(w);
bringToFront(w);
w.frameGeometryChanged.connect(function () {
diff --git a/installer/linux/kwin/filee-donut/metadata.json b/installer/linux/kwin/filee-donut/metadata.json
index 9cd88d8b..982337a1 100644
--- a/installer/linux/kwin/filee-donut/metadata.json
+++ b/installer/linux/kwin/filee-donut/metadata.json
@@ -4,7 +4,7 @@
"Name": "Filee donut at the cursor",
"Description": "Moves Filee's donut window to the cursor, which Wayland apps cannot do themselves.",
"License": "MIT",
- "Version": "1.1"
+ "Version": "1.2"
},
"X-Plasma-API": "javascript",
"X-Plasma-MainScript": "code/main.js",