.desktop exe copy text to clipboard

If none of the more specific forums is the right place to ask

.desktop exe copy text to clipboard

Postby scott092707 » 2019-12-20 02:50

I wish to have a .desktop file in my panel's quick launch, that when clicked upon,
copies a text phrase to the clipboard, that I would then ctrl-v paste into an app's text box.

I have researched the command that should work:

echo -n 'blah blah blah' | xclip -selection clipboard

This works fine from the terminal, but does nothing when I create a .desktop file,
and place this in the Exec field (and then drag the item out of the menu to the panel's quick launch).

Here is the .desktop file:

Code: Select all
[Desktop Entry]
Name=PPtoClipboard
Comment=Copy the PP to the Clipboard
Exec=echo -n 'blah blah blah' | xclip -selection clipboard
Icon=/home/scott/.local/share/applications/PPtoClipboard.png
Terminal=true
Type=Application
Categories=GNOME;GTK;Utility;
StartupNotify=true


(I modified another .desktop file. I don't know what StartupNotify does.)
I have tried Terminal=false, =true, and commented out.
I have tried:
qterminal -e "echo -n 'blah blah blah' | xclip -selection clipboard"
qterminal -e 'echo -n "blah blah blah" | xclip -selection clipboard'
and (I think)
qterminal -e echo -n 'blah blah blah' | xclip -selection clipboard

I am probably overlooking something basic, but I don't know what...

I am using Debian testing lxqt, dating from 20190311, and updated/upgraded
from time to time.

scott@ASUS-PRIME-B350M-A-CSM:~$ uname -a
Linux ASUS-PRIME-B350M-A-CSM 4.19.0-2-amd64 #1 SMP Debian 4.19.16-1 (2019-01-17) x86_64 GNU/Linux
scott@ASUS-PRIME-B350M-A-CSM:~$ lsb_release -dsc
Debian GNU/Linux bullseye/sid
bullseye
scott@ASUS-PRIME-B350M-A-CSM:~$ echo $DESKTOP_SESSION
/usr/share/xsessions/lxqt
scott092707
 
Posts: 14
Joined: 2019-04-19 00:07

Re: .desktop exe copy text to clipboard

Postby Dai_trying » 2019-12-20 10:40

You could try putting your commands in a script and then call the script from the .desktop file.
Dai_trying
 
Posts: 858
Joined: 2016-01-07 12:25

Re: .desktop exe copy text to clipboard

Postby sickpig » 2019-12-20 10:53

Code: Select all
xdotool key ctrl+c
is what i use
User avatar
sickpig
 
Posts: 329
Joined: 2019-01-23 10:34

Re: .desktop exe copy text to clipboard

Postby Head_on_a_Stick » 2019-12-20 15:54

scott092707 wrote:
Code: Select all
Exec=echo -n 'blah blah blah' | xclip -selection clipboard

The Exec line doesn't understand pipes so try
Code: Select all
Exec=sh -c "echo -n 'blah blah blah' | xclip -selection clipboard"
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: .desktop exe copy text to clipboard

Postby scott092707 » 2019-12-21 01:02

>Exec=sh -c "echo -n 'blah blah blah' | xclip -selection clipboard"
That did the trick (once I used "Terminal=false")!

Thank you very much!
scott092707
 
Posts: 14
Joined: 2019-04-19 00:07

Re: .desktop exe copy text to clipboard

Postby scott092707 » 2019-12-21 01:25

@sickpig

Code: Select all
xdotool key ctrl+c

is what i use


That looks like a neat tool!
scott092707
 
Posts: 14
Joined: 2019-04-19 00:07


Return to General Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable