notify: XDG token is now expected to be prefixed with xdgtoken=

This patch modifies our stdout reader to consume input as we go,
instead of all at once when stdout is closed. This will make it easier
to add support for reading e.g. the daemon assigned notification ID in
the future, and also ensures we see the XDG activation token "as soon
as possible".

Furthermore, to be more future proof, require the XDG activation token
to be prefixed with 'xdgtoken=', and ignore other lines.

Thus, instead of treating *all* of stdout as the XDG activation token,
parse stdout line-by-line, and ignore everything that does not begin
with 'xdgtoken='. Everything (on that line) following 'xdgtoken=' is
treated as the activation token.
This commit is contained in:
Daniel Eklöf 2024-07-23 09:33:18 +02:00
parent e52d6e3fb8
commit b319618af1
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 74 additions and 30 deletions

View file

@ -463,11 +463,14 @@ Note: do not set *TERM* here; use the *term* option in the main
has been configured.
For this to work, foot needs an XDG activation token. To this
end, foot will read the command's stdout; everything printed
there, not including trailing newlines, are assumed to be part
of the activation token. There is no harm in printing
something else on stdout - it will simply result in the
activation failing (i.e. the window will not be focused).
end, foot will read the command's stdout; a line prefixed with
*xdgtoken=* will be recognized as containing the XDG
activation token:
xdgtoken=18179adf579a7a904ce73754964b1ec3
The expected format of stdout may change at any time. Please
read the changelog when upgrading foot.
*Note*: notify-send does not, out of the box, support
reporting the XDG activation token in any way. This means