Live data from Hacker News

Don't touch my clipboard

alexanderell.is

161–170 of 322 posts

Re: Don't touch my clipboard

#161

Earlier quoted context omitted.

I think the windows clipboard can hold that as metadata. OneNote had a setting that I could enable so that when I pasted from Edge into OneNote the url was appended, but the url wouldn't show up if I pasted into another rich text editor like Word (or OneNote without the setting enabled). Using org mode now, and there's probably a way to do it with emacs lisp, but... I'll never get around to it.

The Windows clipboard has a model where the clipboard contains an abstract 'data object' which exposes a list of supported formats, then you request formats individually. So a given piece of data could expose (not literally this, but the equivalent) text/plain, text/html, image/png, $my_custom_format and then when an application requests a given format it's generated on demand. This mostly gets used for scenarios whe…

This is how X11's modern clipboard APIs (CLIPBOARD, PRIMARY and so on) are defined as well, I assume that Apple's approach is similar.

If I had to guess I'd assume either X11 invented it, or a research lab prototype had it and X11 copied that then was copied by every modern OS

Re: Don't touch my clipboard

#162
post #32

Earlier quoted context omitted.

Actually my terminal emulator (xfce4-terminal) added a preview + confirmation dialog a few months ago for copy-pastes including newlines (i.e. which will execute a command instantly). I thought that it was to avoid accidental mistakes, but it makes even more sense that it is to avoid this.

> copy-pastes including newlines (i.e. which will execute a command instantly) You should enable bracketed paste mode in your shell. IMO it’s much better UX than a confirmation dialog. https://cirw.in/blog/bracketed-paste

Curiously, I never heard of this despite being a Linux user for quite a long time. I'll give it a try.

Re: Don't touch my clipboard

#163

Earlier quoted context omitted.

I really care about security and lament that most people don't, but maybe they've the right idea and I'm just wasting my time. There are simply too many holes to plug :/

How do you want the clipboard to work then? To my mind, the whole point is to provide a way to move information within and between applications.

Here's a stab at defining a function:

The clipboard should act at an only at user direction to copy content from one application or context to another.

The clipboard should not, nor should applications be able to, alter the copied content from the visibly-selected content.

Applications, other than when clearly and unambiguously directed by the user be able to access or read clipboard contents.

I'd suggest additionally that it should be possible to examine and edit within the clipboard context itself what was copied.

This creates a few obvious issues, one of which is that commandline and programmatic tools for interacting with the clipboard ... won't function as transparently as they do now. A fact which would affect me directly as I make heavy use of these (xclip in Linux, pbcopy / pbpaste in MacOS, termux-clipboard-set and termux-clipboard-get in Termux/Android). I think I'd be reasonably comfortable with a confirmation dialog appearing in such cases, or having those applications specifically exempted (convenient, though some risk).

The problem of programmatic interfaces to the clipboard is another matter, and those are ... probably a complex issue.

Note that when working entirely within the shell, the issue largely disappears as the inter-process commmunications method is largely pipelines, files, or the shell environment (variables) themselves. With some exceptions, such as gpm(8) (a cut-and-paste utility and mouse server for virtual consols, in Linux).

Though there's also behaviour of the X11/Xorg or Wayland clipboards.

Re: Don't touch my clipboard

#164

The wrongest thing about this, from my perspective, is that my browser fires off a js 'copy' event when I press control-c. There are times when I've found it helpful that a browser can copy text to my clipboard when I click a button, but I can't think of a single time when I want a site to react to my attempt to copy text off if it. Is there any way to configure my user agent (Firefox) not to do this? A hack is ok.

about:config dom.event.clipboardevents.enabled = false and you're good.

Re: Don't touch my clipboard

#165

The wrongest thing about this, from my perspective, is that my browser fires off a js 'copy' event when I press control-c. There are times when I've found it helpful that a browser can copy text to my clipboard when I click a button, but I can't think of a single time when I want a site to react to my attempt to copy text off if it. Is there any way to configure my user agent (Firefox) not to do this? A hack is ok.

> but I can't think of a single time when I want a site to react to my attempt to copy text off if it.

It's useful for things like rich-text editors (e.g. google docs), where the text is never on screen as text that you are able to copy in the first place.

Re: Don't touch my clipboard

#167
post #51

It's not just a browser thing. Apple Books does this with their e-books, which is infuriating if you're working with a coding book and just want to copy-paste stuff into your editor/terminal. You get something like: “ghci> putStrLn (pretty 10 value)” Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books. When you only copied: ghci> putStrLn (pretty 10 value) Note th…

Is this not a setting you can put off? I would say it is a reasonable function if it can be toggled on/off (I would prefer default off, YMMV).

Re: Don't touch my clipboard

#168
post #51

It's not just a browser thing. Apple Books does this with their e-books, which is infuriating if you're working with a coding book and just want to copy-paste stuff into your editor/terminal. You get something like: “ghci> putStrLn (pretty 10 value)” Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books. When you only copied: ghci> putStrLn (pretty 10 value) Note th…

Wonder if an author will rename themself sudo rm -rf / with the proper escape codes.

When I learned about this command 10 years ago I tried it on a Debian system that I had no use of anymore.

There's a big warning before it lets you execute the command.

Re: Don't touch my clipboard

#169

Earlier quoted context omitted.

Wonder if an author will rename themself sudo rm -rf / with the proper escape codes.

When I learned about this command 10 years ago I tried it on a Debian system that I had no use of anymore. There's a big warning before it lets you execute the command.

That's true only of distributions that alias rm with rm -i.

Now, almost 20 years ago only RedHat did it. And it felt wrong to me :-/

Re: Don't touch my clipboard

#170
post #126

Earlier quoted context omitted.

If you really don't mind it will break some websites, then you really can disable it in Firefox. https://news.ycombinator.com/item?id=22352929

Mind you that this breaks a LOT of things. Even stupid stuff like any textbox on Facebook will be broken.

That sounds like a net positive, allowing you to tell apart proper websites from privacy nightmares :-P
Post reply on HN