Vimium: I've created a branch [here](https://github.com/mrmr1993/vimium/tree/right-click-linkhint) which should do the trick, using the `LinkHints.activateModeToTriggerRightClickAction` command.

Created on 24 Sep 2018  路  3Comments  路  Source: philc/vimium

This seems like quite a low-demand feature, so I wouldn't expect to see it in the released version any time soon.

_Originally posted by @mrmr1993 in https://github.com/philc/vimium/issues/874#issuecomment-63235870_

Most helpful comment

I haven't worked on Vimium in nearly a year, but I'll assume this is directed at me...

If you want to show Chrome's own context menu, I'm pretty sure that's still not possible using any method. However, that branch will trigger a javascript event handler set to intercept click/mousedown/mouseup events for a right mouse click or the contextmenu event.

If this is what you want, based on a quick look at ae829c8cf8d2bc507653451d9ad940dc5e47d96f (the commit in that branch) and current master, you should be able to:

  • apply the changes from background_scripts/commands.coffee directly
  • copy simulateContextMenuEvent that's added to lib/dom_utils.coffee
  • add the button parameter to simulateClick (as in that commit) and also pass it through to simulateMouseEvent, where it should replace the final 0 parameter to mouseEvent.initMouseEvent
  • add a check for button == 0 somewhere in this conditional
  • add the following to content_scripts/link_hints.coffee, near other similar lines:
RIGHT_CLICK = 
  name: "right-click"
  indicator: "Right click"
  linkActivator: (link) ->
    DomUtils.simulateClick(link, {
      altKey: false,
      ctrlKey: false,
      metaKey: false }, 2)
    DomUtils.simulateContextMenuEvent link
  • add RIGHT_CLICK to available_modes in content_scripts/link_hints.coffee
  • add activateModeToTriggerRightClickAction (count) -> @activateMode count, mode: RIGHT_CLICK near other similar lines in content_scripts/link_hints.coffee

I'm not interested in being involved with this, so I probably won't reply any further, but good luck!

All 3 comments

Hi can you explain to me how to implement the above command? I would like to be able to right click on a link in vimium. Thanks!

I haven't worked on Vimium in nearly a year, but I'll assume this is directed at me...

If you want to show Chrome's own context menu, I'm pretty sure that's still not possible using any method. However, that branch will trigger a javascript event handler set to intercept click/mousedown/mouseup events for a right mouse click or the contextmenu event.

If this is what you want, based on a quick look at ae829c8cf8d2bc507653451d9ad940dc5e47d96f (the commit in that branch) and current master, you should be able to:

  • apply the changes from background_scripts/commands.coffee directly
  • copy simulateContextMenuEvent that's added to lib/dom_utils.coffee
  • add the button parameter to simulateClick (as in that commit) and also pass it through to simulateMouseEvent, where it should replace the final 0 parameter to mouseEvent.initMouseEvent
  • add a check for button == 0 somewhere in this conditional
  • add the following to content_scripts/link_hints.coffee, near other similar lines:
RIGHT_CLICK = 
  name: "right-click"
  indicator: "Right click"
  linkActivator: (link) ->
    DomUtils.simulateClick(link, {
      altKey: false,
      ctrlKey: false,
      metaKey: false }, 2)
    DomUtils.simulateContextMenuEvent link
  • add RIGHT_CLICK to available_modes in content_scripts/link_hints.coffee
  • add activateModeToTriggerRightClickAction (count) -> @activateMode count, mode: RIGHT_CLICK near other similar lines in content_scripts/link_hints.coffee

I'm not interested in being involved with this, so I probably won't reply any further, but good luck!

+1 I would love to see this change. I use the web version of tons of apps specifically so I can use vimium to navigate. Sadly, some of them require right clicking to be fully functional (looking at you Spotify).

Was this page helpful?
0 / 5 - 0 ratings