2

I am using openbox as my window manager. When I copy and paste using Ctrl+c and Ctrl+v from one application into another, it transfers the text formatting together with the text.

I have to use plaintext editor in between, so that the formatting is lost.

This is pure evil. I assume this was invented by the same people who gave us CapsLock and NumLock, just to drive people crazy and waste millions of man-hours yearly.

Anyway, how can I disable this in openbox?

I am aware of this post, but I am not sure how to integrate the suggested solution in my situation.

I don't use any external clipboard program, I don't have xclip or xsel installed. I assume the copy/paste functionality is native to openbox?

UPDATE:

as I explained in the comments, this happens for example when copying from chromium and pasting into firefox. Using Ctrl+Shift+v does seem to work, and pastes text without formatting. However, it is another extra step i need to remember. I have Ctrl+v ingrained in my muscle memory. is it possible to re-define the key shortcut, so that Ctrl+v acts as if i used Ctrl+Shift+v ?

9
  • 2
    Does ctrl+shift+v for pasting work?
    – terdon
    Commented Apr 9, 2023 at 11:48
  • @terdon - no, ctrl+shift+v does nothing Commented Apr 9, 2023 at 12:44
  • 1
    Copying and pasting doesn’t depend on the window manager, it depends on the program you’re copying from and the program you’re pasting to. Could you clarify which programs you’re having trouble with? Commented Apr 9, 2023 at 13:31
  • 2
    I personally almost never use ctrl+c/v as I find them cumbersome and always default to selecting text and then middle clicking to paste like a good, old school *nix geek. Does that not work for you? Since nobody has answered, it might make sense to edit this and change it to ask how to make the ctrl+v behave like ctrl+shift+v but since it is apparently handled by individual programs, I don't know if anyone will be able to help.
    – terdon
    Commented Apr 9, 2023 at 15:03
  • 1
    You probably do have some sort of clipboard program. Could be xclip, glipper, gpaste, clipit, or something else — Openbox doesn't seem to have that built in. You could find out by just trying to run some of those commands. You could use keybinds to remap with a <command> action
    – Zac Anger
    Commented Apr 13, 2023 at 23:52

2 Answers 2

3
+250

Partial answer: Selections in X don't work like in Windows. The X protocol allows two clients to communicate and transfer the selection, and these two clients also negotiate the format between them. There is no "system-wide clipboard".

So it's not something that is "built into openbox".

(In addition, usage of ctrl-c and ctrl-v is also application dependent, not all applications offer those keys. The X standard is to use the middle mouse button for paste.)

So the only way to get rid of this functionality is to introduce a third client (similar to xclipboard, note that this is very different from xclip) which implements some kind of system-wide clipboard, takes over the selection and only copies the text format.

However, I do not know of any ready-made application that has this functionality.

Depending on your level of pain, and your C expertise, you could look at the source code of xclipboard and modify it so it only copies the text format.

3
  • 1
    You could always do it with something like while true; do xclip -sel c -o | xclip -sel c -quiet; done Commented Apr 17, 2023 at 14:18
  • @StéphaneChazelas That might actually work, and you could also throw in -t to pick a specific format.
    – dirkt
    Commented Apr 17, 2023 at 14:22
  • 1
    Used in Save HTML from clipboard as markdown text for instance. Commented Apr 17, 2023 at 14:28
1

Openbox does not offer this functionality. I have to agree with @dirkt that this can be only done by third party client.

I know you won't probably like it as you are using lightweight openbox, but a clipboard manager that offers this functionality is CopyQ (yes, you have to have installed QT libraries that CopyQ needs).

In order to paste as plain text in CopyQ you need to add a command. This is from the FAQ where I originally found it (and used it):

How to paste as plain text?

To paste clipboard as plain text:

  • Open “Command” dialog (F6 shortcut).
  • Click “Add” button in the dialog.
  • Select “Paste clipboard as plain text” from the list and click “OK” button.
  • Click the button next to “Global Shortcut” label and set the shortcut.
  • Click “OK” button to save the changes.

To paste selected items as plain text (from CopyQ window) follow the steps above but add Paste as Plain Text command instead and change Shortcut.

Here are the CopyQ's FAQ.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .