Is there a Linux equivalent to ...?

Mark Kelly ubuntu at wastedtimes.net
Sun Nov 25 01:23:23 UTC 2007


Hi.

On Saturday 24 November 2007 22:45, Pete Holsberg wrote:
> I'm looking for a program that works all the time.

It's not a perfect solution, but you could use xclip, a console tool, to 
achieve something similar. It's not installed by default, so install it 
with whatever tool you prefer. It's in the universe repo's.

You'd have to make a bash script containing your pre-defined texts then use 
a program launcher or some icons, but you could get the same effect...

To see xclip do it's stuff enter the following in a console:

    echo -n "middle-click to paste me"|xclip

Nothing will be returned, but middle-click pasting will 
insert "middle-click to paste me" wherever you want it.

That's half the job.

To get it working from clickable buttons you need to make a shell script 
that you can run from an icon.

Open a text editor, paste the code between the lines below, then save it in 

    /home/USERNAME/bin/mypaste.sh

Then run it with a parameter to select your text, like:

    mypaste.sh email

will put the email address me at example.com into the clipboard ready to be 
middle-click pasted wherever you like.
	
Last stage (sorry this is long!) just find an app launcher you like and set 
up a collection of buttons that run the script with the parameter to 
select the different text snippets. 

I did it while testing this by simply making a new "link to application" on 
my desktop called "PasteAddress" that ran the 
command "home/USERNAME/bin/mypaste.sh address". Clicking the icon loads up 
my address the clipboard ready for pasting. Note that the full path is 
required in an icon.

It's not as convenient as having a simple app to use, but it'll do the same 
thing. Just edit my examples to match what you want.

Hope this helps, sorry it's long-winded.

Mark


#--------------------------------------------------------------------------
#! /bin/bash
# put specific text into the clipboard

case "$1" in

# This one you paste with menu > edit > paste or ctrl-v
"address" ) echo -n "my address"|xclip -selection clipboard

#This one you paste with middle-click
"email" ) echo -n "me at example.com"|xclip

#This one has multi-line text and the second line starts with a tab
"reply" ) echo -ne "Hi.\n\tThanks for the email. I am fine."|xclip

esac
#--------------------------------------------------------------------------




More information about the ubuntu-users mailing list