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_
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:
background_scripts/commands.coffee
directlysimulateContextMenuEvent
that's added to lib/dom_utils.coffee
simulateClick
(as in that commit) and also pass it through to simulateMouseEvent
, where it should replace the final 0
parameter to mouseEvent.initMouseEvent
button == 0
somewhere in this conditionalcontent_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
RIGHT_CLICK
to available_modes
in content_scripts/link_hints.coffee
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).
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 thecontextmenu
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:
background_scripts/commands.coffee
directlysimulateContextMenuEvent
that's added tolib/dom_utils.coffee
simulateClick
(as in that commit) and also pass it through tosimulateMouseEvent
, where it should replace the final0
parameter tomouseEvent.initMouseEvent
button == 0
somewhere in this conditionalcontent_scripts/link_hints.coffee
, near other similar lines:RIGHT_CLICK
toavailable_modes
incontent_scripts/link_hints.coffee
activateModeToTriggerRightClickAction (count) -> @activateMode count, mode: RIGHT_CLICK
near other similar lines incontent_scripts/link_hints.coffee
I'm not interested in being involved with this, so I probably won't reply any further, but good luck!