This commit teaches the config about SerialDomains, and the mux layer about constructing a SerialDomain, then changes the GUI layer to use those pieces to set up `wezterm serial`. A new `serial_ports` config is added, and the GUI layer knows how to apply it to the set of domains in the mux. The result of this is that you can now define a domain for each serial port and spawn a serial connection into a new tab or window in your running wezterm gui instance.
1.6 KiB
1.6 KiB
serial_ports = {}
{{since('nightly')}}
Define a list of serial port(s) that you use regularly.
Each entry defines a SerialDomain with the following fields:
name- the name to use for the serial domain. Must be unique across all multiplexer domains in your configuration.port- the name of the serial device. On Windows systems this can be a name likeCOM0. On Posix systems this will be a device path something like/dev/ttyUSB0. If omitted, thenamefield be be interpreted as the port name.baud- the communication speed to assign to the port. If omitted, the default baud rate will be 9600.
This configuration defines a single port:
config.serial_ports = {
{
name = '/dev/tty.usbserial-10',
baud = 115200,
},
}
You can then use the port in one of the following ways:
wezterm connect /dev/tty.usbserial-10- this behaves similarly towezterm serial /dev/tty.usbserial-10 --baud 115200.- Start wezterm normally, then use the Command Palette or Launcher Menu to
spawn a new tab in the
/dev/tty.usbserial-10domain to connect to the serial device - You can reference the serial domain by its name
/dev/tty.usbserial-10in the various tab/window spawning key assignments that include a SpawnCommand
You can define multiple ports if you require, and use friendly name for them:
config.serial_ports = {
{
name = 'Sensor 1',
port = '/dev/tty.usbserial-10',
baud = 115200,
},
{
name = 'Sensor 2',
port = '/dev/tty.usbserial-11',
baud = 115200,
},
}