2022-07-29 20:30:54 +03:00
|
|
|
# `window:current_event()`
|
|
|
|
|
2022-08-07 23:26:59 +03:00
|
|
|
*Since: 20220807-113146-c2fee766*
|
2022-07-29 20:30:54 +03:00
|
|
|
|
|
|
|
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`:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
local wezterm = require 'wezterm'
|
|
|
|
|
|
|
|
return {
|
|
|
|
mouse_bindings = {
|
|
|
|
{
|
2022-07-31 19:33:42 +03:00
|
|
|
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
|
2022-07-29 20:30:54 +03:00
|
|
|
mods = 'CTRL',
|
|
|
|
action = wezterm.action_callback(function(window, pane)
|
2022-07-31 19:33:42 +03:00
|
|
|
-- note that you want `WheelDown` for a `WheelDown` event
|
|
|
|
local delta = window:current_event().Down.button.WheelUp
|
2022-07-29 20:30:54 +03:00
|
|
|
wezterm.log_info('delta is: ' .. delta)
|
|
|
|
end),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|