Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

.desktop exe copy text to clipboard

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
scott092707
Posts: 15
Joined: 2019-04-19 00:07

.desktop exe copy text to clipboard

#1 Post by scott092707 »

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

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: .desktop exe copy text to clipboard

#2 Post by Dai_trying »

You could try putting your commands in a script and then call the script from the .desktop file.

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: .desktop exe copy text to clipboard

#3 Post by sickpig »

Code: Select all

xdotool key ctrl+c
is what i use

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: .desktop exe copy text to clipboard

#4 Post by Head_on_a_Stick »

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"
deadbang

scott092707
Posts: 15
Joined: 2019-04-19 00:07

Re: .desktop exe copy text to clipboard

#5 Post by scott092707 »

>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: 15
Joined: 2019-04-19 00:07

Re: .desktop exe copy text to clipboard

#6 Post by scott092707 »

@sickpig

Code: Select all

xdotool key ctrl+c
is what i use
That looks like a neat tool!

Post Reply