From e51ee45b622859efa5b1f4bbfc4f25d06b0fdbda Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Tue, 4 Jul 2023 21:08:42 +0200 Subject: Updated 6 files and added core/status/icons/window.svg (automated) --- ROADMAP.md | 4 ++-- core/desktop/index.html | 2 +- core/desktop/wm.js | 35 +++++++++++++++++++++++++---------- core/launcher/index.html | 2 +- core/status/icons/window.svg | 1 + core/status/index.html | 23 +++++++++++++++++++++-- main.js | 4 ---- 7 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 core/status/icons/window.svg diff --git a/ROADMAP.md b/ROADMAP.md index 8e359a2..2c0ac13 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -5,9 +5,9 @@ * [ ] Desktop * [x] Window manager **- Raindrops** * [x] Application menu **- Raindrops** - * [ ] Task bar **- Raindrops** + * [x] Task bar **- Raindrops** * [ ] Media keys - * [ ] Application switcher + * [ ] Application switcher **- Raindrops** * [ ] Notifications * [x] Status bar **- Raindrops** * [x] Power options **- Raindrops** diff --git a/core/desktop/index.html b/core/desktop/index.html index 7719cce..e8e578b 100644 --- a/core/desktop/index.html +++ b/core/desktop/index.html @@ -413,7 +413,7 @@ let config = JSON.parse(fs.readFileSync(file + "/app.json").toString()); if (!fs.existsSync(file + "/index.html")) throw new Error("No index.html found"); - config['application'] = file; + config['application'] = name; config['title'] = name; config['sandbox'] = true; config['isolatedPath'] = file; diff --git a/core/desktop/wm.js b/core/desktop/wm.js index c2bfcda..d4db82c 100644 --- a/core/desktop/wm.js +++ b/core/desktop/wm.js @@ -1,5 +1,4 @@ const uuid = require('uuid-v4'); -const { ipcRenderer } = require('electron'); const path = require("path"); const crypto = require("crypto"); @@ -37,6 +36,8 @@ class WindowManager { index++; } + + document.getElementById("status").contentWindow.updateTitlebar(); } getWindow(id) { @@ -85,9 +86,6 @@ class WindowManager { get maximizable() { return properties[id]["maximizable"]; }, - get focused() { - return properties[id]["focused"]; - }, get minimised() { return properties[id]["minimised"]; }, @@ -236,7 +234,6 @@ class WindowManager { maximizable: options['maximizable'] ?? true, minimizable: options['minimizable'] ?? true, debuggable: options['debuggable'] ?? false, - focused: options['focused'] ?? true, resizable: options['resizable'] ?? true, minimised: options['minimised'] ?? false, maximised: options['maximised'] ?? false @@ -572,7 +569,7 @@ class WindowManager { } function stopResize() { - document.querySelector('#window-' + id + ' .window-contents-webview').style.pointerEvents = ""; + if (document.querySelector('#window-' + id + ' .window-contents-webview')) document.querySelector('#window-' + id + ' .window-contents-webview').style.pointerEvents = ""; window.removeEventListener('mousemove', resize) } } @@ -582,6 +579,8 @@ class WindowManager { i.#list.push(id); i.#updateFocus(); + + res(); } }); @@ -644,6 +643,8 @@ class WindowManager { delete this.#properties[id]; this.#updateFocus(); + document.getElementById("status").contentWindow.updateTitlebar(); + // TODO: Broadcast a close event to the client } @@ -662,6 +663,8 @@ class WindowManager { this.#updateFocus(); this.#properties[id].minimised = false; + document.getElementById("status").contentWindow.updateTitlebar(); + // TODO: Broadcast an unminimise event to the client } @@ -670,7 +673,9 @@ class WindowManager { document.getElementById("window-" + id).classList.add("window-minimised"); delete this.#stack[this.#stack.indexOf(id)]; this.#updateFocus(); - this.#properties[id].minimised = false; + this.#properties[id].minimised = true; + + document.getElementById("status").contentWindow.updateTitlebar(); // TODO: Broadcast a minimise event to the client } @@ -679,10 +684,10 @@ class WindowManager { if (!this.#properties[id].webContents) return; document.getElementById("window-" + id + "-contents-webview").closeDevTools(); document.getElementById("window-" + id + "-contents-webview").openDevTools(); - ipcRenderer.send("blur"); } focusWindow(id) { + if (document.getElementById("window-" + id).classList.contains("window-minimised")) wm.unminimiseWindow(id); if (!document.getElementById("window-" + id).classList.contains("window-inactive")) return; delete this.#stack[this.#stack.indexOf(id)]; this.#stack.unshift(id); @@ -725,9 +730,19 @@ class WindowManager { id, title: win.title, minimised: win.minimised, - focused: wm.getWindow(id).focused, - application: win.application ?? null + focused: !document.getElementById("window-" + id).classList.contains("window-inactive") && !document.getElementById("window-" + id).classList.contains("window-minimised"), + application: win.isolatedPath ?? null } }); } + + taskbarAction(id) { + if (document.getElementById("window-" + id).classList.contains("window-minimised")) { + this.unminimiseWindow(id); + } else if (document.getElementById("window-" + id).classList.contains("window-inactive")) { + this.focusWindow(id); + } else if (this.#properties[id].minimizable) { + this.minimiseWindow(id); + } + } } \ No newline at end of file diff --git a/core/launcher/index.html b/core/launcher/index.html index 233bfcb..a1c164a 100644 --- a/core/launcher/index.html +++ b/core/launcher/index.html @@ -111,7 +111,7 @@ \ No newline at end of file diff --git a/main.js b/main.js index fa7d208..9a36226 100644 --- a/main.js +++ b/main.js @@ -24,10 +24,6 @@ const createWindow = () => { mainWindow.maximize(); - ipcMain.on('blur', () => { - mainWindow.blur(); - }); - mainWindow.loadFile('./core/startup/index.html'); require("@electron/remote/main").enable(mainWindow.webContents); -- cgit