Files
LLeMbas-TTY/docs/config/lua/window/current_event.md
T
Wez Furlong 4485b2966f mouse bindings: remove WheelUp/Down aliases
They prevented using other types of mouse events!

We don't have a good way to specify that kind of alias, so for now,
take it out and replace the examples in the docs with the more verbose
equivalents.

refs: #2173
refs: #2296
2022-07-31 09:33:42 -07:00

673 B

window:current_event()

Since: nightly builds only

Returns the current event. For now only implemented for mouse events.

This example prints the delta scroll value when you scroll up with your mouse wheel while holding CTRL:

local wezterm = require 'wezterm'

return {
  mouse_bindings = {
    {
      event = { Down = { streak = 1, button = { WheelUp = 1 } } },
      mods = 'CTRL',
      action = wezterm.action_callback(function(window, pane)
        -- note that you want `WheelDown` for a `WheelDown` event
        local delta = window:current_event().Down.button.WheelUp
        wezterm.log_info('delta is: ' .. delta)
      end),
    },
  },
}