This used to be effectively the same thing, but now that the launcher
menu allows attaching to other domains, it is best if the hotkey
matches the behavior of the + button on the tab bar and uses the
domain of the current tab instead.
* Increase timeout from 2 to 10 seconds, giving you more time to read it
* Make the timeout work even if the UI object is unexpectedly destroyed
* When attaching via the launcher, don't reconnect when the server
version mismatches the client version.
This adjusts the mux protocol so that we can tell when a remote tab
has been closed; previously we couldn't distinguish between an IO
error and the tab going away.
Similarly, if the remote mux has shut down (which we detect via an EOF),
then we won't try to reconnect and will proceed to detach that domain.
Hadn't noticed this until just now because the systems I've been
using have all had a pretty similar filesystem layout.
This commit avoids a failure to spawn a child process when the
desired directory doesn't exist locally.
This is accessible by right-clicking on the `+` button in the tab bar
and switches to an overlay offering options to spawn tabs and attach
domains.
The intent is to allow the configuration file to expand this list of
options, and on Windows, to auto-populate with the various combinations
of `cmd`, `powershell`, `elevated` and available `wsl` instances, but
for the moment the main value of this feature is the ability to attach
domains that were not set to connect automatically at startup.
This makes things more convenient when launching wezterm via the
gui: it is awkward to have to set up shortcuts that run
`wezterm connect foo`, or to type in the full path to `wezterm` when
you might want to run that manually.
Now you can double-click the icon and right-click the `+` and attach
the domain. (cc: @rjwalsh)
The launcher is a good candidate for being implemented on top of
native context menus where available... but we don't have any
such API plumbed through the `window` crate, so all platforms
get the wonderful terminal based overlay menu right now.
refs: https://github.com/wez/wezterm/issues/159
This commit tackles a couple of things in related areas:
Makes it possible to reference the KeyAssignment type directly from the
KeyAction action type. Previously, due to limitations in how TOML is
serialized, the enum values could be used here; while the compiler would allow
it, it is impossible to construct a TOML value for this sort of enum. Now that
we have lua we have more flexibility in the table type and this is unblocked.
In practical terms this means that we can do away with the janky `arg` field
and just use the `action` field directly, which also means that we can do away
with a whole extra enum that duplicates just the enum variants and makes
maintenance easier!
Adds `wezterm.action` to lua which helps to construct these enum variants. The
helper is used like this in the `.wezterm.lua` file:
```lua
local wezterm = require 'wezterm';
return {
keys = {
{key="{", mods="SHIFT|CTRL", action=wezterm.action{ActivateTabRelative=-1}},
{key="}", mods="SHIFT|CTRL", action=wezterm.action{ActivateTabRelative=1}},
}
}
```
the above creates values like `KeyAssignment::ActivateTabRelative(-1)`
in a not totally awful syntax.
On top of this, which was the main reason for doing this work, this
commit adds two new variants to KeyAssignment that are accessible
on from lua (because of the TOML limitations mentioned above);
`SpawnCommandInNewWindow` and `SpawnCommandInNewTab` that take a
`SpawnCommand` struct as their parameter. These actions are
conceptually similar to the existing `SpawnTab` key assignment
but allow specifying the program to be run as well as its cwd
and environment.
For example, this key assignment spawns `top` in a new window:
```lua
{key="y", mods="CMD", action=wezterm.action{SpawnCommandInNewWindow={
args={"top"}
}}},
```
The intent is to use this as a building block for saved/canned
commands.
refs: https://github.com/wez/wezterm/issues/159
implementing the `ToLua` and `FromLua` traits allows `create_function`
to automatically apply the appropriate conversions to the parameters
and return values in a callback function.
That makes it possible (and nicer!) to write properly typed callbacks.
Make a reasonable suggestion to the user based on similarity with
possible field names, but don't error out.
This facilitates evolving the configuration over time, and makes
the config more forgiving of typos.
Weirdly, this seemed specific to lua files rather than toml files,
which I don't have a good explanation for. When saving the file
in vim, we'd get a NoticeRemove but no Remove event.
This commit synthesizes the equivalent of a Remove after a NoticeRemove
and a slight delay.
If we hit a timeout for a tab we could mark it dead and remove it
from the containing window. This isn't desirable for a tls
session that we can reconnect, in part because the timeout is
likely to happen to the last focused tab if connectivity was
suddenly lost (that was the one we were interacting with, so are
likely to have PDUs about to go out), so only that one gets marked
dead and removed from the GUI.
When we re-attach later we may place the tab in the wrong ordinal
position, which is annoying.
This commit seeks to avoid the annoyance by not marking the tab
dead for reconnectable transports.
refs: https://github.com/wez/wezterm/issues/127
For full screen terminals it is common for scrolling through vim
to hit the prior default limit. This value feels better. This
comes at the cost of an increased delay for eg: CTRL-C processing
in the case where something is spamming the terminal, but that
is relatively rare.
This tidies up the part of the config syntax that I most disliked:
```lua
font = {
font = {{
family = "Operator Mono SSm Lig Medium",
}},
},
```
can now be as simple as:
```lua
font = wezterm.font("Operator Mono SSm Lig Medium"),
```
Here's the font related section from my config:
```lua
local wezterm = require 'wezterm';
return {
font = wezterm.font("Operator Mono SSm Lig Medium"),
font_rules= {
{
italic = true,
font = wezterm.font("Operator Mono SSm Lig Medium Italic"),
},
{
italic = true,
intensity = "Bold",
font = wezterm.font("Operator Mono SSm Lig Book Italic"),
},
{
intensity = "Bold",
font = wezterm.font("Operator Mono SSm Lig Bold", {foreground = "tomato"}),
},
{
intensity = "Half",
font = wezterm.font("Operator Mono SSm Lig Light"),
},
},
}
```
This allows for slightly more fancy configuration in the future, but for
now it is rather simple: your lua script returns a configuration struct
with the same shape as that from the TOML file.
A `wezterm` module is provided to the script that provides some
constants to help understand the environment in which wezterm
is running.
I want to add some helpers that make setting up the fonts feel less
weird (lots of nesting in the data model makes this weird).
The ability to conditionally construct configuration is powerful
and helps to address the broader request in
refs: https://github.com/wez/wezterm/issues/152
An example config looks like this:
```lua
local wezterm = require 'wezterm';
print(wezterm.config_dir);
print(wezterm.executable_dir);
wezterm.log_error("w00t! running " .. wezterm.version
.. " on " .. wezterm.target_triple .. " " .. wezterm.home_dir);
return {
enable_scroll_bar = true,
enable_tab_bar = true,
ratelimit_output_bytes_per_second = 400000,
scrollback_lines = 350000,
font_dirs = {".dotfiles/fonts"},
window_padding = {
left = 2,
bottom = 2,
},
font = {
font = {{
family = "Operator Mono SSm Lig Medium",
}},
},
unix_domains = {
{
name = "unix",
}
},
ssh_domains = {
{
name = "localhost",
remote_address = "localhost",
username = "wez",
},
},
tls_clients = {
{
name = "cubetls",
remote_address = "cube-localdomain:8080",
bootstrap_via_ssh = "cube-localdomain",
},
},
tls_servers = {
{
bind_address = "192.168.1.8:8080",
},
},
hyperlink_rules = {
{
regex = "\\b\\w+://(?:[\\w.-]+)\\.[a-z]{2,15}\\S*\\b",
format = "$0",
},
},
font_rules= {
{
italic = true,
font = {
font = {{
family = "Operator Mono SSm Lig Medium Italic",
}}
},
},
{
italic = true,
intensity = "Bold",
font = {
font = {{
family = "Operator Mono SSm Lig Book Italic",
}}
},
},
{
intensity = "Bold",
font = {
foreground = "tomato",
font = {{
family = "Operator Mono SSm Lig Bold",
}}
},
},
{
intensity = "Half",
font = {
font = {{
family = "Operator Mono SSm Lig Light",
}}
},
},
},
}
```
I saw that the server exited with a panic here in the case that the
connection was torn down and left the channel broken. We don't need
to terminate in this case and can simply ignore the error.
Add an update indicator to the top right of client tabs; this is
overlaid on top of the surface when the last update from the server was
more than ~3s ago and if we expected it sooner than that.
While making this work, I noticed that the exponential poll backoff
had gotten broken in an earlier refactor; instead of a series of polls
backing off slowly, we were aggressively running the backoff up to the
max 30 second interval over the span of a few ms. This commit fixes
up the backoff computation to only happen when we are ready to send
a poll.
refs: https://github.com/wez/wezterm/issues/127
When we're trying to use credentials from a session that was previously
bootstrapped via ssh but hit connection refused (eg: the server was
subsequently shut down), then we want to proceed to attempting to
re-boostrap via ssh.
That version has the ability to use SSH agent forwarding.
This commit doesn't enable that functionality, it's just updating
the version and adjusting for changes in the upstream.
If we'd decided to close a tab due to an error bubbling up in the
reader, we need to re-assign a local id when we enumerate tabs.
This is a bit of a crutch: ideally we'd not close the tab and
instead show some kind of UI to indicate that it is not responding.
refs: https://github.com/wez/wezterm/issues/127
Implement FromStr and Display for SshParameters, so that they can be
parsed and displayed in the standard way.
The motivation for this is that I want to add gateway hosts to the ssh command, and
would like to be able to add something like `gateway: Vec<SshParamters>` to SshCommand
to do it.
This allows child processes to "do something" with that information.
For example, portable wezterm deployments can use these paths to
bootstrap some other portable config paths.
refs: https://github.com/wez/wezterm/issues/152
The other default available macos monospace fonts have ligatures for
"fi" that are configured such that harfbuzz will render them when they
are part of a word like "finish" which results in a very weird
appearance.
This helps to restore any individually dropped tabs and to detect
tabs that were created by other clients across a reconnection.
refs: https://github.com/wez/wezterm/issues/127
This is useful for setting up a reasonable initial environment.
For example, on Windows you might want to set the `prompt` environment
so that some basic shell integration is enabled; this will cause new
tabs to open with the same cwd as the current tab:
```
set_environment_variables = { "prompt"="$E]7;file://localhost/$P$E\\$P$G" }
```
This setting is intended to apply only to the local domain.
refs: https://github.com/wez/wezterm/issues/146
This allows this prompt setting to work:
```
prompt $E]7;file://localhost/$P$E\$P$G
```
although this one sets it for future prompts:
```
setx prompt $E]7;file://localhost/$P$E\$P$G
```
refs: https://github.com/wez/wezterm/issues/146
This is conceptually slightly cleaner and allows sessionhandler to
be agnostic of the details of the channel used to communicate with
the client; it just has a Sender<DecodedPdu> to work with.
I suspect some race condition because adding these made the connect
time hang stop reproducing for me on my local network.
Will try this to the corp vpn.
refs: https://github.com/wez/wezterm/issues/127
This commit adjusts the features in Cargo.toml to allow building
without openssl on unix systems.
It teaches the native_tls flavor of the code to perform bootstrapping
via ssh, but is still not usable because there still isn't a way
to get native_tls to use PEM files.
This makes the tls channel much easier to use; the config can now be as
simple as this on the server side:
```toml
[[tls_servers]]
bind_address = "192.168.1.8:8080"
```
and this on the client side:
```
[[tls_clients]]
name = "hostname"
bootstrap_via_ssh = "192.168.1.8"
remote_address = "hostname:8080"
```
and then `wezterm connect hostname` will use ssh to connect to the
host, start the mux server, request the CA and client certs and
then connect to it over TLS.
This is implemented only for openssl at the moment.
If we're actively outputting to the window and the user closes it,
we don't need to panic.
Make the window a little larger now that it shows more data.
Adds a default 60 second timeout for read and write for the tls
and unix domain sockets that we create. This applies to ssh
domains, but not `wezterm ssh` sessions that go direct to ssh ptys.
I noticed that the reconnection UI for TLS mux sessions was annoying
on macOS: it would flash up and steal the focus, make a connection
attempt that would immediately fail because the destination was not
routable and then close the window. It would do this each time
a connection attempt was made (every few seconds in the early
stages of backoff).
This commit pulls the UI up a level so that we open the window at
the start of the connection (or re-connection) attempt, and keep
the same one for its lifetime.
This also introduces a headless UI object that doesn't output or
respond to anything. You can set the log level to trace to see
what is happening inside. It is used by the CLI mode. It could
perhaps be made smart enough to conditionally show a UI when needed,
but since it is targeting local unix domain sockets, that doesn't
seem like it is needed right now.
I'm adding this primarily to avoid repeatedly showing "No more
fallbacks" errors when moving the mouse over a terminal that contains
cells with no matching glyphs.
It has the nice side effect of changing the typical opengl tab render
time from ~2.9ms to ~1.3ms.
The opengl based render first clears the window to the background
color and then renders the cells over the top.
on macOS I noticed a weird lighter strip to the bottom and right of
the window and ran it down to the initial clear: our colors are SRGB
rather than plain RGB and the discrepancy from rendering SRGB as RGB
results in the color being made a brighter shade. This was less
noticeable for black backgrounds.
We now display a list of tabs and allow selecting them with either
the up/down arrows or the k/j keys. Enter activates the selected
tab, Escape cancels the overlay.
An overlay is a little termwiz app that can be overlaid over the
content of a gui tab.
The intent is for these to provide the mechanism for meta operations;
listing all tabs in a long-form list and switching between them,
dropping into configuration or error log review and so on.
We now show a little status window when we're making a connection
for a remote mux domain.
This should make things feel slightly nicer if there is a connectivity
problem.
refs: https://github.com/wez/wezterm/issues/127
Rather than just a single attempt at each mechanism, let's allow up
to 3 loops, each time trying all supported mechanisms. This helps
for the case where the user makes a typo with their password, and
should also help for more complicated auth setups where succeeding
with one mechanism may not be sufficient.
While testing this out I noticed that were deferring closing the
OS level window until after the entire auth attempt, so I added
some logic to proactively close the prompt windows. In the longer
term I'd like all related prompts to render in the same window
for improved cognotive continuity.
This matches cmd.exe and other programs (notepad, office, etc) behavior:
First click selects "start", then Shift+click selects "end". They form
a range.
This is particularly useful to select a large range of text, since the
user can release the left button, then operate on the scroll bar without
worrying about messing up text selection.
It gets a bit more complicated with the POSIX "mouse grabbed" situation.
When the mouse is grabbed, it's usually a full-screen ncurses-like
application. Selection mostly likely only makes sense within a single
screen. So Shift + LeftClick just works as starting a selection in this
case (otherwise it'll be hard to clear a selection).
The IME position is related to on-screen Window, not the
off-screen buffer.
Buffer
+- 0
|
| Window
| +- 0
| | (Tab bar)
+- 20 physical_top +- 1
| | (Terminal view)
| |
| |
+- 30 cursor.y +- 11 Correct IME position
It's too fiddly to setup in practice, and literally no one has
expressed an interest in using it.
Removing it simplifies some upcoming work.
Closes: https://github.com/wez/wezterm/issues/35
While debugging on windows earlier today I saw that we were
blocked on this wait on the main thread. For whatever reason,
that only blocks in practice on Windows; I suspect that this is
due to a timing issue on windows where the server side takes
longer to respond than it does on posix.
The root cause and secondary effect were a little surprising: the mux
pub/sub notification pipe filled up and because the mux notify routine
uses `retain` with the success of the send as a predicate it meant that
the full pipe resulted in the muxer killing that end of the subscriber
and that in turn made the ClientSession loop fail when it was
dispatching a notify on the other end, which terminated the loop and
disconnected the client.
Now, with this fixed, we have a flow control problem and the terminal
will remain busy with ctrl-c not being effective in the mux session.
This was an accidental casualty of some recent refactoring;
we need to clear the selection range when lines that intersect
with it are changed, so that's what this does.
Fixes: https://github.com/wez/wezterm/issues/118
Matching against the current dir when it includes a host and a
path seems like a handy way to automate selecting appropriate
theme/color/profile settings, so I'd like to make sure that
we have the full URL content available for that.
Refs: https://github.com/wez/wezterm/issues/115
Refs: https://github.com/wez/wezterm/issues/117
I'll write up more comprehensive docs once CI has proven that
the color schemes are packaged correctly.
The gist of it is that you can now specify:
```
color_scheme = "Batman"
```
to specify the default color palette.
The name corresponds to one of the color schemes from the
`assets/colors` directory. That directory is packaged and installed by
the CI deployment script, but we're also able to load them from the
source dir if you're running from in the wezterm source tree.
You can see previews of the various schemes here:
<https://iterm2colorschemes.com/>
In addition to loading from those that path, wezterm will search:
* In the `config` dir that is a sibling to `wezterm.exe` on windows
(not yet tested!)
* The directories specified in your `color_scheme_dirs` config setting
(multiple paths can be specified)
* You may also define schemes directly inline in your config file
using syntax like this:
```
[color_schemes."My Name"]
foreground = "#4a4543"
background = "#f7f7f7"
```
These visual artifacts seemed to affect everything other than Wayland
and were a bit annoying. The manifestation was that the cursor outline
box might have an extra line of another color on one or more of the
borders; whether it did or not seemed dependent on a combination of the
position of the cursor and the pixel width/height of the overall window.
This commit sets the texture sampler to prefer not to interpolate/merge
the value if it is between pixels and instead take the nearest texel.
Resizes can transiently result in lines whose length doesn't
match the vertex buffer width. If that happens, we probably
still derive value from painting the remaining lines, so allow
that to continue rather than blowing up the render.
This fixes a problem where a closed tab would linger until a subsequent
input event. The issue was that the layer at which we detect the tab
closure didn't have a way to signal the gui layer to repaint.
This commit adds an invalidated flag to the mux window object that is
updated when structural changes occur to its tabs; added, deleted,
activated and so on.
We check that flag in our periodic function in the gui layer and then
trigger a gui level invalidation if we see that it is set.
Record a notion of the state of the invalidations that we've sent
to the client so that we can skip sending updates if nothing has
changed since the last push.
It was possible to exhaust the number of fds on the server by
opening a vertical vim split and aggressively sliding it left
and right.
This commit allows the produce side to clone an arbitrary number
of senders without using up file descriptors.