Summary: | Applications launched from Hotkeys/Shortcuts are missing standard-streams (stdin, stdout, stderr) in Wayland | ||
---|---|---|---|
Product: | [Applications] systemsettings | Reporter: | QeMXA2JNeU.bugs.kde.org |
Component: | kcm_keys | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | aextefyhzyohfubdhk, bugs.kde.org, CupricReki, djhaskin987, kde-bugs, kde, moritz-kdebugs, nate, nicolas.fella, plasma-bugs |
Priority: | NOR | Keywords: | wayland |
Version: | 5.27.4 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
QeMXA2JNeU.bugs.kde.org
2023-05-03 19:51:45 UTC
Issue for wl-clipboard where this has been discovered: https://github.com/bugaevc/wl-clipboard/issues/153 > 2. Add script as shortcut
Where specifically are you doing this?
(In reply to Nate Graham from comment #2) > > 2. Add script as shortcut > Where specifically are you doing this? Settings > Shortcuts > Add Application/Command (I know both do the same in the end, but have tested both, issue exists with both) I have discovered this issue directly from the linked wl-clipboard issue ( https://github.com/bugaevc/wl-clipboard/issues/153 ) while creating one of my own ( https://github.com/bugaevc/wl-clipboard/issues/201 ). Lack of stdout/stderr redirection for scripts triggered by KDE hotkeys seems like a weird design choice. I expected possible errors to be automatically redirected to DE's logs like what I observed in Sway before. I can provide more complete setup reproducing the issue: in `plasma-manager-commands.desktop`: > [Desktop Action get-kwallet-password] > Exec=get-kwallet-password > Name=Copy KWallet Password to clipboard in `~/.config/kglobalshortcutsrc`: > [plasma-manager-commands.desktop] > _k_friendly_name=Plasma (Home) Manager Commands > foot=Meta+Return,none,foot > get-kwallet-password=Meta+Shift+P\tMeta+J,none,get-kwallet-password in `~/.local/bin/get-kwallet-password`: > #!/usr/bin/env bash > pass show kwallet | wl-copy -n > notify-send --expire-time=10000 --wait "KWallet password" "is available in clipboard until this notificaton closes" > for i in {1..10} ; do > echo "password cleared $i times" | wl-copy > done > wl-copy --clear I just upgraded to Fedora 39 from Fedora 38. In the process, I upgraded to KDE 5.27.9 . I hit this bug on upgrade. I have (something like) this line in a script I fire off via keyboard shortcut: printf "${thing}" | wl-copy I was able to work around this bug by ensuring that output and error were hooked up to something inside the script: printf "${thing}" | wl-copy >/dev/null 2>/dev/null This works because the pipe supplies stdin, the `>` supplies stdout, and the `2>` supplies a stderr for the wl-copy process. >1. Write script to test for stdin/stdout/stderr
# Test for stdout
if [ -t 1 ]; then
echo "stdout exists" >> /tmp/output
else
echo "stdout does not exist" > /tmp/output
fi
Are you sure this is a useful test?
-t means "file descriptor FD is opened on a terminal". But we are not launching things in a terminal, so I wouldn't expect it to be true? Or am I misunderstanding this?
Using wl-copy in a script launched from a shortcut works as expected for me on Plasma 6 (but not Plasma 5). I suspect https://invent.kde.org/plasma/kglobalacceld/-/commit/d9607ef5d150135937f9467c9ce27fa9ba8cbabe has fixed it, but I can't say with certainty |