Closed Bug 1418462 Opened 7 years ago Closed 2 years ago

Middle clicking on new tab should search or open what's in the selection clipboard on linux

Categories

(Firefox :: Tabbed Browser, defect, P3)

Unspecified
Linux
defect

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
relnote-firefox --- 115+
firefox115 --- fixed

People

(Reporter: blacklemon67, Assigned: brice.laurencin)

References

Details

(Keywords: parity-chrome)

Attachments

(4 files, 3 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0 Build ID: 20171116164137 Steps to reproduce: Middle clicked the new tab button on linux Actual results: Opens new tab next to current tab. Expected results: Middle click on new tab should search or open the contents of the xclipboard (selection clipboard). This is the behavior on chrome, and is similar to the behavior of middlemouse.contentLoadURL but doesn't apply to the whole page. The idea is middle click on linux is analogous to ctrl+v, and pasting onto new tab should open what's in the clipboard.
Component: Untriaged → Tabbed Browser
OS: Unspecified → Linux
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [parity-Chrome]
Flags: needinfo?(dao+bmo)
Mass bug change to replace various 'parity' whiteboard flags with the new canonical keywords. (See bug 1443764 comment 13.)
Keywords: parity-chrome
Whiteboard: [parity-Chrome]
See Also: → 1567176

+1
This would be such a nice feature to have. This issue is one of the reasons I've been using Chrome for the past two years.
I'm currently trying out Firefox again and I'm sad that this feature is still not available.

The attached patch seems like it would apply cleanly (still). Is there any specific reason it hasn't been integrated?

I tried to apply the patch to the latest Firefox less than a month ago, but it seems like its outdated and the surrounding code has changed. One of the big things is that they removed the ability for some UI components, including the new tab button, to react to the middle mouse button.

I've personally updated the patch to work around some of it, and it seems to work. I'll post my updates as an attachment in case someone wants to clean it up.

Attached patch Updated Patch (obsolete) — Splinter Review
Attachment #9207191 - Attachment is obsolete: true

The last patch is working for me nicely in Gentoo's (stable) Firefox 78.8. Thank you so much!!

Hello there,
I tried to be smart an apply the patch to the current codebase, but sadely enough, I fail to build firefox locally, I get a HTTP 401 during bootstrap…
I will try yo work around it; meanwhile, here is the patch ported to the said current codebase.

And same question Martin had: is there a specific reason not to merge this?

Attached patch updated patch 20210817 (obsolete) — Splinter Review

(In reply to Brice Laurencin from comment #11)

And same question Martin had: is there a specific reason not to merge this?

Since there hasn't been any feedback, I guess someone just has to submit it to https://phabricator.services.mozilla.com/differential/

I was eventually able to compile Firefox with the fix, it works exactly as advertised, I love it. That was the one feature I was missing from that other browser.
I might try to push to phabricator, we'll see what happens

Severity: normal → S3

Unfortunately patch 20210817 doesn't work for me anymore with Firefox version 109.
It still works for me with 102.7.0. So I'll stick with that version for a while.

Here is an update working with the current codebase.

Enjoy.

Attachment #9236581 - Attachment is obsolete: true

Original code from bruntonross@protonmail.com,
adapted to current Firefox version.

Assignee: nobody → brice.laurencin
Status: NEW → ASSIGNED

I just successfully patched Firefox 109.
Thank you very much Brice!

Hey all. I found a solution to this that relies on an extension using nativemessaging to get the xclipboard content. I wrote a guide here: suricrasia.online/firefox/

Hey Brice, just checking in if you're still interested in continuing to work on this patch - no worries if you're just busy and haven't had a chance to come back to this, but let me know if there's anything I can do to help.

Flags: needinfo?(brice.laurencin)

I will try to have a look at it this weekend, it's been a bit harder to find time.

Flags: needinfo?(brice.laurencin)

A quick message to state that I'm still working on this, just completely lacked time to commit on it in the past few weeks.

my local repo was a mess, and my skills in mercurial close to none, so I bootstrapped a git workspace.
I reapplied the change from phab, but now it does not works so I'm back to square… 2?

I'll try to have something working again and will apply the comments from you Gijs.

Sorry again for the time this is taking.

Original code from bruntonross@protonmail.com,
adapted to current Firefox version.

Attachment #9331853 - Attachment is obsolete: true
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/50c9a0bea4c6 Middleclick on new tab button launch clipboard r=Gijs

Backed out for causing mochitests failures in browser_middleClick.js.

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | browser/components/urlbar/tests/browser/browser_middleClick.js | URLBar has no pasted value - "testsample" == "" - {"filename":"chrome://mochitests/content/browser/browser/components/urlbar/tests/browser/browser_middleClick.js","name":"testMiddleClickToOpenNewTab","sourceId":1930,"lineNumber":160,"columnNumber":10,"sourceLine":"","asyncCause":null,"asyncCaller":{"filename":"chrome://mochitests/content/browser/browser/comp
Flags: needinfo?(brice.laurencin)

Looks like bug 1710289 was filed when this was accidentally implemented (though perhaps there was no navigation?), and people on Linux were upset about this... so when the regression was fixed, a test was added to not bring the behaviour back. That test now started failing on Linux because the default there is for the new behaviour in this patch.

We can update that test to change the pref to false for that test, which seems the simplest solution. But it probably means that we'll need to monitor feedback about what the default for the new pref needs to be, even on Linux, as it'll probably take some people by surprise.

Flags: needinfo?(dao+bmo)
Flags: needinfo?(brice.laurencin)
See Also: → 1710289
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/6fe794e297f1 Middleclick on new tab button launch clipboard r=Gijs

Firstly, thanks for taking over this and updating it.

Secondly, I'm looking at the ticket for 1710289, and it seems like the fix is fixing two things:

  • Middle clicking on the URL bar opens a new tab with the paste buffer contents.
  • Middle clicking on the new tab button opens a new tab with the paste buffer contents.

However the ticket and discussions only really seem to focus on the new tab bar itself, and not the new tab button. While I agree that middle clicking the bar itself shouldn't use the contents of the selection buffer, I think it makes sense for the new tab button itself. This is consistent with how Chrom(ium) handles it and left clicking the new tab will do the "safe" thing of not opening primary selection contents.

I think it makes sense for this to be enabled on Linux by default, and regardless have a setting to enable/disable it.

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch

Release Note Request (optional, but appreciated)
[Why is this notable]: Changes long-standing behaviour of the new tab button on Linux
[Affects Firefox for Android]: No
[Suggested wording]: On Linux, middle clicks on the new tab button will now open the xclipboard contents in the new tab. If the xclipboard content is a URL, that URL is opened, and any other text is opened with your default search provider. This feature can be turned off using browser.tabs.searchclipboardfor.middleclick in about:config .
[Links (documentation, blog post, etc)]: N/A

relnote-firefox: --- → ?

Thanks, added a slightly reworded note to the Nightly release notes. Keeping the relnote? flag open to keep it on the radar for inclusion in our final release notes.
We generally avoid mentioning about:config options in the releases notes. We will keep that last sentance in the nightly/beta release notes, but remove it from the final release notes.

Depends on: 1833585
No longer depends on: 1833585
Regressions: 1833585

do you want me to have a look at this empty string issue?

seems rather straight forward, and I feel bad for not adding a check on this in the first version

(In reply to Brice Laurencin from comment #32)

do you want me to have a look at this empty string issue?

seems rather straight forward, and I feel bad for not adding a check on this in the first version

Thanks for the offer, but I already have a patch, just fighting an issue with the test at the moment. :-)

<3

Regressions: 1841763
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: