mirror of
https://github.com/andwati/kget-capture.git
synced 2026-11-17 09:25:22 +00:00
Get correct filenames, skip KGet's dialog, and add a finished notification
Switch auto-capture from onCreated to onDeterminingFilename, which fires once Chrome has already resolved the real filename (from Content-Disposition or the URL). That name is now passed through to the native host and used to build a full dir+filename destination for addTransfer, replacing showNewTransferDialog. A non-empty destDir makes KGet skip its interactive dialog and start immediately, which also fixes it showing an opaque URL path segment as the filename for signed/obfuscated URLs (e.g. cloud storage links) instead of the real name. Also enable KGet's existing (but disabled-by-default) "Download Finished" KNotify popup via install.sh, so there's still feedback now that captures no longer show an interactive dialog.
This commit is contained in:
@@ -5,12 +5,14 @@ A Chrome (and other Chromium-browser) extension that sends downloads to
|
||||
addition to) the browser's built-in downloader.
|
||||
|
||||
- Right-click any link, image, video, or audio element and choose
|
||||
**"Download with KGet"** to open KGet's "New Download" dialog, prefilled
|
||||
with the URL — edit the filename or destination folder if you want, then
|
||||
confirm to start the transfer.
|
||||
**"Download with KGet"** to send it straight to KGet — it starts
|
||||
downloading immediately into your Downloads folder, no dialog.
|
||||
- A toolbar toggle enables **auto-capture**: while on, every download Chrome
|
||||
starts is cancelled and redirected to the same KGet dialog automatically.
|
||||
Defaults to ON.
|
||||
starts is cancelled and handed off to KGet the same way, automatically,
|
||||
with the correct filename (resolved by Chrome itself, so it's right even
|
||||
for URLs whose path is just an opaque ID). Defaults to ON.
|
||||
- KGet's own "Download Finished" desktop notification is enabled on install,
|
||||
so you still get feedback once a capture completes.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -18,6 +20,8 @@ addition to) the browser's built-in downloader.
|
||||
- One of: Google Chrome, Chromium, Brave, Vivaldi, Microsoft Edge
|
||||
- `python3` and `dbus-send` on `PATH` (standard on virtually all Linux/KDE
|
||||
systems already)
|
||||
- `kwriteconfig6` (ships with KDE Plasma) — optional, only used to enable the
|
||||
download-finished notification; install still works without it
|
||||
|
||||
## Install
|
||||
|
||||
@@ -72,14 +76,25 @@ git push origin v1.0.0
|
||||
- **Auto-capture has a brief head start.** Manifest V3 removed blocking
|
||||
`webRequest`, so Chrome begins the download before the extension can cancel
|
||||
it. A small/partial temp file may transiently appear before it's erased.
|
||||
- **A KGet dialog opens for every capture.** The extension uses KGet's
|
||||
`showNewTransferDialog` D-Bus method, which opens the interactive "New
|
||||
Download" dialog rather than starting the transfer immediately. This is
|
||||
intentional — it lets you rename the file or change the destination folder
|
||||
before it starts. If you'd rather it start immediately without a prompt,
|
||||
see [Troubleshooting](#troubleshooting) for the alternate `addTransfer`
|
||||
call — note that route only returns once the dialog is dismissed, so it's
|
||||
not what the extension uses by default.
|
||||
- **No editable dialog.** Captures start immediately with no chance to
|
||||
rename the file or pick a different folder beforehand — rename/move it
|
||||
afterward in KGet or your file manager if needed. This is intentional: KGet
|
||||
only skips its interactive "New Download" dialog when given a real
|
||||
destination path up front, so instant capture and an editable prompt are
|
||||
mutually exclusive given KGet's D-Bus API.
|
||||
- **The context-menu capture can't always get the correct filename.**
|
||||
Auto-capture gets the real filename for free from Chrome's own
|
||||
`Content-Disposition` resolution. Right-click captures don't have that —
|
||||
the extension only has the raw URL — so KGet falls back to guessing from
|
||||
the URL path, which is wrong for opaque/signed URLs (e.g. cloud storage
|
||||
links). Fixing this would require broad host permissions and an extra HTTP
|
||||
request per right-click, which isn't worth it for now.
|
||||
- **Chrome may still show its own "Save As" dialog.** This is controlled by
|
||||
Chrome's own **Ask where to save each file before downloading** setting
|
||||
(`chrome://settings/downloads`) — no extension API can read or suppress
|
||||
it, and if it's on, Chrome shows the picker *before* our extension gets a
|
||||
chance to see the download at all. Turn that setting off for auto-capture
|
||||
to work without an extra prompt.
|
||||
- **KGet must already be running.** If it's not, captures fail silently from
|
||||
the user's perspective — check the service worker console for the actual
|
||||
error (see Troubleshooting).
|
||||
@@ -95,15 +110,14 @@ git push origin v1.0.0
|
||||
- **Test D-Bus directly:**
|
||||
```bash
|
||||
dbus-send --print-reply --dest=org.kde.kget /KGet \
|
||||
org.kde.kget.main.showNewTransferDialog array:string:"https://example.com/file.zip"
|
||||
```
|
||||
If this fails with `ServiceUnknown`, KGet isn't running. To skip the dialog
|
||||
and start a transfer straight away instead, use `addTransfer` with a real
|
||||
destination folder:
|
||||
```bash
|
||||
dbus-send --print-reply --dest=org.kde.kget /KGet \
|
||||
org.kde.kget.main.addTransfer string:"https://example.com/file.zip" string:"$HOME/Downloads" boolean:true
|
||||
org.kde.kget.main.addTransfer string:"https://example.com/file.zip" string:"$HOME/Downloads/file.zip" boolean:true
|
||||
```
|
||||
If this fails with `ServiceUnknown`, KGet isn't running.
|
||||
- **Download-finished notification not showing?** `install.sh` enables it via
|
||||
`kwriteconfig6 --file knotifyrc --group "Event/kget/finished" --key Action Popup`.
|
||||
Check System Settings → Notifications → Applications → "KGet Download
|
||||
Manager" to confirm it's on, or disable it the same way with
|
||||
`kwriteconfig6 --file knotifyrc --group "Event/kget/finished" --key Action None`.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user