Allow to push link url to queue by <S-LeftMouse> #610.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 15 Apr 2020 21:00:59 +0000 (23:00 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 15 Apr 2020 21:00:59 +0000 (23:00 +0200)
CHANGELOG.md
doc/vimb.1
src/main.c

index 300f29c..de6a8f7 100644 (file)
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 ### Added
 * The new env variable `$VIMB_SELECTION` is set to the current selected text
   whenever a `shellcmd` is run #592.
+* Allow to push link url to queue by `<S-LeftMouse>` #610.
 ### Fixed
 * Fixed ignored last line in config file if this line did not end in newline.
 ### Removed
index 1534d4d..d4e8cd9 100644 (file)
@@ -171,6 +171,13 @@ Reload the website without using caches.
 .TP
 .B CTRL\-C
 Stop loading the current page.
+.TP
+.B CTRL-LeftMouse, MiddleMouse
+Opens the clicket link into new window.
+.TP
+.B Shift-LeftMouse
+Push the link url under the cursor to the end of the Read It Later queue like
+the `:qpush' command.
 .
 .SS Motion
 .TP
index 384ff3c..24f48ae 100644 (file)
@@ -1392,9 +1392,21 @@ static void decide_navigation_action(Client *c, WebKitPolicyDecision *dec)
         webkit_policy_decision_ignore(dec);
         spawn_new_instance(uri);
     } else {
+#ifdef FEATURE_QUEUE
+        /* Push link target to queue on Shift-LeftMouse. */
+        if (webkit_navigation_action_get_navigation_type(a) == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED
+                && button == 1
+                && mod & GDK_SHIFT_MASK
+                && strcmp(uri, "about:blank")) {
+            command_queue(c, &((Arg){.i = COMMAND_QUEUE_PUSH, .s = (char *)uri}));
+            webkit_policy_decision_ignore(dec);
+            return;
+        }
+#endif
 #ifdef FEATURE_AUTOCMD
-        if (strcmp(uri, "about:blank"))
+        if (strcmp(uri, "about:blank")) {
             autocmd_run(c, AU_LOAD_STARTING, uri, NULL);
+        }
 #endif
         webkit_policy_decision_use(dec);
     }