1
1
mirror of https://github.com/wez/wezterm.git synced 2024-08-16 09:40:34 +03:00

Merge branch 'wez:main' into nix-macos

This commit is contained in:
Shane Segal 2024-06-10 15:12:54 -04:00 committed by GitHub
commit e5ef03492b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 283 additions and 262 deletions

View File

@ -3,11 +3,11 @@ env:
CIRRUS_CLONE_DEPTH: 1
task:
name: freebsd-13
name: freebsd-14
compute_engine_instance:
image_project: freebsd-org-cloud-dev
image: family/freebsd-13-2
image: family/freebsd-14-0
platform: freebsd
cpu: 4
memory: 8G

386
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ anyhow = "1.0"
config = { path = "../config" }
leb128 = "0.2"
log = "0.4"
metrics = "0.22"
metrics = "0.23"
mux = { path = "../mux" }
portable-pty = { path = "../pty", features = ["serde_support"]}
rangeset = { path = "../rangeset" }

View File

@ -71,6 +71,10 @@ As features stabilize some brief notes about them will accumulate here.
#3283
* Wayland: hang when launched under ChromeOS Crostini. Thanks to @dberlin!
#5393 #5397
* macOS: Fixed notch avoidance padding in full screen mode. Thanks to @mbaird!
#5515 #3807
* Render invalidation issue when closing tabs other than the last tab. Thanks
to @Mrreadiness! #5441 #5304
#### Updated
* Bundled conpty.dll and OpenConsole.exe to build 1.19.240130002.nupkg

View File

@ -223,7 +223,7 @@ builting color scheme.
If you'd like to factor your color schemes out into separate files, you
can create a file with a `[colors]` section; take a look at [one of
the available color schemes for an example](https://github.com/wez/wezterm/config/src/scheme_data.rs).
the available color schemes for an example](https://github.com/wez/wezterm/tree/main/config/src/scheme_data.rs).
It is recommended that you place your custom scheme in a directory
named `$HOME/.config/wezterm/colors` if you're on a POSIX system.

View File

@ -146,23 +146,53 @@ return config
## Example: docker domains
Fully working example is yet to be completely fleshed out (volunteers welcome!) but the
gist of it is:
This example shows how to add each running docker container as a domain,
so that you can spawn a shell into it and/or split it:
{% raw %}
```lua
local wezterm = require 'wezterm'
local config = {}
local config = wezterm.config_builder()
function docker_list()
-- Use wezterm.run_child_process to run
-- `docker container ls --format '{{.ID}}:{{.Names}}'` and parse
-- the output and return a mapping from ID -> name
local docker_list = {}
local success, stdout, stderr = wezterm.run_child_process {
'docker',
'container',
'ls',
'--format',
'{{.ID}}:{{.Names}}',
}
for _, line in ipairs(wezterm.split_by_newlines(stdout)) do
local id, name = line:match '(.-):(.+)'
if id and name then
docker_list[id] = name
end
end
return docker_list
end
function make_docker_label_func(id)
return function(name)
local success, stdout, stderr = wezterm.run_child_process {
'docker',
'inspect',
'--format',
'{{.State.Running}}',
id,
}
local running = stdout == 'true\n'
local color = running and 'Green' or 'Red'
return wezterm.format {
{ Foreground = { AnsiColor = color } },
{ Text = 'docker container named ' .. name },
}
end
end
function make_docker_fixup_func(id)
return function(cmd)
cmd.args = cmd.args or { '/bin/bash' }
cmd.args = cmd.args or { '/bin/sh' }
local wrapped = {
'docker',
'exec',
@ -178,32 +208,23 @@ function make_docker_fixup_func(id)
end
end
function make_docker_label_func(id)
return function(name)
-- TODO: query the container state and show info about
-- whether it is running or stopped.
-- If it stopped, you may wish to change the color to red
-- to make it stand out
return wezterm.format {
{ Foreground = { AnsiColor = 'Red' } },
{ Text = 'docker container named ' .. name },
}
end
end
local exec_domains = {}
for id, name in pairs(docker_list()) do
table.insert(
exec_domains,
wezterm.exec_domain(
'docker: ' .. name,
make_docker_fixup_func(id),
make_docker_label_func(id)
function compute_exec_domains()
local exec_domains = {}
for id, name in pairs(docker_list()) do
table.insert(
exec_domains,
wezterm.exec_domain(
'docker:' .. name,
make_docker_fixup_func(id),
make_docker_label_func(id)
)
)
)
end
return exec_domains
end
config.exec_domains = exec_domains
config.exec_domains = compute_exec_domains()
return config
```
{% endraw %}

View File

@ -5,14 +5,14 @@ for yourself. WezTerm should run on any modern unix as well as Windows 10 and
macOS.
* Install `rustup` to get the `rust` compiler installed on your system.
[Install rustup](https://www.rust-lang.org/en-US/install.html)
[Install rustup](https://www.rust-lang.org/en-US/install.html).
* Rust version 1.71 or later is required
* Build in release mode: `cargo build --release`
* Run it via either `cargo run --release --bin wezterm` or `target/release/wezterm`
You will need a collection of support libraries; the [`get-deps`](https://github.com/wez/wezterm/blob/main/get-deps) script will
attempt to install them for you. If it doesn't know about your system,
[please contribute instructions!](https://github.com/wez/wezterm/blob/main/CONTRIBUTING.md)
[please contribute instructions!](https://github.com/wez/wezterm/blob/main/CONTRIBUTING.md).
If you don't plan to submit a pull request to the wezterm repo, you can
download a smaller source tarball using these steps:
@ -53,3 +53,19 @@ $ cargo build --release --no-default-features --features vendored-fonts
```
Building without X11 is not supported.
### Building on Windows
When installing Rust, you must use select the MSVC version of Rust. It is the
only supported way to build wezterm.
On Windows, instead of using `get-deps`, the only other dependency that you need is
[Strawberry Perl](https://strawberryperl.com). You must ensure that you have
your `PATH` environment set up to find that particular `perl.exe` ahead of any
other perl that you may have installed on your system. This particular version
of perl is required to build openssl on Windows.
```console
$ set PATH=c:\Strawberry\perl\bin;%PATH%
```

View File

@ -11,7 +11,7 @@ ahash = "0.8"
config = { path = "../config" }
fnv = "1.0"
intrusive-collections = "0.9"
metrics = "0.22"
metrics = "0.23"
[dev-dependencies]
k9 = "0.12"

View File

@ -25,7 +25,7 @@ lazy_static = "1.4"
libc = "0.2"
log = "0.4"
luahelper = { path = "../luahelper" }
metrics = "0.22"
metrics = "0.23"
mlua = "0.9"
names = { version = "0.12", default-features = false }
nix = {version="0.28", features=["term"]}

View File

@ -131,6 +131,8 @@ impl Window {
if len > 0 && self.active >= len {
self.set_active_without_saving(len - 1);
} else {
self.invalidate();
}
}

View File

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -71,11 +71,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1705403940,
"narHash": "sha256-bl7E3w35Bleiexg01WsN0RuAQEL23HaQeNBC2zjt+9w=",
"lastModified": 1717774105,
"narHash": "sha256-HV97wqUQv9wvptiHCb3Y0/YH0lJ60uZ8FYfEOIzYEqI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f0326542989e1bdac955ad6269b334a8da4b0c95",
"rev": "d226935fd75012939397c83f6c385e4d6d832288",
"type": "github"
},
"original": {
@ -106,11 +106,11 @@
]
},
"locked": {
"lastModified": 1705457855,
"narHash": "sha256-5cCHQtP/PEHK1YNTQyZN9v8ehpLTjc723ZSKAP3Tva8=",
"lastModified": 1717813066,
"narHash": "sha256-wqbRwq3i7g5EHIui0bIi84mdqZ/It1AXBSLJ5tafD28=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a854609265af0e9f48c92e497679edf8fab9e690",
"rev": "6dc3e45fe4aee36efeed24d64fc68b1f989d5465",
"type": "github"
},
"original": {

View File

@ -20,7 +20,7 @@ lazy_static = "1.4"
log = "0.4"
libc = "0.2"
lru = "0.12"
metrics = "0.22"
metrics = "0.23"
mux = { path = "../mux" }
openssl = "0.10.57"
parking_lot = "0.12"

View File

@ -28,7 +28,7 @@ lazy_static = "1.4"
lfucache = { path = "../lfucache" }
log = "0.4"
memmap2 = "0.9"
metrics = "0.22"
metrics = "0.23"
ordered-float = "4.1"
rangeset = { path = "../rangeset" }
termwiz = { path = "../termwiz" }

View File

@ -62,7 +62,7 @@ libc = "0.2"
lfucache = { path = "../lfucache" }
log = "0.4"
luahelper = { path = "../luahelper" }
metrics = "0.22"
metrics = "0.23"
mlua = {version="0.9", features=["send"]}
mux = { path = "../mux" }
mux-lua = { path = "../lua-api-crates/mux" }

View File

@ -47,7 +47,7 @@ k9 = "0.12.0"
once_cell = "1.8"
predicates = "3.0"
env_logger = "0.11"
rstest = "0.19"
rstest = "0.21"
shell-words = "1.1"
termwiz = { version = "0.22", path = "../termwiz" }
whoami = "1.5"

View File

@ -34,7 +34,7 @@ lazy_static = "1.4"
libloading = "0.8"
line_drawing = "0.8"
log = "0.4"
metrics = "0.22"
metrics = "0.23"
promise = { path = "../promise" }
raw-window-handle = "0.5"
resize = "0.5"

View File

@ -895,11 +895,13 @@ impl WindowOps for Window {
let insets: NSEdgeInsets = unsafe { msg_send![main_screen, safeAreaInsets] };
log::trace!("{:?}", insets);
// Bleh, the API is supposed to give us the right metrics, but it needs
// a tweak to look good around the notch.
// <https://github.com/wez/wezterm/issues/1737#issuecomment-1085923867>
let top = insets.top.ceil() as usize;
let top = if top > 0 { top + 2 } else { 0 };
let scale = unsafe {
let frame = NSScreen::frame(main_screen);
let backing_frame = NSScreen::convertRectToBacking_(main_screen, frame);
backing_frame.size.height / frame.size.height
};
let top = (insets.top.ceil() * scale) as usize;
Some(Border {
top: ULength::new(top),
left: ULength::new(insets.left.ceil() as usize),