You are not logged in.
Include these command in my bash scripts
wl-copy $envwhen it's running on terminal they work very well -- like:$(./main.sh)
But when I run them in the desktop file browser, they don't work properly. -- like:double chick on the file,chose run button
and a couple of times they have worked,but even running the same file in two windows gave different results.
I want to use this script with shortcut,so i can't use the command.
how can i fix them?
I'm using "kde plasma 5.27.10" and "dolphin 23.08.4" with wayland
this is my wl-clipboard version:
$ wl-copy --version
wl-clipboard 2.2.1
Copyright (C) 2018-2023 Sergey Bugaev
...my script code is here:https://github.com/SourLemonJuice/quickParse-QR-bash
Last edited by lemonjuice233 (2024-01-09 10:14:35)
maybe translated from deepl/google,sorry (´・_・`)
Offline
Number one concern is that you have to double quote your bash variables to avoid whitespace splitting. DOUBLE QUOTE ALL!
Why is my code failing
Firstly if spectable fails then the program exits.
Secondly if zbar fails the programs notifies and exits.
Offline
Failing to quote the variable wouldn't cause a problem here as wl-copy will accept a string of text including spaces just fine.
But overall the script should just be drastically simplified first. The whole "Remove_Temp_Picture" function and calls to it can just be `rm -f $TempFile_Path`. You don't need to test whether or not it exists first ... just remove it. Next what is `case $(echo $XDG_SESSION_TYPE) in` for? Do you mean `case $XDG_SESSION_TYPE in`?
Finally, what makes you think wl-copy is failing? What diagnostics have you done? Does just using wl-copy on it's own in a script fail?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Number one concern is that you have to double quote your bash variables to avoid whitespace splitting. DOUBLE QUOTE ALL!
wl-copy can accept string with spaces, that's not the cause of this error, but it is a bug thanks, I'll remember it.
But overall the script should just be drastically simplified first. The whole "Remove_Temp_Picture" function and calls to it can just be `rm -f $TempFile_Path`. You don't need to test whether or not it exists first ... just remove it.
Because I'm a little afraid of rm, and there are two of the same function appeared in order to be a safer i to write them into a function first.i will change it.
Next what is `case $(echo $XDG_SESSION_TYPE) in` for? Do you mean `case $XDG_SESSION_TYPE in`?
It was just a stupid mistake. It was early in the morning.and i had just tested the variable with "echo" from the terminal.
Finally, what makes you think wl-copy is failing? What diagnostics have you done? Does just using wl-copy on it's own in a script fail?
Yes, I reproduced the error in a script with only "wl-copy xxx", and I'm pretty sure it's not that repository's wrong.
Sorry I may not have been clear, I tested these ways:
1. Create a new script in "/home/user/temp/test.sh" with file browser, and give running privileges.
#!/bin/bash
wl-copy "wl-copy_Test"2. Copy something(like 'docker') and double chick script, open the Clipboard Manager, the last record is 'wl-copy_Test'
3. Copy script file to the "/home/user/test.sh", copy and double chick, last record is 'docker'
4. Copy 'docker' and open terminal in "/home/user" run "./test.sh", last record is 'wl-copy_Test'
5. Close first file browser windows(/home/user/temp/), reopen with same path, copy 'docker' and run it again, then it fails too, clipboard still 'docker'.
6. In file browser delete "/home/user/temp/test.sh" and recreate it do same thing, it doesn't even work.
Running the scripts in a terminal worked fine in all the tests, it should be a desktop environment issue.
I'm using virtual desktop, but I also have the "跨桌面会话保存历史记录/? Save history across desktop sessions ?" option of the clipboard manager turned on.
I moved my desktop on testing, but in all tests the windows are opened in the same virtual desktop.
maybe translated from deepl/google,sorry (´・_・`)
Offline
So it sounds like the script just isn't running when you "double click" it.
Test with the following:
#!/bin/bash
date >| ~/last_run
wl-copy "wl-copy_Test"Create that script and then double click the script in whatever GUI you are using and check whether the file ~/last_run was created.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
It ran, "last_run" was created, and there's "date" output in the file.
Actually, it should be the same because that bigger script only copy function doesn't work.
Last edited by lemonjuice233 (2024-01-07 15:02:26)
maybe translated from deepl/google,sorry (´・_・`)
Offline
What exactly is "file browser" and does it maybe run on xwayland?
How do you test the clipboard? Whata if you wl-paste in the same script (into some file)?
Offline
What exactly is "file browser" and does it maybe run on xwayland?
How do you test the clipboard? Whata if you wl-paste in the same script (into some file)?
file browser is dolphin. I use the clipboard component in plasma's system tray to see copy history.
I'm using "kde plasma 5.27.10" and "dolphin 23.08.4" with wayland
I just tried wl-paste and it still outputs what I copied before.
wl-copy "wl-test"
wl-paste > ./testI tested it with "xwininfo" and dolphin is running in wayland mode at all times.
But the problem does seem to be related to xwayland.
I was using VScode as an editor when I wrote that project. VScode did using the xwayland.
I just did the test.When "first" dolphin window opened by VScode(Open containing folder), then it work fine.
But if it is first window opened by something like krunner/Meta+E, then it won't work even if it is opened by VScode.
If you close all the dolphin and test again, this phenomenon is always reproduced!
But still don't seem to know how to fix it.
(;¬_¬)
maybe translated from deepl/google,sorry (´・_・`)
Offline
dolphin runs a single process, subsequent invocations just spawn a new window inside the existing process.
Does your original script (w/ support for xsel) work in the vscode/dolphin test or even the limited test script that exclusively uses wl-copy/paste?
Does the vscode/dolphin window run on xwayland?
Offline
Does your original script (w/ support for xsel) work in the vscode/dolphin test or even the limited test script that exclusively uses wl-copy/paste?
have xclip, but not in wl-copy/paste's test, that's just a two line script.
Does the vscode/dolphin window run on xwayland?
dolphin is running in wayland mode, VScode is running in xwayland mode at all times.
I know I have to update archlinux to the latest package before posting, but it's only been a few days.
These are the updated software, qt5 is in here maybe it solved the problem.(It's just a random copy. Just know what's there.)
fcitx5-chinese-addons-5.1.3-1 fcitx5-configtool-5.1.3-1 fcitx5-gtk-5.1.1-1 fcitx5-qt-5.1.4-2
ffmpeg-2:6.1.1-1 frei0r-plugins-2.3.2-2 gperftools-2.14-1 gst-plugins-bad-1.22.8-2
gst-plugins-bad-libs-1.22.8-2 gst-plugins-base-1.22.8-2 gst-plugins-base-libs-1.22.8-2
gst-plugins-good-1.22.8-2 gstreamer-1.22.8-2 kwin-5.27.10-2 lib32-sdl2_image-2.8.2-1
libime-1.1.4-1 libplacebo-6.338.1-1 libsixel-1.10.3-5 linux-6.6.10.arch1-1
linux-headers-6.6.10.arch1-1 mlt-7.22.0-2 mpv-1:0.37.0-1 ppp-2.5.0-3 pyside2-5.15.12-1
python-constantly-15.1.0-14 python-distro-1.9.0-1 python-mako-1.3.0-1 python-numpy-1.26.3-1
python-shiboken2-5.15.12-1 python-urwid-2.4.1-1 python-ytmusicapi-1.4.2-2
qt5-base-5.15.12+kde+r147-1 qt5-charts-5.15.12-1 qt5-connectivity-5.15.12+kde+r6-1
qt5-declarative-5.15.12+kde+r31-1 qt5-doc-5.15.12-1 qt5-graphicaleffects-5.15.12-1
qt5-imageformats-5.15.12+kde+r10-1 qt5-location-5.15.12+kde+r6-1
qt5-multimedia-5.15.12+kde+r2-1 qt5-networkauth-5.15.12-1 qt5-quick3d-5.15.12+kde+r1-1
qt5-quickcontrols-5.15.12-1 qt5-quickcontrols2-5.15.12+kde+r5-1 qt5-remoteobjects-5.15.12-1
qt5-script-5.15.16-2 qt5-sensors-5.15.12-1 qt5-serialport-5.15.12-1
qt5-speech-5.15.12+kde+r1-1 qt5-svg-5.15.12+kde+r6-1 qt5-tools-5.15.12+kde+r4-1
qt5-translations-5.15.12-1 qt5-wayland-5.15.12+kde+r61-1 qt5-webchannel-5.15.12+kde+r3-1
qt5-webengine-5.15.16-2 qt5-websockets-5.15.12+kde+r2-1 qt5-webview-5.15.12-1
qt5-x11extras-5.15.12-1 qt5-xmlpatterns-5.15.12-1 vapoursynth-R65-1
virtualbox-host-modules-arch-7.0.12-15After updating and rebooting, I retried these tests and they all work now.
#!/bin/bash
wl-copy "wl-test"
echo "xsel-test" | xsel -ib
wl-paste > ./testFileNow its output and my clipboard will always be "wl-test".
I checked qt5-base's last update was 2024-01-06 17:51 UTC, which was released a few hours after my first post.
Last edited by lemonjuice233 (2024-01-08 07:21:05)
maybe translated from deepl/google,sorry (´・_・`)
Offline
Wait, why isn't it working again? I'd better go to the VM and check it out
maybe translated from deepl/google,sorry (´・_・`)
Offline
Try this outside plasma or at least kill klipper.
Offline
I just went to test it under gnome and nothing is wrong there
Including running scripts under plasma using gnome's "file" without errors.
This may have something to do with the way they run scripts, after all, gnome's "file" opens their terminal window when running scripts and it looks just like running them from a terminal.
So could this be a plasma's bug?
Apart from the fact that opening it in vscode works as I said above, it works almost randomly and I can't figure out when it works and when it doesn't!
I'll probably try the plasma git version or reinstall something later, until then this is it
Thanks for the help guys, and sorry for the long reply cycle.
Last edited by lemonjuice233 (2024-01-08 13:19:36)
maybe translated from deepl/google,sorry (´・_・`)
Offline
It's still hard to have a problem and not fix it, that's my current plasma version and all of the above problems don't happen anymore
But this is a lot of bugs, I thought plasma6 was close to stable, but that the qt6.7's problem.
It's finally over.
_(:з」∠)_
Operating System: Arch Linux
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.7.0
Kernel Version: 6.6.10-arch1-1 (64-bit)
Graphics Platform: Waylandmaybe translated from deepl/google,sorry (´・_・`)
Offline
Did you try to run this on KDE w/o klipper active?
Offline
I did forget about that.
But I force downgraded back to the old version to test it (I got a little too angry)
emm the previous problem still reproduces, also after disabled klipper
This should really be a bug somewhere else.
Last edited by lemonjuice233 (2024-01-08 15:05:08)
maybe translated from deepl/google,sorry (´・_・`)
Offline
Did klipper auto-restart?
Does copying twice help?
https://bugs.kde.org/show_bug.cgi?id=466041
Offline
emm, how do I actually shut down kllipper, I don't have a corresponding process on my system either
I just close it from the system tray.
$ ps -aux |grep klipper
lemon 2540 0.0 0.0 9656 2476 pts/1 S+ 18:32 0:00 grep --color=auto klipperAlso tried stopping "plasmashell" again, which won't make it work either.
this is test script
#!/bin/bash
wl-copy "wl-test"
wl-paste > ./testFilewl-paste outputs what I ctrl+c normally, and I can ctrl+v normally, but still only wl-copy doesn't work.
I'm pretty sure no one else is interfering with the clipboard now, because I now have to keep kate on to copy the above paragraph from it
#!/bin/bash
wl-copy "wl-test"
wl-copy "wl-test"
wl-paste > ./testFileRepeat twice also don't work.
Is there any way to find out more info about dolphon's windows?
Last edited by lemonjuice233 (2024-01-09 11:06:46)
maybe translated from deepl/google,sorry (´・_・`)
Offline