Further Gnome Command-Line Integration

Updated: Sun, Jul 27, 2008 - 6:49pm

In a previous post, I talked about my command-line program that opens files in the same manner as gnome would if you had double-clicked it in nautilus.
I have another piece of integration that I'd like to see: Clipboard integration.

The Problem

I'm always editing text files in vim, or viewing them in less, in a terminal window. Sometimes, though, I want to take that file and copy it to the clipboard so that I can paste it into, say, a textarea in my web browser.
I could normally just drag my mouse, or select all, or whatever, then copy/paste. But using the terminal breaks that metaphor, because selecting all just selects all the things on the screen (or at most the scrollback buffer). If my file is longer than the screen or the scrollback buffer, it's difficult to get it onto the clipboard.
What I usually do in that situation is to open the file in gedit and then select all, copy, then paste. Pain in the butt!

The Solution

Why not skip the middleman? make a program that runs on the command line, takes stuff from stdin (or a named file), and then uses the gnome or X11 apis to put that text onto the clipboard. Easy as pie.

  1. % cat blog-entry-I-wrote-offline.txt | enclip

Your rating: None Average: 5 (1 vote)

Essay writing is always easy

Essay writing is always easy with http://special-eesays.com

Thanks for this information.

Thanks for this information. I'll folow this blog :)

P.S. childhood essays 

We have no portals like

We have no portals like yours and it was easier to live :))) I will be glad to receive from you on Old Coding and different FAQ Thank you