You are not logged in.

#1 2009-09-09 03:45:12

Verve87
Member
Registered: 2009-09-09
Posts: 7

Linux clipboard HELL

Why are linux's clipboards such a mess? Is it even possible to sync vim's yank, mouse highlight/middle mouse, ctrl+c, shift+ctrl+c, vc's clipboards and X11's clipboards into one single clipboard?

Why so many clipboards? And how do keyboard purists copy and paste from the terminal (xclip can do this, but it doesn't emulate the mouse pointer's behaviour that allows you can copy from the entire screen) without using the mouse?

And why does nobody care about this?

Last edited by Verve87 (2009-09-09 03:47:04)

Offline

#2 2009-09-09 08:33:31

Heller_Barde
Member
Registered: 2008-04-01
Posts: 245

Re: Linux clipboard HELL

Verve87 wrote:

And why does nobody care about this?

I wondered that myself a few weeks ago. every time I read a thread like this, people jump out to defend that behaviour, and I think it's plain silly. I mean I can't even copy a url from a terminal and paste it into a existing location bar, because i'd have to select the current url which destroys my clipboard again... So silly....

cheers Barde

Offline

#3 2009-09-09 08:37:20

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Linux clipboard HELL

Verve87 wrote:

And why does nobody care about this?

Off the top of my head, I can think of two people who care about this.. wink

The question is - do you care enough to do something about it?

Offline

#4 2009-09-09 09:07:19

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Linux clipboard HELL

Heller_Barde wrote:
Verve87 wrote:

And why does nobody care about this?

I wondered that myself a few weeks ago. every time I read a thread like this, people jump out to defend that behaviour, and I think it's plain silly. I mean I can't even copy a url from a terminal and paste it into a existing location bar, because i'd have to select the current url which destroys my clipboard again... So silly....

cheers Barde

I think it's non-issue what you described, if you bind some key to

xsel -o | xsel -b

Select the uri in terminal, trigger this keybinding, then you just <C-v> into the location bar.

I personally find it could sometimes also be useful when you have multiple selecions/clipboards.
That said, I do agree this could be improved.


This silver ladybug at line 28...

Offline

#5 2009-09-09 09:26:33

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: Linux clipboard HELL

lolilolicon wrote:
Heller_Barde wrote:
Verve87 wrote:

And why does nobody care about this?

I wondered that myself a few weeks ago. every time I read a thread like this, people jump out to defend that behaviour, and I think it's plain silly. I mean I can't even copy a url from a terminal and paste it into a existing location bar, because i'd have to select the current url which destroys my clipboard again... So silly....

cheers Barde

I think it's non-issue what you described, if you bind some key to

xsel -o | xsel -b

Select the uri in terminal, trigger this keybinding, then you just <C-v> into the location bar.

I personally find it could sometimes also be useful when you have multiple selecions/clipboards.
That said, I do agree this could be improved.

Sorry... the fact that you need a workaround to archive this makes it clear: there IS an issue

-Linux clipboard is a mess... the clipboard is empty, if you close the window, where the paste came from.
-there are at least 3 different clipboards, that all have different keybindings and that are NOT synced (and worst of all: they dont work everywhere)
-even clipboard managers like klipper have issues with the different clipboard types


So yes... this is a mess. Sadly i think everyone likes its own model. Its no problem that we have 2 common ways to fill/read the clipboard (ctrl+c/v and middleclick), the real issue is that they are not compatible.

We need ONE clipboard register which keeps its history regardless of the application being closes or not. Then clipboard managers can do the one task they have been designed for: managing a history.


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#6 2009-09-09 09:28:06

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Linux clipboard HELL

I totally agree that this is clipboard insanity. This even makes Windoze look good. Perhaps there should be a clipboard daemon that overwrites all clipboards with the latest copied text (except for the selection buffer). I would do it myself but I don't have the programming skills.


How's my programming? Call 1-800-DEV-NULL

Offline

#7 2009-09-09 09:58:49

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Linux clipboard HELL

There is an issue. Its called the price of having choice. Two big DEs, tons of WMs, and a gazillion apps. Is someone going to sit everyone down (perhaps the X11 people) and say "this is how clipboard is going to work"? What about people who don't even use X?

I just got used to it, as long as you always use Ctrl-C/Ctrl-V (with Ctrl-Shift instead in the terminal) things work just fine. Clipboard persistance is another matter, but I believe there's separate apps which can handle that for you. Never saw the need.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#8 2009-09-09 10:47:36

Janarto
Member
From: Paris
Registered: 2008-09-23
Posts: 80

Re: Linux clipboard HELL

Sun manage to share a clipboard between 10 virtual machines, so that should be possible under a single linux system big_smile

Offline

#9 2009-09-09 10:59:31

Vintendo
Member
From: Netherlands
Registered: 2008-04-21
Posts: 375
Website

Re: Linux clipboard HELL

The clipboard should be seperate from the window manager, but connected to X11 however. It should be a daemon that is started in .xinitrc and to which all apps can connect to. It should open a /tmp file where all apps can write there clipboard content to. The problem isn't to write such a program, I think even I could do that in C, but all programs should use that format. If you have a fifo file in /dev/clipboard that always exist and to which the clipboard daemon can connect to... This could also work out of X...

Offline

#10 2009-09-09 11:06:35

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Linux clipboard HELL

Rasi, I do like your idea of one clipboard keeping one history. smile

I just want to point out one thing:

Some days back I booted into Windows because I needed avisynth. What I found myself doing was, I always selected the text, then navigate to somewhere and middle-click or shift-intsert. LOL I laughed at myself.
Well, you may think I'm too lazy... but I do love this:

When you just select some text, it's ALREADY in your middle-click!

This is a great feature IMHO, albeit some mess introduced. e.g. the location bar paste issue as Barde already mentioned. I can think of several solutions for this specific problem:

1. The 'xsel -o | xsel -b' method which makes it behave like Windows.
2. Select the text in terminal, <C-t> open a new tab, and middle-click into the empty location bar.
3. Use uzbl. A single keystroke and it will load that uri in your X primary selection or X clipboard. Whatever you like.
4. Use vimperator, if you use firefox. Hit t, shift-insert, enter. It works like vim normally but you can hit <C-v> once to bring it back to normal firefox behaviour.

Anyway, you do have solutions (and not bad ones I think) for this specific problem.

Alright, obviously there *are* issues.

My main point here is that I *want* that convenience of simple select-and-click. Then here comes the paradox:
Before you paste what you selected, you cannot select anything else.

What I imagine as a solution to this paradox:
Introduce a switch, which enables/disables reading into X primary selection.
Or, if you think of vim, there is a 'set clipboard+=unnamed' command which forces vim to yank/cut into X primary selection instead of its own(Does this help, Verve87?). Likewise, imagine a switch for the X selection behavior that toggles two modes: 1. dump the selected text into X primary selection. 2. dump the selected text into X clipboard.

I honestly admit I have not much knowledge on this subject, nor even experience.

But I finally suggest that people experiencing this problem described his/her issues in detail. Maybe somebody will hack it.

Last edited by lolilolicon (2009-09-09 11:07:44)


This silver ladybug at line 28...

Offline

#11 2009-09-09 11:37:30

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Linux clipboard HELL

BTW, lolilolicon: vimperator has p/P to open the URL in primary selection.

I like the idea of history, say 5 items. example
1. http://verylonggooglesearch.com
2. nothing
Select everything in the fx url bar to delete
1. http://bbs.archlinux.org
2. http://verylonggooglesearch.com
3. nothing
Press rotate(?) key.
1. googlesearch
2. nothing
3.
5. bbs?

Offline

#12 2009-09-09 11:41:33

Willie Green
Member
Registered: 2009-06-12
Posts: 70

Re: Linux clipboard HELL

zowki wrote:

I totally agree that this is clipboard insanity. This even makes Windoze look good. Perhaps there should be a clipboard daemon that overwrites all clipboards with the latest copied text (except for the selection buffer).

Boy, is that ever an understatement!!!

I was using a little shareware clipboard manager way back in Win 3.0 that was a heckuva lot better than anything I've come across in linux. It not only provided a little popup window with my most recent clips, but also instant access to an organized library of hundreds (if not thousands) of text clips that I used over the years. I used to store all kinds of information with that program: names and addresses, quotations, snippets of html code, urls.... basicly anything I thought I might have to type over and over again. It was much easier to simply popup the clipboard manager and click on the snippet I wanted to paste.

That little shareware program eventually evolved/merged into Spartan Multi Clipboard, which is more sophisticated than what I was using. But the clipboard managers I've seen in linux are really primitive in comparison.

But then again, maybe there is a linux equivalent to that kind of text-clip library utility that simply isn't integrated with the "clipboard" or maybe it's called something different than "clipboard", or whatever....

Sorry for the rant, but that was such a handy little utility that I relied on day-in and day-out for YEARS and I sorely miss it. I have no idea why the linux world is so far behind in this area... it seems like it should be a relatively simple project for a group of talented programmers.


"Some people march to a different drummer - and some people polka"

Offline

#13 2009-09-09 11:43:12

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: Linux clipboard HELL

The history behind Ctrl-c, Ctrl-z, Ctrl-v, Ctrl-d and Ctrl-\ can be found on Wikipedia. A good place to start reading is http://en.wikipedia.org/wiki/Control-C. Short answer -- blame Xerox. CLI's have historical precedence in their favor on the use of Ctrl-c to abort a program.

Ambiguity between GUI and CLI interface keyboard shortcuts didn't matter for many years, and the ambiguity still doesn't matter to most computer users. The ambiguity really only matters for people who use a CLI emulator in a GUI.

Using a mouse in a CLI is difficult. The CLI environment was designed when there were no pointing devices for computer input. Most people today don't know how to run an appplication without the icon-mouse-point-click interface.

In Linux, I've found it's best, in a larger sense than just GUI or CLI, to always be aware of which environment I'm in when issuing a command. And I've become used to knowing which copy-cut-paste command to use after some practice and frustration. Personally, I enjoy having several different clipboards. Saves me from having to install one of the GUI clipboard apps.

Offline

#14 2009-09-09 12:01:22

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: Linux clipboard HELL

its not about the shortcuts... you can bind them however you want them to be. its about X having several places to store clipboard content. Doesnt matter if you use ctrl+c or space+enter smile it will always use the same clipboard.
BUT: the selection clipboard (select without mouse) will NOT use it. it will use its own thing.

so.. what do we do... historically we had the X clipboard (the mouse thing) - suddenly ALL (and i mean ALL) X-applications used the ctrl+c and ctrl+v clipboard instead of relying on the X selection.

This means one thing. A HUGE majority (around 100% to be precise) implements the ctrl+c/v routine - but what does X do? Nothing. X really should do something about this. In an ideal world both clipboards are synced...

In addition to this we have the second problem of disappearing clipboard contents, when windows are closed.

Last edited by Rasi (2009-09-09 12:06:19)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#15 2009-09-09 12:05:32

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Linux clipboard HELL

Procyon wrote:

BTW, lolilolicon: vimperator has p/P to open the URL in primary selection.

Yay! I missed that. Actually I never bothered to learn much about vimperator... I don't even have it installed since reinstallation.

Who needs vimperator now that you got uzbl? wink


This silver ladybug at line 28...

Offline

#16 2009-09-09 12:25:42

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Linux clipboard HELL

lolilolicon wrote:
Procyon wrote:

BTW, lolilolicon: vimperator has p/P to open the URL in primary selection.

Yay! I missed that. Actually I never bothered to learn much about vimperator... I don't even have it installed since reinstallation.

Who needs vimperator now that you got uzbl? wink

Many sites are not compatible with uzbl such as hotmail and a lot of other AJAX/PHP sites. I issued the f command in uzbl to open the same uri in firefox when I encounter such sites. But yeah, uzbl is a great program.


How's my programming? Call 1-800-DEV-NULL

Offline

#17 2009-09-09 14:07:00

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Linux clipboard HELL

Willie Green's example sounds interesting, I just made a little script to emulate it. It writes selection and clipboard to filenames with date in /tmp/histdaemon/ except if there already is a similar file (using how echo without quotes would interpret it) and the counterpart a dmenu selection with "date : first few lines without \n", (get the vertical patch to make it look better) with the newest first.

#! /bin/bash
[ -z "$1" ] && echo "use with -d (daemon) or -s (select)" && exit
mkdir /tmp/histdaemon 2>/dev/null
cd /tmp/histdaemon

if [ $1 = "-d" ]; then
while sleep 1; do
#toggle between primary/clipboard
if [ -z "$clipboardtoggle" ]; then clipboardtoggle="-b"; else clipboardtoggle=""; fi
new=$(xsel -o $clipboardtoggle)
[ -z "$new" -o "$new" = $'\n' ] && continue
match=0
for file in $(ls -1 | tac); do [ "$(echo $new )" = "$(echo $(cat $file))" ] && match=1 && break; done
[ $match = 0 ] && echo -n "$new" > $(date '+%Y_%m_%d-%H:%M:%S')
done
fi

if [ $1 = "-s" ]; then
paste=$(ls -1 | tac | tail -n +2 | while read filename; do echo $filename : $(head -n 5 $filename); done | dmenu -xs -i -l 15 -rs -ni -p "select paste")
[ -z "$paste" ] && exit
pastef=$(echo "$paste" | cut -d\  -f1)
cat $pastef | xsel -i
fi

edit: for selecting a paste, added tail -n +2 so it doesn't begin with the current selection.

Last edited by Procyon (2009-09-09 15:33:41)

Offline

#18 2009-09-09 14:43:07

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: Linux clipboard HELL

Firefox should automatically open the URL in your clipboard if you middle click somewhere in the window (not on links).

Offline

#19 2009-09-09 15:23:22

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: Linux clipboard HELL

I don't see having two clipboards as a huge problem. If you select some text with your mouse it's in the primary selection and if copy it with your keyboard, it's in the secundary selection.

Vim and Emacs have their own clipboards because they appeared before X existence, but I know that it's possible to use X's clipboard with Emacs instead of the internal one. I bet Vim can do it too.

Why is that a problem?


(lambda ())

Offline

#20 2009-09-09 15:27:36

zowki
Member
From: Trapped in The Matrix
Registered: 2008-11-27
Posts: 582
Website

Re: Linux clipboard HELL

andre.ramaciotti wrote:

I don't see having two clipboards as a huge problem. If you select some text with your mouse it's in the primary selection and if copy it with your keyboard, it's in the secundary selection.

Vim and Emacs have their own clipboards because they appeared before X existence, but I know that it's possible to use X's clipboard with Emacs instead of the internal one. I bet Vim can do it too.

Why is that a problem?

But there have been vim and emacs updates since the development of X. During this period they should have merged clipboards. The problem here is standardization. Everyone is making their own clipboards.

And the problem with primary and secondary selection is that one is not always compatible with the other. Consider urxvt and firefox. Primary clipboard may work in firefox but things are easily accidentally highlighted.

Last edited by zowki (2009-09-09 15:28:19)


How's my programming? Call 1-800-DEV-NULL

Offline

#21 2009-09-09 16:29:04

pointone
Wiki Admin
From: Waterloo, ON
Registered: 2008-02-21
Posts: 379

Re: Linux clipboard HELL

Please try to avoid hyperbole...

I, too, find the two X clipboards/buffers quite helpful. Why would you fight to _remove_ features?

Vim is an entirely separate beast. Vim's support for multiple (infinite?) named buffers is immensely more powerful than any single X buffer could be.

Try using "autocutsel" to sync your X buffers.

I also recall an "xclipboard" app from the XFree86 days that would log/display clipboard entries...


M*cr*s*ft: Who needs quality when you have marketing?

Offline

#22 2009-09-09 16:47:50

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Linux clipboard HELL

Procyon, I guess your script will make Willie Green happy smile

Maybe, just in case, you should also point him to the dmenu-vertical patch/PKGBUILD? I found this one http://evaryont.me/dmenu-vertical-history.patch


This silver ladybug at line 28...

Offline

#23 2009-09-09 17:47:38

ugkbunb
Member
Registered: 2009-02-26
Posts: 227

Re: Linux clipboard HELL

I used to as well have qualms with this feature but I have since come to appreciate it. Like pointone mentioned if you do not like the behavior it is easy to sync the clipboards either by autocutsel or some bash script. This thread was informative... found a few neat tricks that will make my life with two clipboards even more productive.

Offline

#24 2009-09-09 17:52:01

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: Linux clipboard HELL

Small sidenote; "*yy and "+yy to yank a line to the X clipboards in vim.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#25 2009-09-09 22:31:52

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: Linux clipboard HELL

in theory yes... we had at least 2 ppl those last day in #archlinux.de where this did not work... not even marking with mouse worked, altho mouse=a was enabled


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

Board footer

Powered by FluxBB