Live data from Hacker News

Don't touch my clipboard

alexanderell.is

311–320 of 322 posts

Re: Don't touch my clipboard

#311
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…

Don’t despair, there are workarounds for this. See the many answers to https://apple.stackexchange.com/q/137047/21473 ‘Don't want iBooks to always paste the “Excerpt From” of what I have copied’.

I recommend the solution in https://apple.stackexchange.com/a/382603/21473 (which is an improved variant of stassats’s solution in https://news.ycombinator.com/item?id=22355322). The method is to use Automator to set up a Quick Action that copies the text while bypassing the clipboard-modifying behavior of Books. Then you configure a keyboard shortcut of ⌘C for the Quick Action, only in the Books app, so you don’t have to change the way you copy.

Re: Don't touch my clipboard

#312
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…

I solved the Apple Books problem with an automator script, using the "Copy to Clipboard" action. Then it can be assigned a shortcut in Keyboard preferences. https://imgur.com/a/sG2isap

Thanks for the method. I’ve written up detailed instructions for it at https://apple.stackexchange.com/a/382603/21473.

As you can see in that answer, I found a better method to assign the keyboard shortcut. Assigning the shortcut within App Shortcuts instead of Services lets you use the normal ⌘C shortcut in Books while not affecting copying in other apps.

Re: Don't touch my clipboard

#313
post #148

Earlier quoted context omitted.

Because the next step when you face this problem is doing a search-replace of the quotes to remove them. ASCII quotes are on your keyboard, so you can actually type the command to remove them. Unicode quotes probably aren't, so it's extra annoying to remove them, and they're not even the same character for start and end so you have to do it twice. The time spent for removal is then vastly higher than with ASCII quote…

isn't that an input problem not an output problem? Is it giving you the quotes directly from the ebook or is it converting them on copy-paste? I'd assume there was a bug on the input side, that some tool wrongly converted `printf("Hello World")` to `printf(“Hello World”)` so what's in the ebook is wrong already. If so the issue is further up the chain.

In this context, the selection within the ebook contains no quotes, whether ASCII or Unicode. The problem is that Apple’s Books app adds quotes and attribution text around the selected text. Books knows that the text it is putting in the clipboard isn’t what you selected, and it doesn’t care.

Re: Don't touch my clipboard

#314
post #18

I agree and share the frustration. A stock Apple application "Books" does something similar as well. When copying text -- using keyboard shortcut or the context menu rendered as soon as you lift your mouse (another tragedy) -- your clipboard will look something like the following (2 lines): “ ” Excerpt From: . “ .” Apple Books. That gets written to your clipboard; quotes and everything.

In case you haven’t seen the discussion in the sibling comment tree https://news.ycombinator.com/item?id=22353121, there are solutions to this behavior of Books. Particularly, see my answer https://apple.stackexchange.com/a/382603/21473 to the question ‘Don't want iBooks to always paste the “Excerpt From” of what I have copied’.

Re: Don't touch my clipboard

#315
post #216

What's with ultra-grey font colors? It's not 2010 anymore, give your text some contrast ffs, you are killing my eyes

Sorry about that. I had been using some default styles that came with the Hugo theme I'm using, but I absolutely see what you mean. Updated text throughout the site to have better contrast. Hope that helps!

Thanks!

Re: Don't touch my clipboard

#316

Earlier quoted context omitted.

Modern versions of rm require you to pass --no-preserve-root. According to Wikipedia [1] this has been the default (in upstream) since 2006. Of course it took distros some time to actually update to the GNU utils 6.4 (especially long-term support systems like CentOS) but it's been a decade since the change should've been implemented everywhere. [1]: https://en.wikipedia.org/wiki/Rm_%28Unix%29#Protection_of_th...

Isn't that only a GNU and FreeBSD thing? I think other Unixes will still let you rm -rf /. On FreeBSD you can do sudo dd if=/dev/random of=/dev/mem and it will do exactly that, write random crap into your memory without any sort of safeguard, causing a spectacular crash and a console that looks like it's having a seizure. Linux won't let you do that unless it's been compiled with a flag to enable full access to /dev/…

I want to try that dd command. For fun. Just to see what happens on OpenBSD.

No lasting effects are there? Besides a crash, afterwards I shouldn't have any memory issues, right?

Re: Don't touch my clipboard

#317

Earlier quoted context omitted.

Isn't that only a GNU and FreeBSD thing? I think other Unixes will still let you rm -rf /. On FreeBSD you can do sudo dd if=/dev/random of=/dev/mem and it will do exactly that, write random crap into your memory without any sort of safeguard, causing a spectacular crash and a console that looks like it's having a seizure. Linux won't let you do that unless it's been compiled with a flag to enable full access to /dev/…

I want to try that dd command. For fun. Just to see what happens on OpenBSD. No lasting effects are there? Besides a crash, afterwards I shouldn't have any memory issues, right?

I tried this in a FreeBSD VM and it booted fine afterwards. OpenBSD wouldn't let me do it at all for some reason.

Obviously no warranty on bare metal/systems that are actually used for anything.

Re: Don't touch my clipboard

#318

Earlier quoted context omitted.

How do people know the result of running this command without running a VM? Is it possible to run OS X in a VM these days? The command's intention is so obvious I wonder why there is no warning from the os, the shell program or the terminal for such, easily blacklist-able commands. Or is there?

I've learned that personally one night fighting messed up rebase conflicts and for still unknown reason I copied and pasted a path for `rm` and ended up issuing `rm -rf ~ /repo-path /unneeeded-dir` - it took me a couple of seconds to realize that this command takes unexpected long time to execute and then my eye caught a view of Finder window with shrinking list of folders in home directory :) Time Machine helped me…

> Time Machine helped me quite a lot but unfortunately with a nasty surprise that it doesn't backup dot files.

Wow, that's good to know!

Re: Don't touch my clipboard

#319

Earlier quoted context omitted.

I solved the Apple Books problem with an automator script, using the "Copy to Clipboard" action. Then it can be assigned a shortcut in Keyboard preferences. https://imgur.com/a/sG2isap

Thanks for the method. I’ve written up detailed instructions for it at https://apple.stackexchange.com/a/382603/21473 . As you can see in that answer, I found a better method to assign the keyboard shortcut. Assigning the shortcut within App Shortcuts instead of Services lets you use the normal ⌘C shortcut in Books while not affecting copying in other apps.

Limiting the action to "Books" seems to not affect other apps as well. The main reason I did not use ⌘C is because it doesn't work when the context menu is displayed (and it gets displayed immediately after selecting text).

Re: Don't touch my clipboard

#320
post #75

Earlier quoted context omitted.

You're getting far enough into JS knowledge that I don't have. Do you actually need clipboard events, or just dom.event.contextmenu.enabled for that?

Put another way, on a website like draw.io, you need to be able to hook into copy to allow lassoing and copying a set of shapes (and have them remain editable when pasted). The entire ask (stopping the copyright, and allow clipboard integration) be achieved by allowing pages to augment the clipboard data, which can already be done, but not replace it. Pages would still need to be able to hook paste.

Being able to hook paste is a much more reasonable ask. If you have js enabled, they're going to be able to access the content after paste anyway, so it's reasonable to allow notification that a paste has occurred.
Post reply on HN