1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 14:54:16 +03:00
Commit Graph

2191 Commits

Author SHA1 Message Date
Wez Furlong
958ff864f7 config: allow defaulting a couple of fields for key assignments 2020-03-01 07:31:05 -08:00
Wez Furlong
8b9fcd3063 lua: use to_lua_value for wezterm.font
This is now more type-safe and clearer to read.
2020-02-29 22:04:34 -08:00
Wez Furlong
fa01ca59ca lua: add serde-powered to_lua_value function
This will help in implementing lua helper functions for various
config and other structures.
2020-02-29 21:46:59 -08:00
Wez Furlong
a6fb3971c6 fix an issue where config was not reloaded when changed
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.
2020-02-27 22:36:26 -08:00
Wez Furlong
7053021045 make it easier to debug why a given config file is being used 2020-02-27 21:21:13 -08:00
Wez Furlong
0e01929caa mux: try to avoid shuffling tabs on tls connections
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
2020-02-27 20:15:04 -08:00
Wez Furlong
52e4837fe2 lua: add wezterm.hostname() function
This enables host-specific conditional logic in the config file
2020-02-27 08:10:03 -08:00
Wez Furlong
0792f43739 config: increase default output ratelimit
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.
2020-02-27 07:46:04 -08:00
Wez Furlong
7da463f413 lua: add helper for setting fonts
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"),
    },
  },
}
```
2020-02-27 07:39:07 -08:00
Wez Furlong
8cd029ae63 wayland: remove a debug print 2020-02-26 23:21:59 -08:00
Wez Furlong
ab03147bd9 config: we can now read ~/.wezterm.lua
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",
        }}
      },
    },
  },
}
```
2020-02-26 22:11:23 -08:00
Wez Furlong
b46d2f054a mux: unset misc env vars when starting the mux server 2020-02-24 08:24:33 -08:00
Wez Furlong
54047e357a export WEZTERM_CONFIG_DIR and WEZTERM_EXECUTABLE_DIR
To make things more convenient on Windows, export the directories
as well as the file names that we discovered.

refs: https://github.com/wez/wezterm/issues/152
2020-02-24 08:03:59 -08:00
Wez Furlong
9b4ddde908 mux: don't panic the server if the client disconnects
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.
2020-02-23 10:38:46 -08:00
Wez Furlong
65749f06a3 mux: fix poll interval. show update indicator
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
2020-02-23 09:08:04 -08:00
Wez Furlong
c9064c3f90 mux: don't give up tls connection for connrefused
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.
2020-02-22 19:26:25 -08:00
Wez Furlong
4af4ad77b5 split out MouseState/Renderable/ClientTab 2020-02-22 14:54:27 -08:00
Wez Furlong
5a2d2b3163 prepare to break up src/server/tab.rs 2020-02-22 13:07:45 -08:00
Wez Furlong
18294841e9 ssh2: update to 0.8
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.
2020-02-22 08:50:13 -08:00
Wez Furlong
3dea5a59fc termwiz: bump version for publish
heads up to @quark-zju
2020-02-22 07:40:06 -08:00
Wez Furlong
c71004993f vtparse: bump version for publish 2020-02-22 07:32:52 -08:00
Wez Furlong
097092b36d mux: try harder to re-attach to tabs on reconnect
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
2020-02-22 07:29:27 -08:00
Wez Furlong
1ac0358cb8 mux: attempt to reuse tls creds on reconnect
Try to avoid running through the SSH authentication flow if we
previously bootstrapped via SSH and already have a local cert.
2020-02-22 07:14:42 -08:00
Wez Furlong
7e714a5ca1 x11: avoid changing the mouse cursor glyph on each move
@kalgynirae showed me weirdly laggy behavior when moving the mouse
in front of his x11 window.  My suspicion was that this is somehow
related to updating the mouse cursor glyph, and looking at this code
there were two things that might influence this:

* We weren't saving the newly applied cursor value, so we'd create
  a new cursor every time the mouse moved (doh!)
* We'd create a new cursor id each time it changed, and then destroy it
  (which isn't that bad, but if it contributes to lag, maybe it is?)

This commit addresses both of these by making a little cache map
from cursor type to cursor id.

I can't observe a difference on my system, so I wonder if this might
also be partially related to graphics drivers and hardware/software
cursors?
2020-02-21 09:10:13 -08:00
Wez Furlong
ee3156888f tab overlay: allow selecting tab by number 2020-02-21 08:44:35 -08:00
Brendan Cully
95fb9c08ca Cleanup: let structopt parse ssh user/host/port instead of doing it by hand
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.
2020-02-17 21:39:51 -08:00
Wez Furlong
6f8af46def export WEZTERM_EXECUTABLE and WEZTERM_CONFIG_FILE to the env
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
2020-02-16 09:36:31 -08:00
Wez Furlong
bc6cf6eed6 fix typo in some debug 2020-02-16 09:32:22 -08:00
Wez Furlong
7d27499c18
remove build problem section from the bug report template 2020-02-15 20:24:01 -08:00
Wez Furlong
8083d22376 add note about using clink on windows systems 2020-02-15 14:49:11 -08:00
Wez Furlong
ae357ccc31 docs: add info about using OSC 7
refs: https://github.com/wez/wezterm/issues/146
2020-02-15 14:01:05 -08:00
Wez Furlong
89bed12551 ci: point to a version that has node_modules 2020-02-14 15:53:32 -08:00
Wez Furlong
8f81029718 ci: maybe fix some flakeyness 2020-02-14 13:17:28 -08:00
Wez Furlong
2522b276cc fix inverted logic when warning about not finding a font in font_dirs 2020-02-14 12:38:04 -08:00
Wez Furlong
ff210a1c8e tweak font parser/locator to recognize Regular as a sub family 2020-02-14 12:35:42 -08:00
Wez Furlong
0b3f61796a macos: change default font to Andale Mono
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.
2020-02-14 12:12:00 -08:00
Wez Furlong
1357a7f25a Enable timestamps in the logger 2020-02-14 09:46:19 -08:00
Wez Furlong
754f8166b5 Add HideApplication and QuitApplication key assignments
```
[[keys]]
key = "q"
mods = "CMD"
action = "QuitApplication"
```

refs: https://github.com/wez/wezterm/issues/150
2020-02-14 08:49:15 -08:00
Wez Furlong
da6783bbd0 macos: implement Hide function
Hiding a window is implemented as miniaturizing the window, which
is typically shown with an animation of the window moving into the
dock.

This is not the same as the application-wide hide function in macOS;
that function hides the entire app with no animation.  We don't use
that here because our Hide function is defined as a window operation
and not an application operation.

refs: https://github.com/wez/wezterm/issues/150
2020-02-12 22:04:10 -08:00
Wez Furlong
9bce910194 docs: there's no stable centos rpm until we next tag 2020-02-12 19:25:28 -08:00
Wez Furlong
0d352f296c docs: update for centos rpm downloads 2020-02-12 19:20:36 -08:00
Wez Furlong
02ace26e0a macos: Fix an issue with chorded keys in norwegian keymap
fixes: https://github.com/wez/wezterm/issues/151
2020-02-12 18:36:05 -08:00
Wez Furlong
c95215b057 ci: rename <target>pr to just <target> 2020-02-12 13:36:31 -08:00
Wez Furlong
5d2d5222cd ci: forgot to set the release tag for nightly builds 2020-02-12 13:32:05 -08:00
Wez Furlong
ed9d8c9aeb ci: remove old badges from readme 2020-02-12 13:21:57 -08:00
Wez Furlong
d96a942421 ci: black format generate-workflows 2020-02-12 13:20:11 -08:00
Wez Furlong
b6673db39a CI: disambiguate fedora and centos nightly rpms 2020-02-12 13:16:13 -08:00
Wez Furlong
98984ec3a5 CI: take a stab at generating workflows 2020-02-12 13:05:21 -08:00
Wez Furlong
d5f467513a CI: build rpms for centos 7 2020-02-12 08:30:41 -08:00
Wez Furlong
9d668a6a33 cargo update 2020-02-11 07:49:05 -08:00