aboutsummaryrefslogtreecommitdiffstats
path: root/desktop
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-16 15:23:53 +0200
committerDanilo M. <danix@danix.xyz>2026-10-16 15:23:53 +0200
commit1f596b4e2c59c1fa069d2b549c1d8ae6d5a876cf (patch)
tree0512594a620eba6cc0ad57c1edc4032c89ebe332 /desktop
parentf5da8d8ee2cb4ace1fa6841437b4798e7799c100 (diff)
downloadquickshell-1f596b4e2c59c1fa069d2b549c1d8ae6d5a876cf.tar.gz
quickshell-1f596b4e2c59c1fa069d2b549c1d8ae6d5a876cf.zip
feat(island): take a file drop for the assistant
A DropArea over the sliver grows into a bubble while a file drag is over it and hands file:// paths to the canvas. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/island/Island.qml54
-rw-r--r--desktop/island/README.md9
-rw-r--r--desktop/shell.qml1
3 files changed, 64 insertions, 0 deletions
diff --git a/desktop/island/Island.qml b/desktop/island/Island.qml
index 3dbd36d..4fba033 100644
--- a/desktop/island/Island.qml
+++ b/desktop/island/Island.qml
@@ -17,6 +17,7 @@ import QtQuick
import ".."
import "../modules/sound"
import "Logic.js" as Logic
+import "../assistant/Files.js" as Files
// The island: a sliver at the top centre of DP-1 that the two pills slide
// out of. The window is a fixed overlay strip that never resizes; the pills
@@ -27,6 +28,7 @@ PanelWindow {
required property QtObject sound // the sound module's Service
required property QtObject drawer // Drawer, for the sound page link
+ property QtObject asst: null // the assistant canvas, for dropped files
screen: Quickshell.screens.find(s => s.name === "DP-1") ?? Quickshell.screens[0]
anchors { top: true; left: true; right: true }
@@ -147,6 +149,7 @@ PanelWindow {
mask: Region {
item: sliverHit
+ Region { item: receptor; intersection: Intersection.Combine }
Region { item: clock; intersection: Intersection.Combine }
Region { item: status; intersection: Intersection.Combine }
Region { item: media.visible ? media : null; intersection: Intersection.Combine }
@@ -187,6 +190,57 @@ PanelWindow {
hoverEnabled: true
}
+ // --- file drop ---------------------------------------------------------
+
+ // A file dragged onto the sliver opens a bubble to drop it on; the drop
+ // hands it to the assistant canvas. Wayland reports a drag only once it
+ // enters an input region, so the receptor is the sliver's width at rest
+ // and grows to hold the bubble while a drag is over it.
+ property bool dropHold: false
+
+ Item {
+ id: receptor
+ x: win.cx - width / 2
+ y: 0
+ z: 10
+ width: 260
+ height: win.dropHold ? 100 : 10
+
+ DropArea {
+ anchors.fill: parent
+ enabled: win.asst !== null
+ onEntered: drag => {
+ drag.accepted = drag.hasUrls && (drag.supportedActions & Qt.CopyAction);
+ if (drag.accepted) { win.dropHold = true; drag.accept(Qt.CopyAction); }
+ }
+ onExited: win.dropHold = false
+ onDropped: drop => {
+ win.dropHold = false;
+ const paths = drop.urls.map(u => Files.fromUrl(u)).filter(p => p !== "");
+ if (!paths.length) { drop.accepted = false; return; }
+ win.asst.attach(paths);
+ drop.accept(Qt.CopyAction);
+ }
+ }
+
+ Rectangle {
+ visible: win.dropHold
+ anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 14 }
+ width: parent.width
+ height: 72
+ radius: 16
+ color: Qt.alpha(Theme.base, 0.9)
+ border.width: 1
+ border.color: Qt.alpha(Theme.accent, 0.6)
+ Text {
+ anchors.centerIn: parent
+ text: "Drop for the assistant"
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ }
+ }
+ }
+
// Both pills start overlapped at the sliver, above the screen edge, and
// travel down and apart. At reveal 1 the clock ends gap/2 left of the
// centre and the status gap/2 right of it; the status pill's left edge
diff --git a/desktop/island/README.md b/desktop/island/README.md
index 1511279..3387e2b 100644
--- a/desktop/island/README.md
+++ b/desktop/island/README.md
@@ -131,3 +131,12 @@ The window sets namespace `quickshell-island`. For frosting, add to
})
Without it the island renders flat translucent.
+
+## File drop
+
+A file dragged onto the sliver opens a bubble, "Drop for the assistant";
+dropping on it hands the file to the assistant canvas, which opens in its
+file state with a new conversation. Wayland reports a drag only once it
+enters one of the surface's input regions, so the receptor is the sliver's
+width at rest and grows to hold the bubble while a drag is over it. Only
+`file://` URLs are taken.
diff --git a/desktop/shell.qml b/desktop/shell.qml
index a67234a..f3170a6 100644
--- a/desktop/shell.qml
+++ b/desktop/shell.qml
@@ -81,6 +81,7 @@ ShellRoot {
id: island
sound: soundModule.service
drawer: drawer
+ asst: assistant
}
// The assistant canvas on SUPER+Home, a view over desktop-assistant's