1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-11 14:25:57 +03:00
Commit Graph

170 Commits

Author SHA1 Message Date
Wez Furlong
6b493ecd18
windows: another run at fixing up the build 2024-05-13 15:09:48 -07:00
Wez Furlong
ccc32faaba
speculative windows build fix 2024-05-13 13:58:26 -07:00
Wez Furlong
1ca5e6cc90
deps: upgrade smol to 2.0 2024-05-13 10:26:29 -07:00
Wez Furlong
6c890c3995
update metrics to latest version (0.22) 2024-05-13 09:41:12 -07:00
Wez Furlong
281b6e2740
deps: update metrics to a more recent version
This isn't the latest version of metrics; it's just a more recent
version that allows us to remove a duplicate ahash dependency from the
build graph.
2024-05-13 09:41:11 -07:00
Wez Furlong
14d426fea8
add cargo deny config, update lru 2024-05-13 08:29:36 -07:00
Wez Furlong
e19def7c9a
codec: improve error messaging when remote is misconfigured
Work a bit harder to surface that the remote might be outputting
stuff to stdout.

closes: https://github.com/wez/wezterm/issues/5380
2024-05-10 06:24:20 -07:00
Wez Furlong
6b93ee19e7
mux: record client ssh_auth_sock information
This commit expands the set of data that we track for each client to
include the SSH_AUTH_SOCK. This defaults to the value of that env var on
the machine where the ClientId is constructed, which may be remote from
the mux server.

For the proxy scenario, a remote SSH_AUTH_SOCK path is not addressable,
and what we really want is the local SSH_AUTH_SOCK path from that SSH
session, so we introduce awareness of whether the current session is a
proxy session. Proxy sessions register the mux-local-proxy-id during the
setup of the proxy, but we don't apply the identity to the mux. Instead,
we wait for the remote client to send their identity and that is
annotate to show that it has been routed via a proxy and, crucially, has
the SSH_AUTH_SOCK replaced with the mux-local-proxy-id SSH_AUTH_SOCK.

```
; wezterm cli list-clients
USER HOST                          PID CONNECTED     IDLE         WORKSPACE FOCUS SSH_AUTH_SOCK
wez  foo                        336500 86.944834352s 944.834352ms default       3 /home/wez/.1password/agent.sock
wez  foo (via proxy pid 337457) 337314 1.944834352s  944.834352ms               4 /tmp/ssh-XXXXTfGSp7/agent.337456
```

For the SSH_AUTH_SOCK to be populated, ssh agent forwarding also needs
to be enabled for SSH exec() calls; previously it was enabled only for
pty channels.

Since this commit changes the ABI of the mux protocol, the codec
version has been bumped.
2024-05-09 07:45:19 -07:00
Wez Furlong
f6fdfeb9fd
mux: ssh: add override_proxy_command to SshDomain
This enables users to override the normal invocation completely,
which is helpful for example when connecting into a gui from
a remote host.

I was wondering why prefer-mux was in here, and my commit message
from 7afc9e4d56 suggests that I
hit an issue where the gui wasn't running and where I didn't care
because I wanted to hit the mux.

I think that makes it a little awkward to blanket remove the
--prefer-mux flag, but for those that don't want it, they should now
be able to configure to allow connected to the gui

```
  ssh_domains = {
    {
      name = "shortname",
      remote_address = "hostname",
      override_proxy_command = "wezterm cli proxy",
    },
  },
```
2024-05-08 15:32:38 -07:00
Wez Furlong
6b66b6674a
mux: proxy: extract unix domain from connected client
This resolves an issue where `WEZTERM_UNIX_SOCKET=something wezterm cli
proxy` would use `something` for the unix domain path when checking that
an existing instance was up and running, but would then use the default
implicit socket path when dropping into the proxy passthrough stage.

What we do here is transform the connected client into its configuration
and use that instead of trying to re-derive the socket from incomplete
information.

The motivating example is using SSH to get into a workstation that
is running a GUI wezterm with no explicit unix domain mux.
2024-05-08 15:14:22 -07:00
Bogdan-Cristian Tătăroiu
be20f8bc9e Fix inconsistent spawn behaviour when using default_mux_server_domain.
When using an exec domain as a default_mux_server_domain, you currently
witness the following behavior:
- Newly started mux-servers create a pane in the exec domain.
- Splitting an existing pane will create the new pane in the exec
  domain.
- Calling [wezterm cli spawn] will create a new tab or window in the
  exec domain.
- Creating a new tab from the Gui does *not* run in the exec domain.

This appears to be due to the fact that ClientDomain hardcodes an
assumption that the default domain_id of the remote mux-server is 0.

Instead of having ClientDomain issue a SpawnV2 RPC explicitly asking for
domain_id 0, simply use DefaultDomain.
2024-02-11 08:35:33 -07:00
Wez Furlong
99c17b166f
add wezterm start --new-tab and wezterm connect --new-tab
refs: https://github.com/wez/wezterm/discussions/4854
refs: https://github.com/wez/wezterm/discussions/4946
2024-02-03 07:51:06 -07:00
Wez Furlong
aa81a46d58
mux: allow specifying cache policy for process information
This allows individual call sites to be able to force an immediate
resolution of the process information.

This should help to address https://github.com/wez/wezterm/issues/4811
wherein the problem seems to be that the cwd used for a new spawn
is taken from a stale read.
2024-02-02 18:02:18 -07:00
Wez Furlong
914f18b19c
remove openssl pinning, cargo update
refs: https://github.com/sfackler/rust-openssl/issues/1645
2023-09-04 13:31:03 -07:00
Rémi Labeyrie
da2c035ad2 feat: handle horizontal mousewheel events 2023-07-10 12:55:13 -07:00
Mat Jones
2f4266cb6a
feat: resize pane from CLI (#3491)
* WIP resize pane from CLI

* fix response types

* fix: remove unneeded `import std::usize;`

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* fix: update derived files

* fix: update codec version

* chore: update changelog.md

* fix: remove unneeded `import std::usize;`

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* chore: update changelog.md

* remove erroneous changelog.md change

* remove erroneous changelog.md change

* remove whitespace changes

---------

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2023-04-18 08:34:39 -07:00
Wez Furlong
9b67a71485
add wezterm cli get-pane-direction
refs: https://github.com/mrjones2014/smart-splits.nvim/issues/53
2023-04-05 07:00:49 -07:00
Wez Furlong
e28b3cec4e
mux: fix unseen output status for remote panes
refs: #2625
2023-04-03 21:12:18 -07:00
Wez Furlong
25be7fb9b1
mux: avoid WindowTitleChanged cycle
double-tapping the window title could lead to a cycle between
client and server.

The cycle is broken here by having the client defer advising
the server of a title change, and sending the now-current
title rather than the title embedded in the notification
from the mux layer.

refs: #1598
refs: #522
2023-04-03 20:23:47 -07:00
Wez Furlong
49296500da
mux: forward ClearScrollback requests to remote server
refs: #2624
2023-04-02 14:17:05 -07:00
Wez Furlong
ec85c243e9
mux: increase unix reconnect delay
In debug builds I noticed that sometimes we'd fail to connect
to a newly spawned unix server.

Increase the timeout to give it a chance to start up before
we error out.
2023-04-02 13:51:34 -07:00
Wez Furlong
b853d00cff
mux: detach domain on window close
refs: #2644
2023-04-02 13:35:12 -07:00
Wez Furlong
741570563d
add wezterm cli rename-workspace
refs: #2787
2023-04-02 07:37:45 -07:00
Wez Furlong
dd7d22ed6b
mux: propagate tab and window title when it changes
refs: #1598
2023-04-01 21:31:37 -07:00
Wez Furlong
74da631430
mux: allow client to provide palette to mux server
The server-side ownership of the palette is a stumbling block for
many users, so let's fix it.

This commit allows the client to pass its configured palette to
the server when it connects, and when the config is changed.

That palette takes precedence over the palette from the server config.

However, if the remote application uses any escape sequences that
redefine the color palette, the color palette that was active at
that point in time is forked and use as the basis, and will remain
the active palette until the palette is reset via escape sequences.

refs: https://github.com/wez/wezterm/issues/2686
refs: https://github.com/wez/wezterm/issues/3397
2023-03-31 08:02:32 -07:00
Wez Furlong
72410a266f
mux: don't request lines if we think we are dead
refs: https://github.com/wez/wezterm/issues/3386
2023-03-30 16:34:11 -07:00
Wez Furlong
66df034ec0
fix unused import 2023-03-28 09:13:05 -07:00
Wez Furlong
07e1c5834b
mux: more robust handling of pane killing
Work harder to notice and handle the PaneRemoved notification
more centrally, which allows removing some earlier workarounds.

Now when we receive PaneRemoved, we take the opportunity to handle
missing mapping or stale mapping between local and remote ids and
perform a resync before continuing to handle the PaneRemoved message.

Doing it this way means that we don't need to second guess the timing
of notification or the resync, so we end up with the correct sequence
of notifications, and the result is the correct size of the splits
because the local and remote aren't independently managing the
the pane removal with conflicting ideas of the new size.

refs: https://github.com/wez/wezterm/issues/3386
2023-03-28 08:47:28 -07:00
Wez Furlong
cb5252a246
mux client: GC unreferenced remote window/tab/pane ids on resync
refs: #2759
2023-03-27 21:38:29 -07:00
Wez Furlong
46fc05a746
adjust log level for 'going to run proxy' message 2023-03-27 19:34:35 -07:00
Wez Furlong
d9d6b2a01a
mux: forward move-pane-to-new-tab requests to hosting mux
refs: #3374
2023-03-26 10:41:01 -07:00
Wez Furlong
98e137942a
mux: move-pane-to-new-tab didn't resync structure
Resolution is to propagate the MuxNotification to the clients
and have them resync.

refs: https://github.com/wez/wezterm/issues/3219
2023-03-25 20:50:03 -07:00
Wez Furlong
8dd365d4c5
mux: fix some dpi and pixel size issues
Three issues:

* The initial connect would leave the dpi assigned to 0, resulting
  in incorrect scaling when using imgcat until the window was resized
  and the correct dpi was passed up.
* On resize, we'd only compare the row/col count and not notice changes
  in pixel dimensions/dpi
* On the server side, when processing a resize and recomputing
  the tab size, we would omit the pixel dimensions and leave
  the resulting tabs and panes with 0 dimensions, breaking imgcat
  because it thought the window was 0x0.

refs: https://github.com/wez/wezterm/issues/3366
2023-03-25 20:24:57 -07:00
Wez Furlong
604ef152be
add wezterm cli activate-pane, wezterm cli activate-tab
refs: #3352
refs: https://github.com/wez/wezterm/issues/886
2023-03-24 17:32:55 -07:00
Wez Furlong
622ea1add8
mux: notify clients when the size/structure of a tab changes
This helps to notify when eg: splits are changed, or the tab
is resized by another client.

refs: https://github.com/wez/wezterm/issues/2133
refs: https://github.com/wez/wezterm/issues/2351
refs: https://github.com/wez/wezterm/issues/783
2023-03-24 17:28:34 -07:00
Wez Furlong
f71bce1727
mux: propagate pane focus change events to clients
This commit causes the mux to generate a PaneFocused notification
when the active pane is changed.

The mux server will forward that as a unilateral PDU to connected
clients.

The clientpane implementation will handle that by applying the
same state to the local mux.

refs: #2863
2023-03-24 13:13:31 -07:00
Wez Furlong
bc7acc18e0
fixup images with the multiplexer
* Translate from File to EncodedFile as needed
* Adopt blob leases in the mux server
* Fix an issue where the first image sent by the mux server would
  be replaced on the client by its background image, if configured.
  Removed the ImageData::id field to resolve this: you should use
  the hash field instead to identify and disambiguate images.
  Bumped the termwiz API version because this is conceptually
  a breaking change to the API

refs: https://github.com/wez/wezterm/issues/3343
2023-03-23 21:43:28 -07:00
Wez Furlong
829e5c15cf
fix potential deadlock when using wezterm cli split-pane
refs: #1818
2023-03-20 07:44:13 -07:00
Jalil David Salamé Messina
d541e2e13d fix(clippy): Remove closures where possible
- Removes closures and function calls for types that implement default:

  ```rust
  // Change
  let _my_str = get_str().unwrap_or(String::new);
  // To
  let _my_str = get_str().unwrap_or_default();
  ```

- Uses the `.cloned()/.copied()` methods where possible
- Use function pointer instead of simple closure

May improve performace, as closures generate more code, and this might
unlock some inlining opportunities.
2023-03-19 08:41:38 -07:00
Wez Furlong
2b298f5f96
mux: pass gui window position through from new mux window
Threads through a GuiPosition from mux window creation to allow it to be
used when the corresponding gui window is created.

SpawnCommand now has an optional position field to use for that purpose.

```lua
wezterm.mux.spawn_window {
  position = {
    x = 10,
    y = 300,
    -- Optional origin to use for x and y.
    -- Possible values:
    -- * "ScreenCoordinateSystem" (this is the default)
    -- * "MainScreen" (the primary or main screen)
    -- * "ActiveScreen" (whichever screen hosts the active/focused window)
    -- * {Named="HDMI-1"} - uses a screen by name. See wezterm.gui.screens()
    -- origin = "ScreenCoordinateSystem"
  },
}
```

refs: https://github.com/wez/wezterm/issues/2976
2023-02-05 21:43:37 -07:00
Wez Furlong
1609fd386b
add wezterm cli get-text command
closes: https://github.com/wez/wezterm/pull/2729
2023-02-05 09:05:48 -07:00
Wez Furlong
02eb0b4294
mux: rename Mux::get() -> try_get(), add "infallible" Mux::get()
This allows removing a bunch of unwrap/expect calls.

However, my primary motive was to replace the cases where we used
Mux::get() == None to indicate that we were not on the main thread.

A separate API has been added to test for that explicitly rather than
implicitly.
2022-12-19 11:55:35 -07:00
Wez Furlong
ee2aac0902
mux: require that Domain be Send + Sync 2022-12-19 11:52:38 -07:00
Wez Furlong
696148941c
Rc<Tab> -> Arc<Tab> 2022-12-19 11:52:38 -07:00
Wez Furlong
6e06b9af02
mux: Pane is now required to be Send+Sync. Use Arc<dyn Pane> 2022-12-19 11:52:33 -07:00
Wez Furlong
43f2265ef1 deps: textwrap -> 0.16
closes: https://github.com/wez/wezterm/pull/2664
2022-10-23 20:50:47 -07:00
Wez Furlong
f2b0ce7d2e mux client: add a warning 2022-10-18 08:22:51 -07:00
Wez Furlong
ac1413a99a fix panic with window:set_workspace when default domain is mux
refs: https://github.com/wez/wezterm/issues/2638
2022-10-17 07:06:43 -07:00
Wez Furlong
0d78261a30 mux client: consider domain id when mapping panes
We weren't matching the domain id when resolving the remote->local pane
mapping, which meant that having 2 or more mux client domains active
would lead to associating eg: remote pane id 1 with whichever local
pane was associated with any remote pane id 1 *first*.

This commit requires that both the domain id and the remote pane id
match.

refs: https://github.com/wez/wezterm/issues/2616
2022-10-11 21:28:11 -07:00
Wez Furlong
7ba9c00e49 mux client: add domain id to logs
refs: https://github.com/wez/wezterm/issues/2616
2022-10-11 20:27:55 -07:00