Skip to content

Fix/file share receive on KDE and non English system - #9

Open
X-Ryl669 wants to merge 2 commits into
zoir-dev:mainfrom
X-Ryl669:fix/file-share-receive
Open

Fix/file share receive on KDE and non English system#9
X-Ryl669 wants to merge 2 commits into
zoir-dev:mainfrom
X-Ryl669:fix/file-share-receive

Conversation

@X-Ryl669

Copy link
Copy Markdown

This fix file receiving from a KDE desktop notification and actually use XDG's Download folder path instead of the hardcoded "~/Downloads" folder that doesn't exist on a non English computer.

KDE doesn't show the Accept / Decline buttons on the notification with the current code. This PR adds the required quirks to get them back and react upon clicking them to allow receiving or refusing the files.

The code was written by Claude but I've checked it and fixed some minor bug.

X-Ryl669 and others added 2 commits August 13, 2026 17:27
Notifications were always posted through a short-lived `gdbus` child. That
was a GNOME Shell workaround: it ties a notification to its sender process
and instantly auto-dismisses one whose sender owns a window, so a windowless
throwaway sender was needed for the banner to appear at all.

Plasma wants the opposite. It strips a notification's action buttons the
moment the sending process leaves the bus, since a click could no longer be
delivered to anyone — and the `gdbus` child exits milliseconds after
posting. Every actionable banner therefore had nothing to click: an incoming
file share could not be accepted (the consent request fail-closed to a
decline after its 45 s timeout), and the incoming-call banner plus the
mirrored notification action buttons were just as dead.

Probe the running server once via GetServerInformation and use the transport
it actually needs: the `gdbus` child on GNOME Shell only, this process's own
long-lived session connection everywhere else. The connection is a
process-lifetime OnceCell, because one opened per call and dropped on return
is a sender that has already vanished — the same bug by another route.
ActionInvoked is broadcast on both shells, so the global sender-less
watchers keep routing clicks regardless of who posted. Both Notify call
sites now share one helper instead of duplicating the gdbus plumbing.

Also warn when the server does not advertise the "actions" capability
(dunst, mako), where these prompts can only ever time out.

Verified on Plasma 6.7.3/Wayland: server probed as Plasma/KDE, the banner
renders Accept/Decline, and the click arrives as ActionInvoked(fc:accept).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
downloads_dir() hardcoded $HOME/Downloads and apply_synced_file() runs
create_dir_all on it, so on a localised desktop — XDG_DOWNLOAD_DIR set to
$HOME/Téléchargements — an English-named folder was silently created beside
the real one and every received file was filed where the user never looks.
The transfer pill's hardcoded "Saved to Downloads" hid it further: it named
a folder it had never consulted, so the copy looked right while the files
were missing.

Resolve XDG_DOWNLOAD_DIR from the environment, else from the
~/.config/user-dirs.dirs that xdg-user-dir(1) reads (handling $HOME/${HOME}/~
prefixes, quoting, comments and last-assignment-wins), falling back to
~/Downloads only when nothing is configured. A configured-but-missing folder
is still used and created rather than falling back, since falling back on a
stale entry would reintroduce this exact bug. Resolved once per run: the
pill's emit() runs on every progress tick.

The completion pill now names the folder the files actually landed in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant