docs: WslDomain, default_domain, wsl_domains

refs: #1242
This commit is contained in:
Wez Furlong committed 2022-01-09 12:23:14 -07:00
1 parent 58ea5e4f11
commit 8e0a92b2ec
6 files changed
+157

No files matched your search

+1
View File
@@ -255,6 +255,7 @@ TermWindow running in the wezterm process.
""",
),
Page("object: WslDomain", "config/lua/WslDomain.md"),
Gen(
"events: Multiplexer",
"config/lua/mux-events",
+1
View File
@@ -18,6 +18,7 @@ As features stabilize some brief notes about them will accumulate here.
* Support for SGR-Pixels mouse reporting. Thanks to [Autumn Lamonte](https://gitlab.com/klamonte)! [#1457](https://github.com/wez/wezterm/issues/1457)
* [ActivatePaneByIndex](config/lua/keyassignment/ActivatePaneByIndex.md) key assignment action. [#1517](https://github.com/wez/wezterm/issues/1517)
* Windows: wezterm may now use [win32-input-mode](https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md) to send high-fidelity keyboard input to ConPTY. This means that win32 console applications, such as [FAR Manager](https://github.com/FarGroup/FarManager) that use the low level `INPUT_RECORD` API will now receive key-up events as well as events for modifier-only key presses. Use `allow_win32_input_mode=true` to enable this. [#318](https://github.com/wez/wezterm/issues/318) [#1509](https://github.com/wez/wezterm/issues/1509) [#1510](https://github.com/wez/wezterm/issues/1510)
* Windows: [default_domain](config/lua/config/default_domain.md), [wsl_domains](config/lua/config/wsl_domains.md) options and [wezterm.default_wsl_domains()](config/lua/wezterm/default_wsl_domains.md) provide more flexibility for WSL users.
#### Changed
+51
View File
@@ -0,0 +1,51 @@
# WslDomain
*Since: nightly builds only*
The `WslDomain` struct specifies information about an individual `WslDomain`,
which is used to tell wezterm how to interact with one of your locally
installed [WSL](https://docs.microsoft.com/en-us/windows/wsl/about)
distributions.
By mapping a distribution to a multiplexing domain, wezterm is better able to
support creating new tabs and panes with the same working directory as an
existing tab/pane running in that same domain.
By default, wezterm creates a list of `WslDomain` objects based on parsing the
output from `wsl -l -v` and assigns that as the value of the
[wsl_domains](config/wsl_domains.md) configuration option.
A `WslDomain` is a lua object with the following fields:
```lua
{
-- The name of this specific domain. Must be unique amonst all types
-- of domain in the configuration file.
name = "WSL:Ubuntu-18.04",
-- The name of the distribution. This identifies the WSL distribution.
-- It must match a valid distribution from your `wsl -l -v` output in
-- order for the domain to be useful.
distribution = "Ubuntu-18.04",
-- The username to use when spawning commands in the distribution.
-- If omitted, the default user for that distribution will be used.
-- username = "hunter",
-- The current working directory to use when spawning commands, if
-- the SpawnCommand doesn't otherwise specify the directory.
-- default_cwd = "/tmp"
-- The default command to run, if the SpawnCommand doesn't otherwise
-- override it. Note that you may prefer to use `chsh` to set the
-- default shell for your user inside WSL to avoid needing to
-- specify it here
-- default_prog = {"fish"}
}
```
+39
View File
@@ -0,0 +1,39 @@
# `default_domain = "local"`
*Since: nightly builds only*
When starting the GUI (not using the `serial` or `connect` subcommands), by default wezterm will set the built-in `"local"` domain as the default multiplexing domain.
The `"local"` domain represents processes that are spawned directly on the local system.
Windows users, particularly those who use
[WSL](https://docs.microsoft.com/en-us/windows/wsl/about), may wish to override
the default domain to instead use a particular WSL distribution so that wezterm
launches directly into a Linux shell rather than having to manually invoke
`wsl.exe`. Using a [WslDomain](../WslDomain.md) for this has the advantage
that wezterm can then use [shell integration](../../../shell-integration.md) to
track the current directory inside WSL and use it when splitting new panes or
spawning new tabs.
For example, if:
```
; wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 1
```
then wezterm will by default create a `WslDomain` with the name `"WSL:Ubuntu-18.04"`
and if I set my config like this:
```
return {
default_domain = "WSL:Ubuntu-18.04",
}
```
then when wezterm starts up, it will open with a shell running inside that Ubuntu
distribution rather than using the default `cmd` or `powershell`.
While these examples are WSL-centric, `default_domain` will accept the name
of any of the available [multiplexing domains](../../../multiplexing.md).
+11
View File
@@ -0,0 +1,11 @@
# `wsl_domains`
*Since: nightly builds only*
Configures [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) domains.
This option accepts a list of [WslDomain](../WslDomain.md) objects.
The default is a list derived from parsing the output of `wsl -l -v`. See
[wezterm.default_wsl_domains()](../wezterm/default_wsl_domains.md) for more
about that list, and on how to override it.
@@ -0,0 +1,54 @@
# wezterm.default_wsl_domains()
*Since: nightly builds only*
Computes a list of [WslDomain](../WslDomain.md) objects, each one
representing an installed
[WSL](https://docs.microsoft.com/en-us/windows/wsl/about) distribution
on your system.
This list is the same as the default value for the
[wsl_domains](../config/wsl_domains.md) configuration option, which is to make
a `WslDomain` with the `distribution` field set to the name of WSL distro and the
`name` field set to name of the distro but with `"WSL:"` prefixed to it.
For example, if:
```
; wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 1
```
then this function will return:
```lua
{
{ name: "WSL:Ubuntu-18.04",
distribution: "Ubuntu-18.04",
},
}
```
The purpose of this function is to aid in situations where you might want set
`default_prog` for the WSL distributions:
```lua
local wezterm = require 'wezterm'
local wsl_domains = wezterm.default_wsl_domains()
for idx, dom in ipairs(wsl_domains) do
if dom.name == "Ubuntu-18.04" then
dom.default_prog = {"fish"}
end
end
return {
wsl_domains = wsl_domains,
}
```
However, wez strongly recommends that you use `chsh` inside the WSL domain to make
that the default shell if possible, so that you can avoid this additional configuration!