Fix/file share receive on KDE and non English system - #9
Open
X-Ryl669 wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.