librelist archives

« back to archive

Ctrl + MouseClick

Ctrl + MouseClick

From:
Date:
2014-10-01 @ 13:13
Hi All,

Is there a way to have conkeror open a tab in the background if I click a
link while holding ctrl?

Thanks and Best Regards,
Artur Malabarba

Re: [conkeror] Ctrl + MouseClick

From:
Joren Van Onder
Date:
2014-10-01 @ 19:44
There might be an easier way to do this but looking in
clicks-in-new-buffer.js might be a good place to start. I haven't tested
it but it looks like modifying open_link_in_new_buffer() wouldn't be too
hard. The click event has a ctrlKey property [1] which you can use. If
you set the clicks_in_new_buffer_button to 0 (which is left mouse click)
you could do something like this:

diff --git a/modules/clicks-in-new-buffer.js b/modules/clicks-in-new-buffer.js
index 40b5f99..6f6c0bd 100644
--- a/modules/clicks-in-new-buffer.js
+++ b/modules/clicks-in-new-buffer.js
@@ -32,7 +32,7 @@ function find_tag_in_parents (tag, element) {
 }

 function open_link_in_new_buffer (event) {
-    if (event.button != clicks_in_new_buffer_button)
+    if (event.button != clicks_in_new_buffer_button || ! event.ctrlKey)
         return;
     let element = event.target;
     let anchor = null;


Footnotes:
[1] https://developer.mozilla.org/en-US/docs/Web/Events/click
--
        Joren

Re: [conkeror] Ctrl + MouseClick

From:
Artur Malabarba
Date:
2014-10-22 @ 15:29
Thanks for the pointer Joren!
I had to use a && instead of ||, but it works!

2014-10-01 20:44 GMT+01:00 Joren Van Onder <joren.vanonder@gmail.com>:
> There might be an easier way to do this but looking in
> clicks-in-new-buffer.js might be a good place to start. I haven't tested
> it but it looks like modifying open_link_in_new_buffer() wouldn't be too
> hard. The click event has a ctrlKey property [1] which you can use. If
> you set the clicks_in_new_buffer_button to 0 (which is left mouse click)
> you could do something like this:
>
> diff --git a/modules/clicks-in-new-buffer.js b/modules/clicks-in-new-buffer.js
> index 40b5f99..6f6c0bd 100644
> --- a/modules/clicks-in-new-buffer.js
> +++ b/modules/clicks-in-new-buffer.js
> @@ -32,7 +32,7 @@ function find_tag_in_parents (tag, element) {
>  }
>
>  function open_link_in_new_buffer (event) {
> -    if (event.button != clicks_in_new_buffer_button)
> +    if (event.button != clicks_in_new_buffer_button || ! event.ctrlKey)
>          return;
>      let element = event.target;
>      let anchor = null;
>
>
> Footnotes:
> [1] https://developer.mozilla.org/en-US/docs/Web/Events/click
> --
>         Joren