Linux middle-click paste is problematic and needs to be automatically disabled

Thanks for the reply!

Considering that the default in most Linux desktops is to have middle click paste enabled, you don’t have to “use” that feature to hit this bug. You could just be middle clicking in Obsidian to open a new tab or whatever and you’ll end up with random pastes of stuff that you may have highlighted previously.

Also, this is literally the ONLY app I’ve ever used that had this kind of problem. I’ve been a desktop Linux user for about 20 years now and this is the first time I’ve ever run into this. I’m not some purist that only runs OSS either. I have plenty of proprietary software installed on my computer.

That’s fine if it “works for you” and everything but I put a lot of time into my knowledge base and use it daily so I need something that is maintained well. i.e. if they are going to say they support Linux, then they actually should. Middle click paste is nothing new and literally everything else supports it fine, including other proprietary software (Google, Microsoft, Adobe, Valve, etc).

I already know based on how this thread has gone that this won’t get fixed, and that’s fine. I do wish that it would get fixed. But unfortunately, I will have to move on to other software that actually does support my system. :slight_smile:

4 Likes

We have looked into this. There are two issues

  1. You don’t notice this problems in other apps because other apps don’t do anything with the middle click or if the do don’t have the ambiguity of editing or opening a link.
  2. The way this middle click paste is triggered in Linux is different from the more common middle click trigger (shared among OSes). This makes overriding this action and writing cross-platform code harder.

Moved to bug reports. No ETAs on fixing this.

Thanks for the reply!

On point 1, that’s definitely not true. I can actually think of several examples off the top of my head and all are file editors or note-taking apps and none have this problem. Here are 2 good examples:

VSCode
Libreoffice

Middle click paste works fine and also middle clicking on links works fine in those apps too. Again, this is the ONLY app I’ve ever seen this behavior in.

Just to be clear, because I’m not sure if you understand what the problem is. The problem is that when you middle click somewhere in Obsidian, it pastes at random places in the document. It took me a minute to notice it because the paste happens no where even close to where the middle click happens. It’s kind of crazy!

On point 2, I can’t really speak to that. My coding ability is limited to server-side and command line stuff. I don’t write GUI apps so I can’t say how middle click is different from other OSs. But I can say that I’ve never seen this kind of behavoir in any other app. And it’s not because none of the other apps I use aren’t similar to Obsidian (I am looking for a replacement for my old knowledge base software after all).

If you can fix this before I make a decision on different software then I may reconsider and use Obsidian. Thanks for at least looking into this. :slight_smile:

3 Likes

kde bug where it’s been discussed they can’t/won’t create an option to disable middle click paste for X11: 441668 – Please make middle-click pasting optional

it’s weird how middle click paste was forced on all X11 users. I use the xsel -fin </dev/null workaround to disable middle click paste, e.g. just to avoid pasting sensitive info in apps where I use middle click a lot (e.g. opening tabs in chrome, or closing tabs with middle click then accidentally clicking the addressbar and poof pasted a whole load of stuff that google is now trying to search with…), but as shared above, strange the workaround does not work for obsidian when it does for other apps.

I used linux as a daily driver for years, never used middle click)

I’m curious, you don’t use middle click to open new tabs in your web browser? Or referring to middle click paste? For the latter I also would never want to use middle click paste.

1 Like

Since you asked, no. I try to drive with the keyboard, but also, I haven’t a mouse device with middle click since the 90s. ctrl-t for new tab.

1 Like

I think zerkshop was not referring to opening blank new tabs, but rather opening links on a page into a new tab by middle-clicking it. I personally use Ctrl+T for opening blank tabs, but middle click for links.

For me, this bug is most apparent in Obsidian when opening note links to new tabs either from the note itself or from the file list when another note is open.

I don’t think this is true. At least in Chrome I can be editing a text field and then middle-click a link at the same time. The link will open in a new tab, and nothing gets pasted in the active text field.

7 Likes

I second, @ecchina_ko s suggestion, that this ambiguity exists in browsers as well, and @proc1io s suggestion that similar issues don’t crop up in comparable situations in e.g. VSCodium (installed and verified it myself).

Where this issue conflicts most severely with my workflow, is when using middle clicks for closing open tabs. I could use Ctrl-W to close the one in focus, but over time a lot of “sludge” tabs build up, and I usually want to close a lot (but not all) of the ones that are NOT in focus. Middle-clicking them is the most intuitive way to do that for me, but that pastes into the focused note.

Also on general principles I can understand the scorn of vimmers and other special folk for any and all kind of mouse interaction with control interfaces, but OTOH I think if this can be fixed, and there are no more urgent or important problems, then it should be, because saying “hey, you could just change your workflow” is not really a suitable answer when you could just fix the bug. Just my 5ct.

I did a little bit of digging, and stumbled over a somewhat similar issue in VSCode, in which one of the contributors explains how they suppress middle click paste on notifications.

Out of context code snippet for (in)convenience:

 this.inputDisposables.add(addDisposableListener(this.template.container, EventType.AUXCLICK, e => { 
 	if (!notification.hasProgress && e.button === 1 /* Middle Button */) { 
 		EventHelper.stop(e, true); 
  
 		notification.close(); 
 	} 
 })); 

I think the AUXCLICK Event fires on every non-primary mouse-button click, and that’s where the secret sauce is made.
But since I don’t know all that much about java-/typescript in general, electron specifically, and the code bases of vscode and obsidian super specifically, I can’t say, whether this might help with designing a solution that fits obsidian, or if it is completely worthless, but here you go anyway.

BTW This Issue only popped up for me with the jump to 1.0.0 I think, because I didn’t have any tabs to close before :wink: I’m going to keep using obsidian despite this, because it’s an awesome note-taking software, but this is a very annoying issue nevertheless.

I hope this helps, and thanks for the cool software!

PS:

Some anecdotal evidence, that Wayland also doesn’t solve the ‘problem’ (I actually like middle click paste a lot and use it daily) for some popular desktop environments.

7 Likes

I’m experiencing this bug as well. Hope it get’s fixed soon, as it super annoying to find your notes messed up with random, unintentional pastes all the time.

Also, I’ve never experienced these types of issues with VSCode, LibreOffice or any other application for that matter.

Environment: Linux Mint 20.3
Obsidian: v1.0.0

5 Likes

Steps to reproduce

  • Open two tabs (A and B)
  • Copy some content in the clipboard
  • Close tab B

Expected result

The content of tab A is not altered.

Actual result

The content of the clipboard is pasted in tab A

Environment

  • Operating system: Linux 5.15.0-52-generic #58-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v1.0.0
    Installer version: v1.0.0
    Operating system: #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 5.15.0-52-generic
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: light
    Community theme: none
    Snippets enabled: 0
    Restricted mode: on
5 Likes

Note that the response to the issue I reported is definitely not to disable middle click pasting, since it’s a perfectly fine feature of all Linux distributions (I know I would get annoyed if middle-click pasting would stop working in Obsidian all together).
Preventing a random paste in the page content when closing an unrelated tab is a much better solution imo.

8 Likes

head over here and like

3 Likes

I am a Linux and Obsidian user. Middle clicking to paste the clipboard is a feature that I use frequently and disabling it is not a feasible option for me.

I think the comparison to chrome/firefox/vscode/any-text-editor-with-tabs is apt - none of them paste the clipboard when middle clicking to close a tab.
I understand that Obsidian uses middle click to open links in a new tab. I would be perfectly happy to disable middle click functionality for that and open new tabs with ctrl+right_click. I don’t know if there are any other interactions with middle click in obsidian.

My ideal solution to this issue would be one where

  • I can use middle click to paste text into a document
  • I can use middle click to close tabs and no text gets inadvertently pasted into an open document
  • I can use ctrl+click to open links in new tabs instead of using middle click.
7 Likes

The middle-click/clipboard paste will be reworked in 1.0.4.

13 Likes

Love to hear this! Thanks for putting in the work <3

2 Likes

@WhiteNoise :heart: :heart:

3 Likes

:fire::fire::fire::fire::fire:

2 Likes

I would absolutely hate this. Opening notes in a new tab using middle-click is strictly essential for a lot of people.

3 Likes

should be fixed in v1.1

2 Likes

Middle-click is used to navigate in the new canvas feature, but collides with text paste.
This results in a bunch of clipboard text in your canvas when navigating.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.