diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-16 15:45:02 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-16 15:45:02 +0200 |
| commit | e6d9380d0e30326fb504dffb5df1162b7fad217e (patch) | |
| tree | bec561de07b6a8d671d85ffc1d40ef0f9e85d89e /desktop | |
| parent | cb16fa6c17298a6f2f4aa390c01ff8eacd53a996 (diff) | |
| download | quickshell-e6d9380d0e30326fb504dffb5df1162b7fad217e.tar.gz quickshell-e6d9380d0e30326fb504dffb5df1162b7fad217e.zip | |
fix(island): say why a drop is refused
A drop offering no local file:// URL was refused silently: the bubble
vanished and nothing happened. Measured on the first report: the file
manager offers a trashed file as trash:, with no path to read. The bubble
now shows the reason for a moment, Trash named as such, and the refusal is
logged with the URL schemes and offered formats (never the paths).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/island/Island.qml | 26 | ||||
| -rw-r--r-- | desktop/island/README.md | 4 |
2 files changed, 24 insertions, 6 deletions
diff --git a/desktop/island/Island.qml b/desktop/island/Island.qml index 412cc58..5efe9bf 100644 --- a/desktop/island/Island.qml +++ b/desktop/island/Island.qml @@ -197,6 +197,9 @@ PanelWindow { // 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 + // Why the last drop was refused, shown in the bubble for a moment. + property string dropNote: "" + Timer { id: noteTimer; interval: 2500; onTriggered: win.dropNote = "" } Item { id: receptor @@ -218,25 +221,38 @@ PanelWindow { onDropped: drop => { win.dropHold = false; const paths = drop.urls.map(u => Files.fromUrl(u)).filter(p => p !== ""); - if (!paths.length) { drop.accepted = false; return; } + if (!paths.length) { + // Said, not silent: a source offering no local file:// + // URL looked like a drop that did nothing. The file + // manager offers a trashed file as trash:, which has no + // path to read. + const schemes = drop.urls.map(u => String(u).split(":")[0]); + console.warn(`island: drop refused, no local file in ${drop.urls.length} URL(s): ` + + schemes.join(", ") + ` formats: ${drop.formats.join(", ")}`); + win.dropNote = schemes.includes("trash") ? "That is in the Trash: restore it first" + : "Not a local file"; + noteTimer.restart(); + drop.accepted = false; + return; + } win.asst.attach(paths); drop.accept(Qt.CopyAction); } } Rectangle { - visible: win.dropHold + visible: win.dropHold || win.dropNote !== "" 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) + border.color: Qt.alpha(win.dropHold ? Theme.accent : Theme.red, 0.6) Text { anchors.centerIn: parent - text: "Drop for the assistant" - color: Theme.text + text: win.dropHold ? "Drop for the assistant" : win.dropNote + color: win.dropHold ? Theme.text : Theme.red font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } } } diff --git a/desktop/island/README.md b/desktop/island/README.md index 3387e2b..07c88cf 100644 --- a/desktop/island/README.md +++ b/desktop/island/README.md @@ -139,4 +139,6 @@ 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. +`file://` URLs are taken; a refused drop says why in the bubble for a +moment. The file manager offers a trashed file as a `trash:` URL, which has +no path to read: restore it first. |
