1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-24 07:46:59 +03:00
Commit Graph

4977 Commits

Author SHA1 Message Date
Wez Furlong
39c2da3bdf avoid race condition when closing last window in a workspace
This isn't ideal, but it is better than previously: we would
close the window and before the Drop impl had updated the
list of known windows, we'd try to re-assign that window
to another mux window in a different workspace, but it would
never appear because the window was closed.

refs: https://github.com/wez/wezterm/issues/1531
2022-01-15 20:02:14 -07:00
Wez Furlong
093b448624 When switching workspaces, resize workspace to fit the window
Originally I had this the other way around but it was problematic
when considering things like maximized, font scaling and full screen
states.

refs: https://github.com/wez/wezterm/issues/1531
2022-01-15 19:33:29 -07:00
Wez Furlong
bb9290f431 launcher: avoid subtract with overflow panic 2022-01-15 19:33:02 -07:00
Wez Furlong
76a213f7ab Gui switches to a different workspace when current workspace is emptied
Rather than just quitting the app and potentially silently killing off
a number of panes that might be running in other workspaces, we now
will pick one of those workspaces and activate it.

refs: #1531
2022-01-15 14:41:19 -07:00
Wez Furlong
180e72a673 adjust help for wezterm cli spawn's --workspace parameter 2022-01-15 14:21:47 -07:00
Wez Furlong
aa52555fb8 add workspaces to launcher menu
refs: #1531
2022-01-15 14:16:41 -07:00
Wez Furlong
6ba9d7f72e Add --workspace parameter to most gui subcommands
These allow setting the initial workspace name
2022-01-15 14:01:30 -07:00
Wez Furlong
6d288696c8 Add SwitchToWorkspace keyassignment action
This action causes the active workspace for the gui to change.

If the name is omitted a random name will be generated.
If the workspace doesn't exist, it will be be created.
The optional spawn parameter can be used to launch a specific
program into the new workspace; if omitted, the default prog
will be used.

The gui only supports a single active workspace. Switching workspaces
will repurpose existing gui windows and re-assign them to windows
in the new workspace, adjusting their size to fit those windows,
spawning new windows or closing unused windows as required.

The gui now exits when there are no panes in the active workspace,
rather than no panes at all.

refs: #1531
2022-01-15 13:53:34 -07:00
Wez Furlong
626a022dd5 mux: function to list workspaces and generate a new name
refs: #1531
2022-01-15 08:46:21 -07:00
Wez Furlong
324815b625 mux: update last input time for local pane actions
This commit updates the last input time for the active client
id when calling into local pane.  That time is visible in the
`wezterm cli list-clients` output.
2022-01-15 07:03:20 -07:00
Wez Furlong
9a241509a4 mux: add current identity concept
The mux now has a notion of which client is actively doing things.
This allows, for example, newly spawned windows to take on the
active workspace for a given client.

The gui now assigns a client id on startup, and sets the active
workspace to `default`.

The mux server temporarily overrides the active id to that of
the currently dispatching client when processing PDUs.

refs: https://github.com/wez/wezterm/issues/1531
2022-01-15 06:25:11 -07:00
Wez Furlong
170bb31f4f refactor: move more spawn logic into new mux methods 2022-01-14 22:28:35 -07:00
Wez Furlong
30a9692f9d refactor: centralize some more spawn logic 2022-01-14 22:28:35 -07:00
Wez Furlong
e0fe1e7f04 mux: factor out common SpawnTabDomain resolution logic 2022-01-14 22:28:35 -07:00
Wez Furlong
31c754f6e4 refactor: move split_pane logic from mux server to mux 2022-01-14 22:28:35 -07:00
Wez Furlong
3947014bad refactor: decouple domain from cwd matching in spawn.rs
This will make it easier to re-use other spawn functions in a later
commit.
2022-01-14 22:28:35 -07:00
Wez Furlong
1704af88ba refactor: move logic -> Mux::spawn_tab_or_window
Tidies up some code duplication within the mux protocol handler.
Move some of the logic into Mux, remove legacy Spawn Pdu to reduce
more duplication.

I want to dedup some of the similar logic that exists in the gui
spawn implementation as well in a follow up.
2022-01-14 22:28:35 -07:00
Wez Furlong
1bc5c5a663 refactor: common spawn bits into Domain::spawn_pane
This a step towards decoupling split_pane from Domain.

refs: #1531
2022-01-14 22:28:35 -07:00
Wez Furlong
a9427aca63 Remove ALT-number default key assignments
The issue is that we work hard to match the keys pre-composition,
but for French and Norwegian layouts ALT-number are valid,
useful punctuation keys.  It's awkward to make exceptions for
ALT keys when matching assignments, especially on macOS, and
the simplest thing to do is simply to remove the assignments
and leave it to our users to add their own if they want them.

The ctrl-shift and cmd based assignments are generally much
easier to keep, because those key combinations are not widely
used default mappings on any keyboard layout.

refs: #1543
refs: #1542
refs: https://github.com/wez/wezterm/pull/1132
2022-01-14 22:24:40 -07:00
Wez Furlong
12de21df95 clarify debug_key_events logging
up/down events were ambiguous
2022-01-14 21:59:29 -07:00
Wez Furlong
91f8a341dd input: ALT-<number> default keys are now post-mapping assignments
This resolves some issues with non-US layouts (French, Norweigan)
where ALT-number are important and useful punctuation that we were
otherwise blocking.

This new behavior seems consistent with eg: vte terminals on linux
when switching to a French layout.

refs: #1543
refs: #1542
2022-01-14 08:49:34 -07:00
Chip Senkbeil
e46e2bae80
Add wezterm-ssh independent CI task to verify libssh-rs and ssh2 features can work independently (#1544)
Add wezterm-ssh independent CI task to verify libssh-rs and ssh2 features can work independently
2022-01-13 18:48:33 -07:00
Wez Furlong
b5dfbc392c make use_ime=true the default for all platforms
The key repeat issues that were blocking this from being enabled
on macos have been resolved.
2022-01-13 09:19:23 -07:00
Wez Furlong
507267aeee docs: changelog for https://github.com/wez/wezterm/pull/1534 2022-01-12 18:03:20 -07:00
Howard Huang
5b353df78e STYLE: Fix code format
Using `cargo fmt --all`
2022-01-12 17:01:38 -08:00
Howard Huang
e01f9c0e7d FEATURE: Allow ScrollByPage f64 values
`ScrollByPage` can accept non-integer values in the configuration.
This allows fractional page scrolling, such as by half a page.

The default remains the same, at 1 page.
2022-01-12 17:01:38 -08:00
Wez Furlong
35e921b9e6 input: fix alt-h on macos
We'd lost support for send_composed_key_when_X_alt_is_pressed;
this commit restores it.

refs: https://github.com/wez/wezterm/issues/1541
2022-01-12 16:47:08 -07:00
Wez Furlong
cefe45d206 Windows can be labelled with a workspace name
This is not exposed through any UX; the mux api allows setting
the workspace and propagating information about windows whose
workspace has changed.

Windows start with a blank workspace name.

This is just plumbing; nothing uses it yet.

refs: #1531
2022-01-12 16:47:08 -07:00
Wez Furlong
f6e56aab10 ci: tidy up termwiz workflow 2022-01-12 07:19:44 -07:00
Wez Furlong
4452fbe798 ci: trigger termwiz build on push as well 2022-01-12 07:16:16 -07:00
Wez Furlong
475fc0667b fix termwiz compilation when widgets are enabled
refs: #1457
2022-01-12 07:14:14 -07:00
Wez Furlong
9b9bd0ae8c mux: track list of clients
Define a way to compute a client ID and pass that through to the
mux server when verifying version compatibility.

Once associated, the session handler will keep some metadata
updated in the mux.

A new cli subcommand exposes the info:

```
; ./target/debug/wezterm cli list-clients
USER HOST              PID CONNECTED  IDLE      WORKSPACE
wez  mba.localdomain 52979 30.009225s 1.009225s
```

refs: #1531
2022-01-11 22:43:26 -07:00
Wez Furlong
e314d84711 wezterm connect unix could exit on startup
This is a similar race condition to one we had before with the
multiplexer, where the connection UI made us think that we didn't
need to start a new process.

Additionally, the attach method would unconditionally create a
new client without checking whether we already had one.
2022-01-11 22:35:31 -07:00
Wez Furlong
58d969e77c gui: Avoid 450ms delay on startup(!)
In the case that the published symlink is stale, our default
client connection logic was to retry connecting with backoff
to give a newly spawned server a chance to startup.

In the context of a newly launched gui process checking to see
if an existing gui process can serve the same request, we don't
need to give it any grace: it will either answer immediately
or be deemed not useful.

This commit limits us to a single connection attempt in the case
where we're not automatically starting the server, which in turn
constrains the overhead to something in the order of microseconds
rather than nearly 0.5 seconds.

While we're in here, I noticed that if we thought we had a socket
to try and that failed, we'd always try to publish a new symlink.
However, if we failed due to mismatched version info, we shouldn't
publish over the top of the already running instance.

refs: #1529
2022-01-10 20:31:01 -07:00
Wez Furlong
d1018c37ff docs: changelog for #1526 2022-01-10 18:56:57 -07:00
Wez Furlong
e40042e605 remove stray dbg! 2022-01-10 18:39:59 -07:00
Wez Furlong
1fd53d4a5d mux: propagate User Vars across to the client
user vars were stubbed out.  This commit adds storage for them
in the mux client and adds a new notification that publishes each
var as it is changed.  That differential stream is applied to the
storage in the mux client when it is received.

```lua
local wezterm = require 'wezterm'

wezterm.on("update-right-status", function(window, pane)
  local woot = pane:get_user_vars().woot
  window:set_right_status(tostring(woot))
end);

return {
  unix_domains = {
    {name="unix"},
  },
}
```

then running:

* `wezterm connect unix`
* in that session: `printf "\033]1337;SetUserVar=%s=%s\007" woot `echo -n nice | base64``

causes `nice` to show in the status area.

refs: #1528
2022-01-10 18:33:32 -07:00
Wez Furlong
3ae38eb5bf mux: synthesize PaletteChanged event when config is reloaded
This is slightly misusing or misattributing things, but in
the context of the problem at hand, it is OK.

The issue is that palette changes are normally signalled by
the terminal instance in response to escape sequences.  Those
changes are propagated to the mux client through the existing
alerting channel.

If the palette is changed implicitly via a config change, then
the terminal doesn't trigger that alert and the mux client(s)
don't know that they need to refresh the palette.

This commit tracks the last config generation per pane and
synthesizes a palette alert when it changes.

It might be better to have another variant of alert to indicate
config changes.

refs: #1526
2022-01-10 18:13:42 -07:00
Wez Furlong
a189bb57c1 mux: don't include unchanged lines in the bonus lines
This doesn't make a huge difference; I think we already addressed
the worst of the overhead with a combination of
eae327efcc
and the more recent commits to avoid over invalidation around
cursor movement and screen scrolling.

The numbers I see are a very small number of bytes per second when
scrolling through eg: vim and aren't crazy or alarming.

So I'm going to consider the related issue resolved!

closes: https://github.com/wez/wezterm/issues/867
2022-01-10 17:59:53 -07:00
Wez Furlong
0d18a40d60 improve some of our counters/stats 2022-01-10 17:59:53 -07:00
Wez Furlong
aa648797ae Include executable path and config path in version info
Use that to decide if the running version is equivalent to the
newly spawning one when deciding if we can route a command to it
or spawn a new gui
2022-01-10 17:59:53 -07:00
Wez Furlong
fc5c435949 stats: fix .size counters showing up as time counters 2022-01-10 10:36:33 -07:00
Wez Furlong
5d52902b4a invalidate fancy title bar before we potentially error out
This feels slightly more robust in the face of errors

refs: https://github.com/wez/wezterm/issues/1527
2022-01-10 08:31:10 -07:00
Wez Furlong
f48e2d9a85 SshDomain: assume_unix -> assume_shell = "Posix" 2022-01-10 08:27:09 -07:00
Wez Furlong
fe0488420b speculative fix for https://github.com/wez/wezterm/issues/1527
We need to invalidate the elements in the title bar if we reallocate
the quads, otherwise we'll be left with random stuff in the texture
coords.
2022-01-10 08:20:18 -07:00
Wez Furlong
1357480ce6 SshDomain: add assume_unix option; enables setting cwd for new panes
If we know that the remote host is a unix system, and that it uses some
version of the posix shell, then we can adjust our command line to cd to
the requested directory (as set by OSC 7) and then exec the requested
command.

That's what SshDomain::assume_unix indicates and what this commit does.
2022-01-09 21:32:09 -07:00
Chip Senkbeil
5042addb06 Add features to enable vendored-openssl for ssh2 and libssh-rs individually 2022-01-09 19:36:56 -08:00
Chip Senkbeil
1f17416e60 Support gating libssh-rs and ssh2 behind features of same name 2022-01-09 19:36:56 -08:00
Wez Furlong
b3987bec12 ssh: allow setting default_prog for SshDomain when multiplexing=None
```
return {
  ssh_domains = {
    {
      name = "woot",
      remote_address = "192.168.1.8",
      multiplexing = "None",
      default_prog = {"fish"},
    }
  },

  default_domain = "woot",
}
```

refs: https://github.com/wez/wezterm/issues/1456
2022-01-09 20:09:53 -07:00
Wez Furlong
a045cfe092 standardize on SshDomain as the way to configure RemoteSshDomain
refs: https://github.com/wez/wezterm/issues/1456
2022-01-09 19:45:11 -07:00