From 44d04911838114877ce002693af34040d723e753 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 23 Sep 2026 12:24:46 -0400 Subject: [PATCH] =?UTF-8?q?beautiful=20=F0=9F=98=A2"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.nix | 2 - skygqts.nu | 30 +- window-carousel/CarouselView.qml | 255 --------------- window-carousel/Compositor.qml | 300 ------------------ window-carousel/Theme.qml | 53 ---- window-carousel/shell.qml | 46 --- workspace-manager/Compositor.qml | 140 +++++++- workspace-manager/GotoView.qml | 151 ++++++++- workspace-manager/Theme.qml | 50 +++ .../WindowCard.qml | 57 ++-- workspace-manager/WindowLoop.qml | 191 +++++++++++ workspace-manager/shell.qml | 37 ++- 12 files changed, 593 insertions(+), 719 deletions(-) delete mode 100644 window-carousel/CarouselView.qml delete mode 100644 window-carousel/Compositor.qml delete mode 100644 window-carousel/Theme.qml delete mode 100644 window-carousel/shell.qml rename {window-carousel => workspace-manager}/WindowCard.qml (68%) create mode 100644 workspace-manager/WindowLoop.qml diff --git a/package.nix b/package.nix index dad257b..6e8df8d 100644 --- a/package.nix +++ b/package.nix @@ -16,7 +16,6 @@ stdenvNoCC.mkDerivation { fileset = lib.fileset.unions [ ./app-carousel ./workspace-manager - ./window-carousel ./skygqts.nu ]; }; @@ -30,7 +29,6 @@ stdenvNoCC.mkDerivation { mkdir -p $out/share/skygqts cp -r app-carousel $out/share/skygqts/ cp -r workspace-manager $out/share/skygqts/ - cp -r window-carousel $out/share/skygqts/ cp skygqts.nu $out/share/skygqts/ mkdir -p $out/bin makeWrapper ${lib.getExe nushell} $out/bin/skygqts \ diff --git a/skygqts.nu b/skygqts.nu index 865eb92..8a8f67d 100755 --- a/skygqts.nu +++ b/skygqts.nu @@ -43,30 +43,12 @@ def "main workspace-manager goto" [] { ws-ipc "goTo" } -const WC_PATH = $REPO_ROOT | path join "window-carousel" - -# Send an IPC call to the running window carousel -def wc-ipc [fn: string] { - qs ipc -p $WC_PATH call windows $fn +# Open the window carousel for the focused workspace +def "main workspace-manager windows" [] { + ws-ipc "openWindowSelection" } -# Run the window carousel -def "main window-carousel" [ - --daemon (-d) # detach from the terminal -] { - if $daemon { - qs -d -n -p $WC_PATH - } else { - qs -n -p $WC_PATH - } -} - -# Toggle the window carousel -def "main window-carousel toggle" [] { - wc-ipc "toggle" -} - -# Open the window carousel -def "main window-carousel open" [] { - wc-ipc "open" +# Open the workspace carousel with the name field focused +def "main workspace-manager rename" [] { + ws-ipc "openWorkspaceRename" } diff --git a/window-carousel/CarouselView.qml b/window-carousel/CarouselView.qml deleted file mode 100644 index a2bb476..0000000 --- a/window-carousel/CarouselView.qml +++ /dev/null @@ -1,255 +0,0 @@ -import QtQuick -import Quickshell -import Quickshell.Wayland - -// The windows sit on a strip bent into a closed loop, seen from a little -// above. The front half shows the outside of the strip, the back half shows -// the inside, so the far windows wrap around behind and face the viewer too. -PanelWindow { - id: root - - required property bool shellOpen - required property Compositor compositor - required property Theme theme - - signal requestClose - - visible: root.shellOpen - color: "transparent" - - exclusionMode: ExclusionMode.Ignore - WlrLayershell.namespace: "quickshell:window-carousel" - WlrLayershell.layer: WlrLayer.Overlay - WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None - - anchors { - top: true - left: true - right: true - bottom: true - } - - readonly property int count: root.compositor.windows.length - // Angle between two neighbours on the loop. - readonly property real angleStep: root.count > 0 ? 2 * Math.PI / root.count : 0 - // The loop is as long as the cards side by side, within limits. - readonly property real radius: { - const natural = root.count * (root.theme.cardWidth + root.theme.cardGap) / (2 * Math.PI); - const widest = root.width * root.theme.maxRadiusShare; - return Math.max(root.theme.minRadius, Math.min(natural, widest)); - } - - // Selected step. It is not wrapped, so the loop can keep turning the - // same way. Use selectedIndex for the position in the window list. - property int targetStep: 0 - // Follows targetStep smoothly and drives every card position. - property real turn: 0 - property bool animate: false - property bool seedPending: false - - readonly property int selectedIndex: root.wrapIndex(root.targetStep) - - Behavior on turn { - enabled: root.animate - NumberAnimation { - duration: root.theme.turnDuration - easing.type: Easing.OutCubic - } - } - - function wrapIndex(step: int): int { - if (root.count === 0) - return 0; - return ((step % root.count) + root.count) % root.count; - } - - // Angle of a card from the front, in radians, between -pi and pi. - function angleOf(index: int): real { - if (root.count === 0) - return 0; - let steps = (index - root.turn) % root.count; - if (steps < 0) - steps += root.count; - if (steps > root.count / 2) - steps -= root.count; - return steps * root.angleStep; - } - - function seedSelection(): void { - const list = root.compositor.windows; - const focused = list.findIndex(w => w.focused); - root.animate = false; - root.targetStep = focused >= 0 ? focused : 0; - root.turn = root.targetStep; - } - - function step(delta: int): void { - if (root.count === 0) - return; - root.animate = true; - root.targetStep += delta; - root.turn = root.targetStep; - } - - function activateAt(index: int): void { - const list = root.compositor.windows; - if (index >= 0 && index < list.length) - root.compositor.focusWindow(list[index].key); - root.requestClose(); - } - - onVisibleChanged: { - root.animate = false; - if (!root.visible) { - root.seedPending = false; - return; - } - root.seedPending = true; - root.compositor.refresh(); - Qt.callLater(() => focusScope.forceActiveFocus()); - } - - Connections { - target: root.compositor - - function onRefreshed(): void { - if (!root.visible || !root.seedPending) - return; - if (root.compositor.refreshQueued) - return; - root.seedPending = false; - root.seedSelection(); - } - } - - Rectangle { - anchors.fill: parent - color: root.theme.backdrop - - MouseArea { - anchors.fill: parent - onClicked: root.requestClose() - } - } - - Text { - anchors.centerIn: parent - visible: root.count === 0 && !root.seedPending - color: root.theme.labelColor - font.pixelSize: root.theme.emptySize - text: "No windows on this workspace" - } - - FocusScope { - id: focusScope - anchors.fill: parent - focus: root.visible - - Keys.onPressed: event => { - switch (event.key) { - case Qt.Key_Left: - case Qt.Key_Backtab: - root.step(-1); - break; - case Qt.Key_Right: - case Qt.Key_Tab: - root.step(1); - break; - case Qt.Key_Return: - case Qt.Key_Enter: - root.activateAt(root.selectedIndex); - break; - case Qt.Key_Escape: - root.requestClose(); - break; - default: - return; - } - event.accepted = true; - } - - WheelHandler { - id: swipeHandler - target: focusScope - property real acc: 0 - - onWheel: event => { - const px = event.pixelDelta; - const ang = event.angleDelta; - const dx = px.x !== 0 ? px.x : ang.x; - const dy = px.y !== 0 ? px.y : ang.y; - swipeHandler.acc += Math.abs(dx) >= Math.abs(dy) ? dx : dy; - if (swipeHandler.acc <= -root.theme.swipeThreshold) { - root.step(1); - swipeHandler.acc = 0; - } else if (swipeHandler.acc >= root.theme.swipeThreshold) { - root.step(-1); - swipeHandler.acc = 0; - } - } - } - - // Zero sized point at the loop center. Pushed down by half the lift - // so the loop as a whole sits in the middle of the screen. - Item { - id: stage - anchors.centerIn: parent - anchors.verticalCenterOffset: root.theme.backLift / 2 - - Repeater { - model: root.compositor.windows - - WindowCard { - id: card - - required property var modelData - required property int index - - readonly property real angle: root.angleOf(card.index) - readonly property real cosA: Math.cos(card.angle) - // 0 at the front, 1 at the very back. - readonly property real back: (1 - card.cosA) / 2 - // Simple perspective: cards farther away get smaller. - readonly property real depthScale: root.theme.focalLength / (root.theme.focalLength + 2 * root.radius * card.back) - // Turn so each card lies along the loop. The front half - // shows the outer face, the back half the inner face. - readonly property real faceAngle: { - const degrees = card.angle * 180 / Math.PI; - if (card.cosA >= 0) - return -degrees; - return degrees > 0 ? 180 - degrees : -180 - degrees; - } - - theme: root.theme - title: card.modelData.title - app: card.modelData.app - selected: card.index === root.selectedIndex - current: card.modelData.focused === true - shade: card.back - toplevel: root.compositor.toplevelFor(card.modelData.key) - previewFile: card.modelData.preview - previewVersion: root.compositor.previewVersion - - x: root.radius * Math.sin(card.angle) * card.depthScale - card.width / 2 - y: -root.theme.backLift * card.back - card.height / 2 - z: card.cosA - scale: card.depthScale - opacity: 1 - (1 - root.theme.backOpacity) * card.back - - transform: Rotation { - origin.x: card.width / 2 - origin.y: card.height / 2 - axis { - x: 0 - y: 1 - z: 0 - } - angle: card.faceAngle - } - - onActivated: root.activateAt(card.index) - } - } - } - } -} diff --git a/window-carousel/Compositor.qml b/window-carousel/Compositor.qml deleted file mode 100644 index f6de170..0000000 --- a/window-carousel/Compositor.qml +++ /dev/null @@ -1,300 +0,0 @@ -import QtQuick -import Quickshell -import Quickshell.Io -import Quickshell.Hyprland -import Quickshell.Wayland - -// Lists the windows on the focused workspace and focuses one of them. -// Everything goes through the command line tools, so niri and Hyprland -// behave the same way. -Item { - id: root - - // "niri", "hyprland" or "" when neither was detected. - readonly property string kind: { - if (Quickshell.env("NIRI_SOCKET")) - return "niri"; - if (Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")) - return "hyprland"; - return ""; - } - - // Take niri screenshots for previews. Each one also replaces the - // clipboard, and niri has no way to turn that off. - required property bool niriScreenshots - - // Id of the focused workspace, -1 when unknown. - property int workspaceId: -1 - - // Windows on the focused workspace, left to right. Each entry is - // { key, title, app, focused, preview }. Built from parsed JSON, so this - // stays an untyped array. key is the niri window id or the Hyprland - // address. preview is a screenshot file on niri, "" otherwise. - property var windows: [] - - // Bumped after each niri screenshot so preview images load again. - property int previewVersion: 0 - // niri window ids still waiting for a screenshot. - property list shotQueue: [] - - readonly property string previewDir: { - const dir = Quickshell.env("XDG_RUNTIME_DIR"); - return dir ? dir : "/tmp"; - } - - // "" while idle, otherwise the query step currently running. - property string queryStage: "" - property bool refreshQueued: false - // False while a query is being restarted, so a leftover finish is ignored. - property bool acceptStream: false - - signal refreshed - - function refresh(): void { - if (root.kind === "") - return; - if (root.queryStage !== "") { - root.refreshQueued = true; - return; - } - root.startStage("workspace"); - } - - function startStage(stage: string): void { - root.acceptStream = false; - query.running = false; - root.queryStage = stage; - if (stage === "workspace") { - if (root.kind === "niri") - query.command = ["niri", "msg", "--json", "workspaces"]; - else - query.command = ["hyprctl", "-j", "activeworkspace"]; - } else { - if (root.kind === "niri") - query.command = ["niri", "msg", "--json", "windows"]; - else - query.command = ["hyprctl", "-j", "clients"]; - } - root.acceptStream = true; - query.running = true; - } - - function previewPath(key: string): string { - return root.previewDir + "/skygqts-window-carousel-" + key + ".png"; - } - - // Live capture handle for a Hyprland window, null when there is none. - function toplevelFor(key: string): Toplevel { - if (root.kind !== "hyprland") - return null; - const wanted = key.toLowerCase().replace(/^0x/, ""); - const list = Hyprland.toplevels.values; - for (let i = 0; i < list.length; i++) { - if (list[i].address.toLowerCase().replace(/^0x/, "") === wanted) - return list[i].wayland; - } - return null; - } - - // Screenshot the listed niri windows one at a time. - function takeScreenshots(): void { - if (root.kind !== "niri" || !root.niriScreenshots) - return; - root.shotQueue = root.windows.map(w => w.key); - if (!shotProc.running) - root.nextScreenshot(); - } - - function nextScreenshot(): void { - if (root.shotQueue.length === 0) { - // niri may still be writing the last file, so look again shortly. - shotSettle.restart(); - return; - } - const key = root.shotQueue[0]; - root.shotQueue = root.shotQueue.slice(1); - shotProc.command = ["niri", "msg", "action", "screenshot-window", "--id", key, "--write-to-disk", "true", "--path", root.previewPath(key)]; - shotProc.running = true; - } - - function finishQuery(): void { - root.queryStage = ""; - root.refreshed(); - if (!root.refreshQueued) - return; - root.refreshQueued = false; - root.refresh(); - } - - // Some niri versions wrap replies in {"Ok": {"Variant": value}}. - // This returns the bare value either way, or null on an error reply. - function unwrapJson(text: string): var { - const parsed = JSON.parse(text); - if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) { - if ("Ok" in parsed) { - const inner = parsed.Ok; - if (inner && typeof inner === "object" && !Array.isArray(inner)) { - const keys = Object.keys(inner); - if (keys.length === 1) - return inner[keys[0]]; - } - return inner; - } - if ("Err" in parsed) { - console.warn("window-carousel: compositor IPC error:", parsed.Err); - return null; - } - } - return parsed; - } - - function asString(value): string { - if (value === null || value === undefined) - return ""; - return String(value); - } - - function asNumber(value, fallback: real): real { - const number = Number(value); - return Number.isFinite(number) ? number : fallback; - } - - function parseWorkspace(parsed): void { - if (root.kind === "niri") { - const list = Array.isArray(parsed) ? parsed : []; - const focused = list.find(ws => ws.is_focused === true); - root.workspaceId = focused ? root.asNumber(focused.id, -1) : -1; - } else { - root.workspaceId = root.asNumber(parsed?.id, -1); - } - } - - function parseWindows(parsed): void { - const list = Array.isArray(parsed) ? parsed : []; - const found = []; - for (let i = 0; i < list.length; i++) { - const w = list[i]; - if (root.kind === "niri") { - if (root.asNumber(w.workspace_id, -1) !== root.workspaceId) - continue; - // Tiled windows sort by column then row. Floating ones have - // no position and go last. - const pos = w.layout?.pos_in_scrolling_layout; - const tiled = Array.isArray(pos) && pos.length >= 2; - found.push({ - key: root.asString(w.id), - title: root.asString(w.title), - app: root.asString(w.app_id), - focused: w.is_focused === true, - sortA: tiled ? root.asNumber(pos[0], 0) : Number.MAX_SAFE_INTEGER, - sortB: tiled ? root.asNumber(pos[1], 0) : i - }); - } else { - if (w.mapped === false || w.hidden === true) - continue; - if (root.asNumber(w.workspace?.id, -1) !== root.workspaceId) - continue; - const at = Array.isArray(w.at) ? w.at : [0, 0]; - found.push({ - key: root.asString(w.address), - title: root.asString(w.title), - app: root.asString(w["class"]), - focused: root.asNumber(w.focusHistoryID, -1) === 0, - sortA: root.asNumber(at[0], 0), - sortB: root.asNumber(at[1], 0) - }); - } - } - found.sort((a, b) => a.sortA !== b.sortA ? a.sortA - b.sortA : a.sortB - b.sortB); - root.windows = found.map(w => ({ - key: w.key, - title: w.title, - app: w.app, - focused: w.focused, - preview: root.kind === "niri" && root.niriScreenshots ? root.previewPath(w.key) : "" - })); - root.takeScreenshots(); - } - - function focusWindow(key: string): void { - if (key.length === 0) - return; - if (root.kind === "niri") - action.command = ["niri", "msg", "action", "focus-window", "--id", key]; - else if (root.kind === "hyprland") - action.command = ["hyprctl", "dispatch", "focuswindow", "address:" + key]; - else - return; - action.running = false; - action.running = true; - } - - Process { - id: query - running: false - - stdout: StdioCollector { - onStreamFinished: { - if (!root.acceptStream) - return; - root.acceptStream = false; - - let parsed = null; - try { - parsed = root.unwrapJson(this.text); - } catch (e) { - console.warn("window-carousel: could not read compositor data:", e); - } - - if (root.queryStage === "workspace") { - root.parseWorkspace(parsed); - if (root.workspaceId < 0) { - console.warn("window-carousel: no focused workspace reported"); - root.windows = []; - root.finishQuery(); - return; - } - root.startStage("windows"); - return; - } - root.parseWindows(parsed); - root.finishQuery(); - } - } - } - - Process { - id: shotProc - running: false - - onExited: { - root.previewVersion += 1; - root.nextScreenshot(); - } - - stderr: StdioCollector { - onStreamFinished: { - if (this.text.trim().length > 0) - console.warn("window-carousel:", this.text.trim()); - } - } - } - - Timer { - id: shotSettle - interval: 300 - onTriggered: root.previewVersion += 1 - } - - Process { - id: action - running: false - - stderr: StdioCollector { - onStreamFinished: { - if (this.text.trim().length > 0) - console.warn("window-carousel:", this.text.trim()); - } - } - } -} diff --git a/window-carousel/Theme.qml b/window-carousel/Theme.qml deleted file mode 100644 index 9d0d32e..0000000 --- a/window-carousel/Theme.qml +++ /dev/null @@ -1,53 +0,0 @@ -import QtQuick - -QtObject { - readonly property color textColor: "#ffffff" - readonly property color labelColor: "#a9b1d6" - readonly property color accent: "#7aa2f7" - readonly property color cardBg: "#e61a1e2a" - readonly property color cardBorder: "#40ffffff" - - // Fullscreen dim behind the carousel. - readonly property color backdrop: "#990b0e14" - - // Off by default: every niri preview screenshot also replaces the - // clipboard. Hyprland previews are live and never touch it. - readonly property bool niriScreenshots: true - - readonly property real cardWidth: 440 - readonly property real cardHeight: 320 - readonly property real cardRadius: 16 - readonly property real cardPadding: 14 - readonly property color previewBg: "#660b0e14" - readonly property real previewRadius: 8 - // Big icon shown in the preview area when there is no picture. - readonly property real iconSize: 96 - // Title row under the preview. - readonly property real rowHeight: 44 - readonly property real rowIconSize: 32 - readonly property real titleSize: 18 - readonly property real appSize: 14 - readonly property real emptySize: 22 - - // The loop is as long as the cards laid side by side, plus this gap - // between them. Its radius stays inside these limits. - readonly property real cardGap: 60 - readonly property real minRadius: 260 - // Share of the screen width the loop may take on each side of center. - readonly property real maxRadiusShare: 0.42 - - // How strongly far cards shrink. Bigger means a flatter loop. - readonly property real focalLength: 1400 - // How far the back of the loop is raised, so it shows above the front. - readonly property real backLift: 200 - // Opacity of the card at the very back. - readonly property real backOpacity: 0.35 - // Extra darkening of the back half, 0 to 1. - readonly property real backShade: 0.55 - - readonly property int turnDuration: 320 - - // A swipe must cross this many pixels (or angleDelta units) before the - // loop turns one step. - readonly property int swipeThreshold: 120 -} diff --git a/window-carousel/shell.qml b/window-carousel/shell.qml deleted file mode 100644 index bd08fc7..0000000 --- a/window-carousel/shell.qml +++ /dev/null @@ -1,46 +0,0 @@ -import QtQuick -import Quickshell -import Quickshell.Io - -ShellRoot { - id: shell - - property bool open: false - - Compositor { - id: compositor - niriScreenshots: theme.niriScreenshots - } - - Theme { - id: theme - } - - Component.onCompleted: { - if (compositor.kind === "") - console.warn("window-carousel: neither niri nor Hyprland was detected"); - } - - IpcHandler { - target: "windows" - - function toggle(): void { - shell.open = !shell.open; - } - - function open(): void { - shell.open = true; - } - - function close(): void { - shell.open = false; - } - } - - CarouselView { - shellOpen: shell.open - compositor: compositor - theme: theme - onRequestClose: shell.open = false - } -} diff --git a/workspace-manager/Compositor.qml b/workspace-manager/Compositor.qml index c110f19..51b960d 100644 --- a/workspace-manager/Compositor.qml +++ b/workspace-manager/Compositor.qml @@ -1,6 +1,8 @@ import QtQuick import Quickshell import Quickshell.Io +import Quickshell.Hyprland +import Quickshell.Wayland // Talks to whichever compositor is running. Everything goes through the // command line tools so this file works the same on niri and Hyprland. @@ -39,9 +41,24 @@ Item { // Raw workspace JSON saved between the workspaces and windows query stages. property var workspaceData: [] - // Normalized windows with { title, app, output, idx, id }. + // Normalized windows, left to right, with { title, app, id, key, focused, + // preview }. id is the workspace id. key is the niri window id or the + // Hyprland address. preview is a screenshot file on niri, "" otherwise. property var windowList: [] + // Take niri screenshots for window previews. Each one also replaces the + // clipboard, and niri has no way to turn that off. + required property bool niriScreenshots + // Bumped after each niri screenshot so preview images load again. + property int previewVersion: 0 + // niri window ids still waiting for a screenshot. + property list shotQueue: [] + + readonly property string previewDir: { + const dir = Quickshell.env("XDG_RUNTIME_DIR"); + return dir ? dir : "/tmp"; + } + // "" while idle, otherwise the query step currently running. property string queryStage: "" property bool refreshQueued: false @@ -209,23 +226,53 @@ Item { const windows = []; for (let i = 0; i < list.length; i++) { const w = list[i]; - let title, app, id; + let title, app, id, key, focused, sortA, sortB; if (root.kind === "niri") { title = root.asString(w.title); app = root.asString(w.app_id); id = root.asNumber(w.workspace_id, -1); + key = root.asString(w.id); + focused = w.is_focused === true; + // Tiled windows sort by column then row. Floating ones have + // no position and go last. + const pos = w.layout?.pos_in_scrolling_layout; + const tiled = Array.isArray(pos) && pos.length >= 2; + sortA = tiled ? root.asNumber(pos[0], 0) : Number.MAX_SAFE_INTEGER; + sortB = tiled ? root.asNumber(pos[1], 0) : i; } else { if (w.mapped === false) continue; title = root.asString(w.title); app = root.asString(w.class); id = root.asNumber(w.workspace?.id, -1); + key = root.asString(w.address); + focused = root.asNumber(w.focusHistoryID, -1) === 0; + const at = Array.isArray(w.at) ? w.at : [0, 0]; + sortA = root.asNumber(at[0], 0); + sortB = root.asNumber(at[1], 0); } if (id < 0) continue; - windows.push({ title: title, app: app, id: id }); + windows.push({ + title: title, + app: app, + id: id, + key: key, + focused: focused, + sortA: sortA, + sortB: sortB + }); } - root.windowList = windows; + windows.sort((a, b) => a.sortA !== b.sortA ? a.sortA - b.sortA : a.sortB - b.sortB); + const withPreview = root.kind === "niri" && root.niriScreenshots; + root.windowList = windows.map(w => ({ + title: w.title, + app: w.app, + id: w.id, + key: w.key, + focused: w.focused, + preview: withPreview ? root.previewPath(w.key) : "" + })); } // Both niri and Hyprland match windows by workspace id. @@ -303,6 +350,68 @@ Item { root.refreshed(); } + // The workspace with this id from monitors, or null. + function workspaceById(id: int): var { + const mons = root.monitors; + for (let i = 0; i < mons.length; i++) { + const found = (mons[i].workspaces ?? []).find(ws => ws.id === id); + if (found) + return found; + } + return null; + } + + function previewPath(key: string): string { + return root.previewDir + "/skygqts-window-carousel-" + key + ".png"; + } + + // Live capture handle for a Hyprland window, null when there is none. + function toplevelFor(key: string): Toplevel { + if (root.kind !== "hyprland") + return null; + const wanted = key.toLowerCase().replace(/^0x/, ""); + const list = Hyprland.toplevels.values; + for (let i = 0; i < list.length; i++) { + if (list[i].address.toLowerCase().replace(/^0x/, "") === wanted) + return list[i].wayland; + } + return null; + } + + // Screenshot these niri windows one at a time. + function takeScreenshots(keys: list): void { + if (root.kind !== "niri" || !root.niriScreenshots) + return; + root.shotQueue = keys; + if (!shotProc.running) + root.nextScreenshot(); + } + + function nextScreenshot(): void { + if (root.shotQueue.length === 0) { + // niri may still be writing the last file, so look again shortly. + shotSettle.restart(); + return; + } + const key = root.shotQueue[0]; + root.shotQueue = root.shotQueue.slice(1); + shotProc.command = ["niri", "msg", "action", "screenshot-window", "--id", key, "--write-to-disk", "true", "--path", root.previewPath(key)]; + shotProc.running = true; + } + + function focusWindow(key: string): void { + if (key.length === 0) + return; + if (root.kind === "niri") + action.command = ["niri", "msg", "action", "focus-window", "--id", key]; + else if (root.kind === "hyprland") + action.command = ["hyprctl", "dispatch", "focuswindow", "address:" + key]; + else + return; + action.running = false; + action.running = true; + } + function compareOutputs(a: string, b: string): int { const left = root.outputLayout[a] ?? {}; const right = root.outputLayout[b] ?? {}; @@ -493,6 +602,29 @@ Item { } } + Process { + id: shotProc + running: false + + onExited: { + root.previewVersion += 1; + root.nextScreenshot(); + } + + stderr: StdioCollector { + onStreamFinished: { + if (this.text.trim().length > 0) + console.warn("workspace-manager:", this.text.trim()); + } + } + } + + Timer { + id: shotSettle + interval: 300 + onTriggered: root.previewVersion += 1 + } + Process { id: focusProc running: false diff --git a/workspace-manager/GotoView.qml b/workspace-manager/GotoView.qml index 2f82699..55183bb 100644 --- a/workspace-manager/GotoView.qml +++ b/workspace-manager/GotoView.qml @@ -9,6 +9,11 @@ PanelWindow { required property bool shellOpen required property Compositor compositor required property Theme theme + // Focus the name field as soon as the carousel has its data. + required property bool renameOnOpen + // Open the window loop on the focused workspace as soon as the carousel + // has its data. Escape then closes everything. + required property bool openWindowsOnOpen // Enter, or a click on a card: the workspace was chosen. signal requestClose @@ -40,6 +45,13 @@ PanelWindow { // Whether the name field (rename mode) currently has focus. property bool nameFieldActive: false + // The window loop is open on top of the selected workspace. + property bool windowsOpen: false + // Workspace the window loop shows. + property int loopWorkspaceId: -1 + // Escape folds the loop back into the carousel, instead of closing. + property bool canCollapse: true + function workspaceIndexAt(index: int): int { const list = root.workspaceIndices; if (!list || index < 0 || index >= list.length) @@ -153,6 +165,39 @@ PanelWindow { Qt.callLater(() => focusScope.forceActiveFocus()); } + // ── window loop helpers ───────────────────────────────────────────── + + function isWindowsKey(event): bool { + const mods = event.modifiers; + const ctrl = (mods & Qt.ControlModifier) && !(mods & Qt.AltModifier) && !(mods & Qt.MetaModifier); + return event.key === Qt.Key_B && ctrl; + } + + // Open the loop on the selected workspace. The other cards move away. + function expandWindows(collapsible: bool): void { + const ws = root.selectedWorkspace(); + if (!ws) + return; + root.animate = true; + root.canCollapse = collapsible; + root.loopWorkspaceId = ws.id; + root.windowsOpen = true; + windowLoop.seed(); + } + + function collapseWindows(): void { + root.animate = true; + root.windowsOpen = false; + } + + // Escape or a backdrop click while the loop is open. + function leaveWindows(): void { + if (root.canCollapse) + root.collapseWindows(); + else + root.requestBack(); + } + function isToggleRenameKey(event): bool { const mods = event.modifiers; const ctrl = (mods & Qt.ControlModifier) && !(mods & Qt.AltModifier) && !(mods & Qt.MetaModifier); @@ -171,6 +216,7 @@ PanelWindow { onVisibleChanged: { root.animate = false; root.nameFieldActive = false; + root.windowsOpen = false; if (!root.visible) { root.seedPending = false; return; @@ -191,6 +237,10 @@ PanelWindow { root.seedPending = false; root.seedSelection(); root.syncNameField(); + if (root.openWindowsOnOpen) + root.expandWindows(false); + if (root.renameOnOpen) + root.enterRename(); } } @@ -213,6 +263,8 @@ PanelWindow { onClicked: { if (root.nameFieldActive) root.leaveRename(); + else if (root.windowsOpen) + root.leaveWindows(); else root.requestBack(); } @@ -350,6 +402,43 @@ PanelWindow { return; } + // Ctrl+B opens or folds the window loop on the selected workspace. + if (root.isWindowsKey(event)) { + if (root.windowsOpen) + root.collapseWindows(); + else + root.expandWindows(true); + event.accepted = true; + return; + } + + if (root.windowsOpen) { + switch (event.key) { + case Qt.Key_Left: + case Qt.Key_Backtab: + windowLoop.step(-1); + break; + case Qt.Key_Right: + case Qt.Key_Tab: + windowLoop.step(1); + break; + case Qt.Key_Return: + case Qt.Key_Enter: + windowLoop.activateSelected(); + break; + case Qt.Key_Escape: + root.leaveWindows(); + break; + case Qt.Key_Up: + case Qt.Key_Down: + break; + default: + return; + } + event.accepted = true; + return; + } + switch (event.key) { case Qt.Key_Left: root.moveWorkspace(-1); @@ -397,6 +486,18 @@ PanelWindow { const ang = event.angleDelta; const dx = px.x !== 0 ? px.x : ang.x; const dy = px.y !== 0 ? px.y : ang.y; + // The loop turns with either direction. + if (root.windowsOpen) { + swipeHandler.accX += Math.abs(dx) >= Math.abs(dy) ? dx : dy; + if (swipeHandler.accX <= -root.theme.swipeThreshold) { + windowLoop.step(1); + swipeHandler.accX = 0; + } else if (swipeHandler.accX >= root.theme.swipeThreshold) { + windowLoop.step(-1); + swipeHandler.accX = 0; + } + return; + } if (Math.abs(dy) >= Math.abs(dx)) { swipeHandler.accY += dy; if (swipeHandler.accY <= -root.theme.swipeThreshold) @@ -425,14 +526,20 @@ PanelWindow { readonly property int rowIndex: index readonly property int selectedWs: root.workspaceIndexAt(rowIndex) readonly property var workspaces: modelData.workspaces ?? [] + readonly property bool isCurrentRow: row.rowIndex === root.monitorIndex + // Other rows move up or down, out of the loop's way. + readonly property real spreadY: root.windowsOpen ? Math.sign(row.rowIndex - root.monitorIndex) * root.theme.loopSpreadY : 0 anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter height: root.theme.cardHeight - z: row.rowIndex === root.monitorIndex ? 1 : 0 - opacity: 1 - Math.min(Math.abs(row.rowIndex - root.monitorIndex) * root.theme.carouselRowFadeStep, root.theme.carouselRowMaxFade) - anchors.verticalCenterOffset: (row.rowIndex - root.monitorIndex) * root.theme.carouselStepY + z: row.isCurrentRow ? 1 : 0 + opacity: { + const fade = 1 - Math.min(Math.abs(row.rowIndex - root.monitorIndex) * root.theme.carouselRowFadeStep, root.theme.carouselRowMaxFade); + return root.windowsOpen && !row.isCurrentRow ? fade * root.theme.loopHiddenFade : fade; + } + anchors.verticalCenterOffset: (row.rowIndex - root.monitorIndex) * root.theme.carouselStepY + row.spreadY Behavior on anchors.verticalCenterOffset { enabled: root.animate @@ -458,6 +565,15 @@ PanelWindow { color: root.theme.labelColor font.pixelSize: root.theme.monitorLabelSize text: row.modelData.name.length > 0 ? row.modelData.name : "screen" + // The loop covers this label, so hide it while open. + opacity: root.windowsOpen && row.isCurrentRow ? 0 : 1 + + Behavior on opacity { + enabled: root.animate + NumberAnimation { + duration: root.theme.carouselDuration + } + } } Repeater { @@ -470,6 +586,12 @@ PanelWindow { required property int index readonly property int distance: Math.abs(index - row.selectedWs) + // This card turns into the window loop. + readonly property bool opensLoop: root.windowsOpen && card.selected + // Cards next to the loop move sideways out of its way. + readonly property real spreadX: root.windowsOpen && row.isCurrentRow ? Math.sign(index - row.selectedWs) * root.theme.loopSpreadX : 0 + readonly property real baseOpacity: 1 - Math.min(card.distance * root.theme.carouselFadeStep, root.theme.carouselMaxFade) + readonly property real baseScale: 1 - Math.min(card.distance * root.theme.carouselScaleStep, root.theme.carouselMaxScaleReduction) theme: root.theme workspaceName: modelData.name @@ -481,15 +603,32 @@ PanelWindow { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - anchors.horizontalCenterOffset: (index - row.selectedWs) * root.theme.carouselStepX - opacity: 1 - Math.min(card.distance * root.theme.carouselFadeStep, root.theme.carouselMaxFade) - scale: 1 - Math.min(card.distance * root.theme.carouselScaleStep, root.theme.carouselMaxScaleReduction) + anchors.horizontalCenterOffset: (index - row.selectedWs) * root.theme.carouselStepX + card.spreadX + opacity: { + if (card.opensLoop) + return 0; + return root.windowsOpen ? card.baseOpacity * root.theme.loopHiddenFade : card.baseOpacity; + } + scale: card.opensLoop ? 1 / root.theme.loopStartScale : card.baseScale z: card.selected ? 1 : 0 + enabled: !root.windowsOpen onActivated: root.activateAt(row.rowIndex, index) } } } } + + // Sits where the selected card was and grows out of it. + WindowLoop { + id: windowLoop + anchors.fill: parent + z: 2 + compositor: root.compositor + theme: root.theme + workspaceId: root.loopWorkspaceId + expanded: root.windowsOpen + onWindowChosen: root.requestClose() + } } } diff --git a/workspace-manager/Theme.qml b/workspace-manager/Theme.qml index 9fd5c38..9ff5dd0 100644 --- a/workspace-manager/Theme.qml +++ b/workspace-manager/Theme.qml @@ -54,4 +54,54 @@ QtObject { readonly property real windowFontSize: 16 readonly property real windowRowSpacing: 6 readonly property int maxWindowRows: 3 + + // ── window loop (Ctrl+B) ──────────────────────────────────────────── + + // Off by default: every niri preview screenshot also replaces the + // clipboard. Hyprland previews are live and never touch it. + readonly property bool niriScreenshots: false + + // How far the other workspace cards move out while the loop is open: + // sideways in the selected row, up or down for the other rows. + readonly property real loopSpreadX: 420 + readonly property real loopSpreadY: 260 + // Extra fade on those cards while the loop is open. + readonly property real loopHiddenFade: 0.35 + // Size the loop grows from as it appears. + readonly property real loopStartScale: 0.6 + readonly property int loopExpandDuration: 280 + + readonly property color loopCardBg: "#e61a1e2a" + readonly property real loopCardWidth: 440 + readonly property real loopCardHeight: 320 + readonly property real loopCardRadius: 16 + readonly property real loopCardPadding: 14 + readonly property color loopPreviewBg: "#660b0e14" + readonly property real loopPreviewRadius: 8 + // Big icon shown in the preview area when there is no picture. + readonly property real loopIconSize: 96 + // Title row under the preview. + readonly property real loopRowHeight: 44 + readonly property real loopRowIconSize: 32 + readonly property real loopTitleSize: 18 + readonly property real loopAppSize: 14 + readonly property real loopEmptySize: 22 + + // The loop is as long as the cards laid side by side, plus this gap + // between them. Its radius stays inside these limits. + readonly property real loopCardGap: 60 + readonly property real loopMinRadius: 260 + // Share of the screen width the loop may take on each side of center. + readonly property real loopMaxRadiusShare: 0.42 + + // How strongly far cards shrink. Bigger means a flatter loop. + readonly property real loopFocalLength: 1400 + // How far the back of the loop is raised, so it shows above the front. + readonly property real loopBackLift: 200 + // Opacity of the card at the very back. + readonly property real loopBackOpacity: 0.35 + // Extra darkening of the back half, 0 to 1. + readonly property real loopBackShade: 0.55 + + readonly property int loopTurnDuration: 320 } diff --git a/window-carousel/WindowCard.qml b/workspace-manager/WindowCard.qml similarity index 68% rename from window-carousel/WindowCard.qml rename to workspace-manager/WindowCard.qml index b4e904f..9c73584 100644 --- a/window-carousel/WindowCard.qml +++ b/workspace-manager/WindowCard.qml @@ -2,6 +2,7 @@ import QtQuick import Quickshell import Quickshell.Wayland +// One window on the window loop: a preview with the icon, title and app below. Rectangle { id: root @@ -12,6 +13,8 @@ Rectangle { required property bool current // 0 at the front of the loop, 1 at the very back. required property real shade + // Stream the Hyprland preview. Off while the loop is hidden. + required property bool live // Live capture source on Hyprland, null elsewhere. required property Toplevel toplevel // Screenshot file on niri, "" elsewhere. @@ -23,12 +26,12 @@ Rectangle { readonly property string iconSource: Quickshell.iconPath(root.app, "application-x-executable") - width: root.theme.cardWidth - height: root.theme.cardHeight - radius: root.theme.cardRadius - color: root.theme.cardBg + width: root.theme.loopCardWidth + height: root.theme.loopCardHeight + radius: root.theme.loopCardRadius + color: root.theme.loopCardBg border.width: root.selected ? 3 : 1 - border.color: root.selected ? root.theme.accent : root.theme.cardBorder + border.color: root.selected ? root.theme.fieldBorder : root.theme.barBorder antialiasing: true Rectangle { @@ -37,9 +40,9 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.bottom: infoRow.top - anchors.margins: root.theme.cardPadding - radius: root.theme.previewRadius - color: root.theme.previewBg + anchors.margins: root.theme.loopCardPadding + radius: root.theme.loopPreviewRadius + color: root.theme.loopPreviewBg clip: true ScreencopyView { @@ -51,7 +54,7 @@ Rectangle { anchors.centerIn: parent width: Math.min(parent.width, parent.height * liveView.aspect) height: liveView.width / liveView.aspect - captureSource: root.toplevel + captureSource: root.live ? root.toplevel : null live: true visible: root.toplevel !== null && liveView.hasContent } @@ -63,7 +66,7 @@ Rectangle { // The file is rewritten in place, so never reuse an old copy. cache: false asynchronous: true - sourceSize.width: root.theme.cardWidth * 2 + sourceSize.width: root.theme.loopCardWidth * 2 fillMode: Image.PreserveAspectFit smooth: true mipmap: true @@ -72,11 +75,11 @@ Rectangle { Image { anchors.centerIn: parent - width: root.theme.iconSize - height: root.theme.iconSize + width: root.theme.loopIconSize + height: root.theme.loopIconSize source: root.iconSource - sourceSize.width: root.theme.iconSize * 2 - sourceSize.height: root.theme.iconSize * 2 + sourceSize.width: root.theme.loopIconSize * 2 + sourceSize.height: root.theme.loopIconSize * 2 fillMode: Image.PreserveAspectFit smooth: true mipmap: true @@ -89,19 +92,19 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.leftMargin: root.theme.cardPadding - anchors.rightMargin: root.theme.cardPadding - anchors.bottomMargin: root.theme.cardPadding - height: root.theme.rowHeight + anchors.leftMargin: root.theme.loopCardPadding + anchors.rightMargin: root.theme.loopCardPadding + anchors.bottomMargin: root.theme.loopCardPadding + height: root.theme.loopRowHeight spacing: 10 Image { anchors.verticalCenter: parent.verticalCenter - width: root.theme.rowIconSize - height: root.theme.rowIconSize + width: root.theme.loopRowIconSize + height: root.theme.loopRowIconSize source: root.iconSource - sourceSize.width: root.theme.rowIconSize * 2 - sourceSize.height: root.theme.rowIconSize * 2 + sourceSize.width: root.theme.loopRowIconSize * 2 + sourceSize.height: root.theme.loopRowIconSize * 2 fillMode: Image.PreserveAspectFit smooth: true mipmap: true @@ -109,21 +112,21 @@ Rectangle { Column { anchors.verticalCenter: parent.verticalCenter - width: parent.width - root.theme.rowIconSize - parent.spacing + width: parent.width - root.theme.loopRowIconSize - parent.spacing Text { width: parent.width elide: Text.ElideRight color: root.theme.textColor - font.pixelSize: root.theme.titleSize + font.pixelSize: root.theme.loopTitleSize text: root.title.length > 0 ? root.title : "Untitled" } Text { width: parent.width elide: Text.ElideRight - color: root.current ? root.theme.accent : root.theme.labelColor - font.pixelSize: root.theme.appSize + color: root.current ? root.theme.fieldBorder : root.theme.labelColor + font.pixelSize: root.theme.loopAppSize text: { const name = root.app.length > 0 ? root.app : "unknown app"; return root.current ? name + " · focused" : name; @@ -137,7 +140,7 @@ Rectangle { anchors.fill: parent radius: parent.radius color: "black" - opacity: root.shade * root.theme.backShade + opacity: root.shade * root.theme.loopBackShade } MouseArea { diff --git a/workspace-manager/WindowLoop.qml b/workspace-manager/WindowLoop.qml new file mode 100644 index 0000000..f8f2190 --- /dev/null +++ b/workspace-manager/WindowLoop.qml @@ -0,0 +1,191 @@ +import QtQuick + +// The windows of one workspace sit on a strip bent into a closed loop, seen +// from a little above. The front half shows the outside of the strip, the +// back half shows the inside, so the far windows wrap around behind and +// face the viewer too. +Item { + id: root + + required property Compositor compositor + required property Theme theme + required property int workspaceId + // Shown and taking input. Fades and grows in when this turns on. + required property bool expanded + + // A window was focused. + signal windowChosen + + // Windows of the shown workspace, from parsed JSON, so this stays untyped. + readonly property var windows: { + const ws = root.compositor.workspaceById(root.workspaceId); + return ws ? (ws.windows ?? []) : []; + } + + readonly property int count: root.windows.length + // Angle between two neighbours on the loop. + readonly property real angleStep: root.count > 0 ? 2 * Math.PI / root.count : 0 + // The loop is as long as the cards side by side, within limits. + readonly property real radius: { + const natural = root.count * (root.theme.loopCardWidth + root.theme.loopCardGap) / (2 * Math.PI); + const widest = root.width * root.theme.loopMaxRadiusShare; + return Math.max(root.theme.loopMinRadius, Math.min(natural, widest)); + } + + // Selected step. It is not wrapped, so the loop can keep turning the + // same way. Use selectedIndex for the position in the window list. + property int targetStep: 0 + // Follows targetStep smoothly and drives every card position. + property real turn: 0 + property bool animate: false + + readonly property int selectedIndex: root.wrapIndex(root.targetStep) + + opacity: root.expanded ? 1 : 0 + scale: root.expanded ? 1 : root.theme.loopStartScale + visible: root.opacity > 0 + + Behavior on opacity { + NumberAnimation { + duration: root.theme.loopExpandDuration + easing.type: Easing.OutCubic + } + } + Behavior on scale { + NumberAnimation { + duration: root.theme.loopExpandDuration + easing.type: Easing.OutCubic + } + } + Behavior on turn { + enabled: root.animate + NumberAnimation { + duration: root.theme.loopTurnDuration + easing.type: Easing.OutCubic + } + } + + function wrapIndex(step: int): int { + if (root.count === 0) + return 0; + return ((step % root.count) + root.count) % root.count; + } + + // Angle of a card from the front, in radians, between -pi and pi. + function angleOf(index: int): real { + if (root.count === 0) + return 0; + let steps = (index - root.turn) % root.count; + if (steps < 0) + steps += root.count; + if (steps > root.count / 2) + steps -= root.count; + return steps * root.angleStep; + } + + // Select the focused window, or the first one, and turn into place. + function seed(): void { + const list = root.windows; + const focused = list.findIndex(w => w.focused); + root.animate = false; + root.targetStep = focused >= 0 ? focused : 0; + // Start one step back so the loop turns in as it appears. + root.turn = root.targetStep - (root.count > 1 ? 1 : 0); + root.animate = true; + root.turn = root.targetStep; + root.compositor.takeScreenshots(list.map(w => w.key)); + } + + function step(delta: int): void { + if (root.count === 0) + return; + root.animate = true; + root.targetStep += delta; + root.turn = root.targetStep; + } + + function activateAt(index: int): void { + const list = root.windows; + if (index < 0 || index >= list.length) + return; + root.compositor.focusWindow(list[index].key); + root.windowChosen(); + } + + function activateSelected(): void { + root.activateAt(root.selectedIndex); + } + + Text { + anchors.centerIn: parent + visible: root.count === 0 + color: root.theme.labelColor + font.pixelSize: root.theme.loopEmptySize + text: "No windows on this workspace" + } + + // Zero sized point at the loop center. Pushed down by half the lift + // so the loop as a whole sits in the middle. + Item { + id: stage + anchors.centerIn: parent + anchors.verticalCenterOffset: root.theme.loopBackLift / 2 + + Repeater { + model: root.windows + + WindowCard { + id: card + + required property var modelData + required property int index + + readonly property real angle: root.angleOf(card.index) + readonly property real cosA: Math.cos(card.angle) + // 0 at the front, 1 at the very back. + readonly property real back: (1 - card.cosA) / 2 + // Simple perspective: cards farther away get smaller. + readonly property real depthScale: root.theme.loopFocalLength / (root.theme.loopFocalLength + 2 * root.radius * card.back) + // Turn so each card lies along the loop. The front half + // shows the outer face, the back half the inner face. + readonly property real faceAngle: { + const degrees = card.angle * 180 / Math.PI; + if (card.cosA >= 0) + return -degrees; + return degrees > 0 ? 180 - degrees : -180 - degrees; + } + + theme: root.theme + title: card.modelData.title + app: card.modelData.app + selected: card.index === root.selectedIndex + current: card.modelData.focused === true + shade: card.back + live: root.expanded + toplevel: root.compositor.toplevelFor(card.modelData.key) + previewFile: card.modelData.preview + previewVersion: root.compositor.previewVersion + enabled: root.expanded + + x: root.radius * Math.sin(card.angle) * card.depthScale - card.width / 2 + y: -root.theme.loopBackLift * card.back - card.height / 2 + z: card.cosA + scale: card.depthScale + opacity: 1 - (1 - root.theme.loopBackOpacity) * card.back + + transform: Rotation { + origin.x: card.width / 2 + origin.y: card.height / 2 + axis { + x: 0 + y: 1 + z: 0 + } + angle: card.faceAngle + } + + onActivated: root.activateAt(card.index) + } + } + } +} diff --git a/workspace-manager/shell.qml b/workspace-manager/shell.qml index dc6449d..3007943 100644 --- a/workspace-manager/shell.qml +++ b/workspace-manager/shell.qml @@ -6,9 +6,14 @@ ShellRoot { id: shell property bool open: false + // Focus the name field once the carousel opens. + property bool renameOnOpen: false + // Open the window loop on the focused workspace once the carousel opens. + property bool openWindowsOnOpen: false Compositor { id: compositor + niriScreenshots: theme.niriScreenshots } Theme { @@ -24,22 +29,50 @@ ShellRoot { shell.open = false; } + function openWith(rename: bool, windows: bool): void { + shell.renameOnOpen = rename; + shell.openWindowsOnOpen = windows; + // Already open, so there is no fresh open to wait for. + if (shell.open) { + if (windows) + gotoView.expandWindows(false); + if (rename) + gotoView.enterRename(); + return; + } + shell.open = true; + } + IpcHandler { target: "workspace" function toggle(): void { - shell.open = !shell.open; + if (shell.open) + shell.closeAll(); + else + shell.openWith(false, false); } function goTo(): void { - shell.open = true; + shell.openWith(false, false); + } + + function openWindowSelection(): void { + shell.openWith(false, true); + } + + function openWorkspaceRename(): void { + shell.openWith(true, false); } } GotoView { + id: gotoView shellOpen: shell.open compositor: compositor theme: theme + renameOnOpen: shell.renameOnOpen + openWindowsOnOpen: shell.openWindowsOnOpen onRequestClose: shell.closeAll() onRequestBack: shell.closeAll() }