wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.15k stars 709 forks source link

Lua scripting API #225

Open wez opened 4 years ago

wez commented 4 years ago

Today the key assignments are all declarative; while there is a reasonable variety of actions they all need to be statically defined and built into wezterm. I'd like to enable others to script their own actions so that we can keep the core of wezterm reasonably manageable.

At a high level, what I think is needed is:

With this combination it should be possible to write key assignment actions in your config file that can inspect the terminal and perform arbitrary actions.

prabirshrestha commented 4 years ago

This would be one of the killer feature of wezterm. Looking forward to this.

For callbacks would need more apis. wezterm.on, wezterm.off, wezterm.emit. You could create a generic event emitter in lua and then add it for objects. wezterm.tab.on('resize', function (e) print('tab resized') end). You could also listen to a particular tab resize only but this could start complicating the code.

Few things that could also be added is to support redirecting print() to some debug view. For windows you have apis to attach it to a windbg. https://github.com/prabirshrestha/dwm-win32/pull/4

benbooth493 commented 1 year ago

Would love this. Seemless window navigation between neovim and wezterm would be great.

adrian-gierakowski commented 2 months ago

This is the only missing feature which keeps me from switching from kitty (which can be extended with „plugins” written in python)