1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00
Commit Graph

226 Commits

Author SHA1 Message Date
Wez Furlong
b0f5e673c6 vtparse/termwiz: prep for release 2021-04-14 13:04:23 -07:00
Wez Furlong
2e34f1a8dd Add wezterm ls-fonts subcommand
At this time it just shows you the fonts that your config matches
and where they came from:

```
; wezterm -n ls-fonts
Primary font:
  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Italic=true:
  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=true)
    (/home/wez/.fonts/JetBrainsMono-Italic.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Intensity=Bold:
  wezterm.font("JetBrains Mono", weight="Bold", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Bold.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Intensity=Bold Italic=true:
  wezterm.font("JetBrains Mono", weight="Bold", stretch="Normal", italic=true)
    (/home/wez/.fonts/JetBrainsMono-Bold-Italic.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

```

refs: #347
2021-04-12 09:44:27 -07:00
Wez Furlong
6f1664addd cargo update 2021-04-12 07:54:46 -07:00
Wez Furlong
6c86e20b30 fonts: add custom freetype stream impl
The intent is to reveal more context on what's happening in
https://github.com/wez/wezterm/issues/671

As a nice side benefit, this avoids the potential inability
to open paths that are not utf8 or representable as c-strings
on Windows.

And on top of that: this enables memory mapped file IO as well,
which wasn't enabled previously.  This should help to reduce
extraneous copies of the font in memory, have fewer open files
and minimize the chances of racing with O_CLOEXEC.
2021-04-10 10:36:22 -07:00
Wez Furlong
43ea2f192a Allow matching font weight and font width in wezterm.font
refs: https://github.com/wez/wezterm/issues/655
2021-04-08 15:42:53 -07:00
Wez Furlong
064b591a1b fonts: remove ttf_parser, compute coverage from freetype
Replaces the last usage of ttf-parser with calling into freetype.

This removes a source of inconsistency, as ttf-parser doesn't support
all of the things that freetype does.

Notably, this prevents a weird error from blowing up codepoint coverage
calculations on a system where I have helvetica.bdf in my font dir for
long-forgotten reasons.
2021-04-08 09:12:59 -07:00
Wez Furlong
0231065a38 cargo update 2021-04-05 08:46:55 -07:00
Wez Furlong
369888c94e wezterm-client: cut over to new wezterm-ssh bits
refs: https://github.com/wez/wezterm/issues/507
2021-03-28 07:18:38 -07:00
Wez Furlong
9745a24c63 fix: cli proxy would terminate too soon
refs: https://github.com/wez/wezterm/issues/507
2021-03-28 07:10:30 -07:00
Wez Furlong
e103653923 RemoteSshDomain now uses wezterm-ssh crate
There are a few notable changes as a result:

* A number of `.ssh/config` options are now respected; host matching
  and aliasing and identity file are the main things
* The authentication prompt is inline in the window, rather than
  popping up a separate authentication window

Refs: https://github.com/wez/wezterm/issues/457
2021-03-27 18:12:34 -07:00
Wez Furlong
13f13d7309 wezterm-ssh: add pubkey based auth
I can't get this to succeed though; I suspect there may be a lingering
bug from libssh2 and/or trailing support for newer openssh features.

refs: https://github.com/wez/wezterm/issues/457
2021-03-26 23:54:57 -07:00
Wez Furlong
6bb941b653 wezterm-ssh: flesh out improved ssh crate
This implementation should be less prone to stutters/stalls
than my earlier hacky implementation in pty/src/ssh.rs
2021-03-26 21:57:44 -07:00
Wez Furlong
57b0911504 add Pane::get_logical_lines
refs: https://github.com/wez/wezterm/issues/527
refs: https://github.com/wez/wezterm/issues/408
2021-03-26 13:18:44 -07:00
Wez Furlong
cdae65238a ssh2: on windows, link against openssl
The wincng based build doesn't recognize newer keys which makes it
impossible to connect to a reasonably up to date Fedora installation.

This commit points to my branch of ssh2-rs that has some changes to
build ssh2 against the vendored openssl that is already part of
the dependency graph for wezterm.

refs: https://github.com/wez/wezterm/issues/507
2021-03-26 10:00:43 -07:00
Aaron Abramov
786888ce0a update k9 to 0.11.0 to make it work with rustc@1.51.0
1.51.0 no longer takes non string literals in `panic()`. k9@0.11.0 fixes that
2021-03-25 10:39:00 -07:00
Wez Furlong
99f79143b4 cargo update 2021-03-25 10:08:03 -07:00
Wez Furlong
dbd7fc28a5 Raise minimum Rust version to 1.51, de-vendor openssl on unix
Rust 1.51 allows addressesing a long-standing TODO which was that we
shouldn't need to build a vendored copy of openssl on most sensible unix
systems.

We do require a vendored copy on macOS and Windows, but due to the way
that Cargo's feature resolver worked, it wasn't possible for this
requirement to be respected.

Rust 1.51 introduces `resolver="2"` which can deal with this feature
resolution!

https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2

The upshot of this is that building wezterm on real unix systems that
are not macos will now link against the system libssl, resulting in both
a shorter compile time and less headaches arising from having a slightly
different openssl used by wezterm than the rest of the system.

cc: @jsgf
2021-03-25 09:43:50 -07:00
Wez Furlong
b876fbabd6 remove the config bridge and have window -> config directly 2021-03-23 21:56:57 -07:00
Wez Furlong
b0572bbf1f Add ssh_config parser
refs: https://github.com/wez/wezterm/issues/457
2021-03-23 12:58:41 -07:00
Wez Furlong
3cf7c9c3c2 refine skip_close_confirmation_for_processes_named to look at proc tree
That means that we won't be fooled by a shell with a backgrounded
editor.

refs: https://github.com/wez/wezterm/issues/562
2021-03-22 21:34:10 -07:00
dependabot[bot]
f032c5202a build(deps): bump windows from 0.4.0 to 0.5.0
Bumps [windows](https://github.com/microsoft/windows-rs) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Changelog](https://github.com/microsoft/windows-rs/blob/master/docs/changelog.md)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-22 13:55:43 -07:00
Wez Furlong
8dbcb3e00c cargo update 2021-03-21 20:18:02 -07:00
Wez Furlong
a0d39989df simplify Color data type
There's something fishy with colorspaces and blending.
This commit removes the `window::Color` type and replaces
it and the confusing array of color types exposed by the
`palette` crate with a pair of much simpler types:

`LinearRgb` - a tuple of f32 linear color components
`SrgbaPixel` - the u32 sRGBA pixel representation

This doesn't change anything about rendering, it just
makes it a bit simpler and makes the SrgbaPixel -> LinearRgb
conversion happen slightly earlier which shaves off some
ad-hoc conversions.

Refs: https://github.com/wez/wezterm/issues/544
2021-03-21 16:54:22 -07:00
Wez Furlong
c6922c001d cargo update 2021-03-18 22:08:40 -07:00
Wez Furlong
1ee4d52a1c deps: update ttf_parser 0.9 -> 0.12 2021-03-18 22:08:07 -07:00
Wez Furlong
57f1aa2785 fixup build to not consider termwiz tags as wezterm tags
CI got broken by the termwiz release.  This commit teaches the
various `git describe --tags` calls to filter to the wezterm
tags which all start with the year.  We're match `20*` which should
be good for the next 79 years.

I've removed the vergen dependency as there was no way to teach it
to do the equivalent matching, and it wasn't a terrible burden
to just inline the git describe call anyway.
2021-03-17 21:02:03 -07:00
Wez Furlong
045c3d05a4 cargo update 2021-03-15 06:32:14 -07:00
Wez Furlong
5681cd9b64 gui: update windows dep to 0.4 2021-03-14 15:25:33 -07:00
Wez Furlong
90e8e6e105 toast: hook up action/event handling on Windows
refs: #489
2021-03-14 15:23:42 -07:00
Wez Furlong
f4105cb42f avoid excess capacity when dealing with iterm2 image protocol
Using a boxed slice means that we hold exactly the memory required
for the file data, rather than the next-power-of-two, which can
be wasteful when a large number of images are being sent to
the terminal.

This is a API breaking change for termwiz, so bump its version.

refs: #534
2021-03-13 08:10:48 -08:00
Wez Furlong
aceb4933a9 x11: load XCursor.theme based cursors when available
This requires `xcb-util-image-devel` on fedora, not sure about debian
or other systems so far.

refs: #524
2021-03-08 22:00:42 -08:00
Wez Furlong
5e13b9662a cargo update 2021-03-07 23:18:21 -08:00
Wez Furlong
e992ac7ad0 lua: add wezterm.battery_info() function
Queries the system battery information and returns an array of
battery information.

Each element is a lua table with the following entries:

* state_of_charge: expressed as percents
* vendor: the battery manufacturer
* model: the battery model
* serial: the battery serial number
* time_to_full: how long until the battery is full
* time_to_empty: how long until the battery is empty
* state: "Charging", "Discharging", "Empty", "Full", "Unknown"

I haven't run this on a system with a battery yet, so I'm holding
off from showing an example until I've got a work one.

refs: https://github.com/wez/wezterm/issues/500
2021-03-06 14:25:36 -08:00
Wez Furlong
d6daeb0399 cargo update primarily to pick up open 1.5.1 2021-03-03 07:28:35 -08:00
Wez Furlong
ff8bda29e3 lua: add wezterm.strftime
refs: https://github.com/wez/wezterm/issues/500
2021-03-02 09:52:54 -08:00
Wez Furlong
565a4c69d5 lua: add wezterm.format function
The intent is to use this to compose text for a configurable tab bar.

refs: https://github.com/wez/wezterm/issues/500
2021-03-02 09:52:54 -08:00
Wez Furlong
e90e067619 cargo update 2021-03-01 09:02:05 -08:00
Wez Furlong
db08b8c1dc add window:set_config_overrides lua method
This commit expands on the prior commits to introduce the concept
of per-window configuration overrides.

Each TermWindow maintains json compatible object value holding
a map of config key -> config value overrides.

When the window notices that the config has changed, the config
file is loaded, the CLI overrides (if any) are applied, and then
finally the per-window overrides, before attempting to coerce
the resultant lua value into a Config object.

This mechanism has some important constraints:

* Only data can be assigned to the overrides.  Closures or special
  lua userdata object handles are not permitted.  This is because
  the lifetime of those objects is tied to the lua context in which
  they were parsed, which doesn't really exist in the context of
  the window.
* Only simple keys are supported for the per-window overrides.
  That means that trying to override a very specific field of
  a deeply structured value (eg: something like `font_rules[1].italic = false`
  isn't able to be expressed in this scheme.  Instead, you would
  need to assign the entire `font_rules` key.  I don't anticipate
  this being a common desire at this time; if more advance manipulations
  are required, then I have some thoughts on an event where arbitrary
  lua modifications can be applied.

The implementation details are fairly straight-forward, but in testing
the two examplary use cases I noticed that some hangovers from
supporting overrides for a couple of font related options meant that the
window-specific config wasn't being honored.  I've removed the code that
handled those overrides in favor of the newer more general CLI option
override support, and threaded the config through to the font code.

closes: #469
closes: #329
2021-02-27 14:53:19 -08:00
Wez Furlong
2d02df5f38 add --config name=value CLI options
`wezterm`, `wezterm-gui` and `wezterm-mux-server` now all support
a new `--config name=value` CLI option that can be specified
multiple times to supply config overrides.

Since there isn't a simple, direct way to update arbitrary fields
of a struct in Rust (there's no runtime reflection), we do this
work in lua.

The config file returns a config table. Before that is mapped
to the Rust Config type, we have a new phase that takes each
of the `--config` values and applies it to the config table.

For example, you can think of configuration as working like this
if wezterm is started as `wezterm --config foo="bar"`:

```lua
config = load_config_file();
config.foo = "bar";
return config;
```

The `--config name=value` option is split into `name` and `value`
parts.  The name part is literally concatenated with `config` in
the generated lua code, so the name MUST be valid in that context.
The `value` portion is literally inserted verbatim as the rvalue in the
assignment.  Not quoting or other processing is done, which means
that you can (and must!) use the same form that you would use in
the config file for the RHS.  Strings must be quoted.  This allows
you to use more complicated expressions on the right hand side,
such as:

```
wezterm --config 'font=wezterm.font("Fira Code")'
```

The overrides stick for the lifetime of the process; even if
you change the config file and reload, then the value specified
by the override will take precedence.

refs: https://github.com/wez/wezterm/issues/469
refs: https://github.com/wez/wezterm/issues/499
2021-02-27 10:53:45 -08:00
Wez Furlong
ee17e4e174 Add shaper post-processing function
This function is intended to deal with certain kinds of ligatures
and certain combining sequences that don't have corresponding glyphs.

It isn't hooked up to the gui yet, but does have unit tests that
are probably mostly correct.

refs: https://github.com/wez/wezterm/issues/478
2021-02-22 19:17:24 -08:00
Wez Furlong
c84141bf5e cargo update 2021-02-22 00:09:01 -08:00
Wez Furlong
dd70a8a53b introduce freetype_load_flags and freetype_load_target config
In the earlier times wezterm supported different font rasterizers,
and the configuration was a bit vague and generic to accomodate
differences in how the rasterizers worked.

Since then, we've standardized on freetype.

One of the things that's been bothering me for a while is that
we have some fiddly logic to transform from the config to the freetype
flags.

This commit does away with the transformation and simply exposes
the two sets of freetype options.

The main thing that I expect people to play with is
`freetype_load_target` which can have one of the following values:

```
pub enum FreeTypeLoadTarget {
    /// This corresponds to the default hinting algorithm, optimized
    for standard gray-level rendering.
    Normal,
    /// A lighter hinting algorithm for non-monochrome modes. Many
    generated glyphs are more fuzzy but better resemble its original
    shape. A bit like rendering on Mac OS X.  This target implies
    FT_LOAD_FORCE_AUTOHINT.
    Light,
    /// Strong hinting algorithm that should only be used for
    monochrome output. The result is probably unpleasant if the glyph
    is rendered in non-monochrome modes.
    Mono,
    /// A variant of Normal optimized for horizontally decimated LCD displays.
    HorizontalLcd,
    /// A variant of Normal optimized for vertically decimated LCD displays.
    VerticalLcd,
}
```

I expect most people will want to set this to one of `Normal`, `Light`
or `HorizontalLcd`.  `HorizontalLcd` is what `font_antialias=Subpixel`
used to select.

refs: #491
2021-02-20 14:00:38 -08:00
Wez Furlong
3f91e30719 toast: windows: setup own AppUserModelID for our notifications
This is so that our notifications show as coming from wezterm
rather than powershell.
2021-02-17 23:45:52 -08:00
Wez Furlong
a2f891ad1b remove libdbus/libsystem dependency
Replaces notify-rust with directly calling into the zbus crate.
This provides a pure rust interface to DBUS and provides more
flexible control over notification handling.

closes: #485
2021-02-16 22:27:37 -08:00
Wez Furlong
1c85950f97 cargo update 2021-02-15 12:14:00 -08:00
Wez Furlong
578b59ad33 fix one 32-bit build issue
refs: #474
2021-02-12 08:35:00 -08:00
Wez Furlong
a14e3669f2 window: update smithay-client-toolkit
However, I'm not able to create wayland windows any more on my nvidia
system (either with or without this change).

I don't know if this is specific to my nvidia drivers or something else
:-/

refs: https://github.com/wez/wezterm/issues/476
2021-02-12 08:19:51 -08:00
Wez Furlong
fdc7b6e9a1 cargo update 2021-02-07 22:51:28 -08:00
Wez Furlong
d9275e110c deps: update metrics from 0.12 -> 0.14 2021-02-03 23:50:29 -08:00
Wez Furlong
bee88d0732 cargo update 2021-02-03 23:28:23 -08:00