LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   paste commonly used chunks of text? (https://www.linuxquestions.org/questions/linux-software-2/paste-commonly-used-chunks-of-text-771819/)

Chriswaterguy 11-26-2009 09:45 PM

paste commonly used chunks of text?
 
I want to easily paste commonly used selections of text. I regularly edit wiki pages, and send emails with similar core text, so this would be handy. Something light and quick with a simple hotkey popup would be ideal.

I've heard of such things, but can't find one now - lacking the right search terms I think (insert commonly used text didn't work, even in http://www.google.com/linux).

Any suggestions?

i92guboj 11-26-2009 09:52 PM

I am not sure if this is what you need. But you can give it a try.

Parcellite is a clipboard manager that can be used for many things, but amongst its many features it has a history that can be accessed with the keyboard, using control+alt+h. You can run parcellite (it will live in your system tray if you have one), then select the many text fragments in any arbitrary order, and then just use the history menu to select whatever you can to paste at a given time. Then just paste as usual.

Chriswaterguy 11-27-2009 12:09 AM

An adapted Parcellite might do it
 
Thanks, i92guboj.

Quote:

Originally Posted by i92guboj (Post 3770928)
Parcellite is a clipboard manager that can be used for many things, but amongst its many features it has a history that can be accessed with the keyboard, using control+alt+h. You can run parcellite (it will live in your system tray if you have one), then select the many text fragments in any arbitrary order, and then just use the history menu to select whatever you can to paste at a given time. Then just paste as usual.

Actually I already use Parcellite and it's great (but I didn't know about the keyboard shortcut - thanks).

What would be great would be another version of Parcellite, where the text fragments are put there manually, rather than updated when I paste text.

bartonski 11-27-2009 12:50 AM

You might look at xsel. This gives the ability to write text from the command line directly into the X selection buffer:

Code:

echo "asdf asdf asdf" | xsel
or from a file:

Code:

xsel < file
Let's say that you have a shell open, then

Code:

$ alias texta='echo text A that I want to paste|xsel'
$ alias textb='echo text B that I want to paste|xsel'

then, whenever you want to past 'text A that I want to paste' into your document, you alt-tab to your shell and type 'texta'. This loads the cut and paste buffer, then you can paste into your application. Same goes for 'textb' and 'text B that I want to paste'.

Granted, it's a little clunky; being able to load copy buffers directly, then paste them with a key combination would be a lot quicker. Still, it's probably better than re-selecting text over and over, especially if you use one-letter aliases.

now, if I could only get this to work with the cut and paste buffer in windows, where I actually need this for my 9-5 job...

Chriswaterguy 11-27-2009 11:35 PM

bartonski: thanks, interesting.

So, if no one has made a light program to do this already, all that needs to be done is to build a very simple interface on top of what you've done there, to make it smoother. Actually, I'm not a coder, so... is this simple?

My thought:
* create a simple program that pops up with a list when run. This is where I'm fuzziest - could parcellite be hacked to provide this?
* each item in the list triggers a command when selected. This would be echo "asdf asdf asdf" | xsel for example.
* hopefully the list in the GUI either shows the text to be pasted, or at least can be edited.
* ideally, the text would then also be pasted - to do this the window would have to close itself and operate the paste command in whatever window and edit box you were in previously. Don't know how easy that is.

The program can then be given a hot key by the user, or have one allocated automatically as with parcellite.

So... easy or hard?

Elv13 11-28-2009 12:33 AM

One word: klipper

bartonski 11-28-2009 08:54 PM

Quote:

Originally Posted by Chriswaterguy (Post 3772014)
bartonski: thanks, interesting.

So, if no one has made a light program to do this already, all that needs to be done is to build a very simple interface on top of what you've done there, to make it smoother. Actually, I'm not a coder, so... is this simple?

I don't know; I've never written that type of program (all the stuff I write is text manipulation, mostly in Perl or shell+grep/awk/sed). Having said that, there's not a whole lot there, so it shouldn't be that hard to write.

Come to think of it, I think that xsel comes with an API in C, even that shouldn't be that hard to hack with.

Definitely sounds like an interesting educational project.

Chriswaterguy 11-29-2009 06:29 AM

user's own choice of text chunks
 
Quote:

Originally Posted by Elv13 (Post 3772043)
One word: klipper

No, that's a heavy (but slightly more fully featured) equivalent of Parcellite. Glipper does the same for GNOME. Those all store a history, rather than the user's own choice of text chunks.

bigrigdriver 11-29-2009 05:38 PM

In KDE, you have knotes; in Gnome, you have gnotes. Add the samples of text to the post-it note, then click on the icon in the tray to bring the notes to foreground when you need them. Highlight the text you want, ctrl-C to copy. Put the cursor in the document you want text pasted into, and ctrl-V to paste.

Chriswaterguy 11-30-2009 02:09 AM

post-it options
 
Quote:

Originally Posted by bigrigdriver (Post 3773676)
In KDE, you have knotes; in Gnome, you have gnotes. Add the samples of text to the post-it note, then click on the icon in the tray to bring the notes to foreground when you need them. Highlight the text you want, ctrl-C to copy. Put the cursor in the document you want text pasted into, and ctrl-V to paste.

Nice solution, thanks.

There are a bunch of postit package options - I see xpad is installed on my system (probably much lighter than anything Gnome-specific) and xpostit is available and even smaller (29 kB download). There must be others too.

Just have to figure out which is most suitable, with a light footprint (I'm thinking less than 5MB RAM usage, preferably much less), and the least keystrokes & clicks needed.

bartonski 11-30-2009 07:28 AM

Quote:

Originally Posted by Chriswaterguy (Post 3774077)
Nice solution, thanks.

There are a bunch of postit package options - I see xpad is installed on my system (probably much lighter than anything Gnome-specific) and xpostit is available and even smaller (29 kB download). There must be others too.

Just have to figure out which is most suitable, with a light footprint (I'm thinking less than 5MB RAM usage, preferably much less), and the least keystrokes & clicks needed.

You may be able to shave some keystrokes by creating keyboard shortcuts using system->preferences->keyboard shortcuts under gnome. I was trying to work this out last night with my 'xsel' solution. The problem is that I believe that simply launching xsel isn't enough; the process where it is launched from needs to stay open... on the other hand I don't just want to launch processes that I'm not going to terminate, every time I hit one of the keyboard shortcuts. I don't think that these are insurmountable problems, but I haven't had the time to play around with them.


All times are GMT -5. The time now is 02:32 AM.