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

399 Commits

Author SHA1 Message Date
Wez Furlong
a1cb7a2a88 dynamic: add validate attribute, validate line_height.
It's now possible to specify a validation function for config
items.

Use that to validate line_height:

```
; ./target/debug/wezterm --config line_height=-1
08:41:10.576  ERROR  wezterm > Error converting lua value from overrides to Config struct: Error processing Config::line_height: Illegal value -1 for line_height; it must be positive and greater than zero!; terminating
```

refs: https://github.com/wez/wezterm/issues/2247
2022-07-12 08:41:42 -07:00
Wez Furlong
aa697c72ba color: refactor docs, add a couple more methods
Moved the gradient function into the color module, but kept an alias
under the old name.

Gradients now return color objects.

Converting colors to string now uses rgba format when alpha is not 100%.
2022-07-12 07:45:08 -07:00
Wez Furlong
7a5440694d add distro-defaults feature
The intent is that when set, it changes defaults to something
more suitable for distributions.

I've also added a readme for distro maintainers.

refs: https://github.com/wez/wezterm/issues/1795
2022-07-10 16:34:43 -07:00
Wez Furlong
5939bacf14 Import terminal.sexy themes 2022-07-10 14:33:31 -07:00
Wez Furlong
e866e9390a colorschemes: expand to include Gogh color schemes
This commit expands the toml file definition to include
metadata for the origin url, author and name.

A new sync utility fills out that metadata when it pulls from the iterm2
color schemes repo.

The utility also pulls down the scheme data json maintained by
the Gogh project: https://gogh-co.github.io/Gogh/ and converts
it to wezterm's format.

About 50% of Gogh overlaps with iterm2; we take the iterm2 versions
of those schemes by default because the iterm2 data has more info
about things like cursor and selection colors.

The sync utility is responsible for compiling the de-duplicated
set of scheme data into a form that is used by wezterm and its
docs.
2022-07-10 13:32:17 -07:00
Wez Furlong
c97e8e564e fonts: allow setting assume_emoji_presentation per font
This allows the user to specify what happens if they have an emoji
font that doesn't match our built-in heuristics.
2022-07-08 21:14:16 -07:00
Wez Furlong
8f44dc46d9 exec_domains: allow async callbacks. can now also set label for launcher
The fixup callback can now by async, which makes it possible to use
other async functions in the callback.

There is an additional parameter to wezterm.exec_domain that allows
setting the label that is shown in the launcher menu.
It accepts either a string value or an async callback function
that can be used to compute the label dynamically.
2022-07-08 18:46:09 -07:00
Wez Furlong
d78cc6edb8 new: exec_domains
An ExecDomain is a variation on WslDomain with the key difference
being that you can control how to map the command that would be
executed.

The idea is that the user can define eg: a domain for a docker
container, or a domain that chooses to run every command in its
own cgroup.

The example below shows a really crappy implementation as a
demonstration:

```
local wezterm = require 'wezterm'

return {
  exec_domains = {
    -- Commands executed in the woot domain have "WOOT" echoed
    -- first and are then run via bash.
    -- `cmd` is a SpawnCommand
    wezterm.exec_domain("woot", function(cmd)
      if cmd.args then
        cmd.args = {
          "bash",
          "-c",
          "echo WOOT && " .. wezterm.shell_join_args(cmd.args)
        }
      end
      -- you must return the SpawnCommand that will be run
      return cmd
    end),
  },
  default_domain = "woot",
}
```

This commit unfortunately does more than should go into a single
commit, but I'm a bit too lazy to wrangle splitting it up.

* Reverts the nil/null stuff from #2177 and makes the
  `ExtendSelectionToMouseCursor` parameter mandatory to dodge
  a whole load of urgh around nil in table values. That is
  necessary because SpawnCommand uses optional fields and the
  userdata proxy was making that a PITA.
* Adds some shell quoting helper functions
* Adds ExecDomain itself, which is really just a way to
  to run a callback to fixup the command that will be run.
  That command is converted to a SpawnCommand for the callback
  to process in lua and return an adjusted version of it,
  then converted back to a command builder for execution.

refs: https://github.com/wez/wezterm/issues/1776
2022-07-07 16:38:14 -07:00
Wez Furlong
f7848cf96d lua: reduce a bit of boilerplate around registering wezterm.submodule 2022-07-06 15:26:21 -07:00
Wez Furlong
741cd37bd4 lua: add window:copy_to_clipboard method
refs: https://github.com/wez/wezterm/issues/2223
2022-07-05 21:59:00 -07:00
Wez Furlong
1e85e79fc7 keys: add ActivateKeyTable::until_unknown=true
This will implicitly pop key table entries if they don't match keys.

refs: https://github.com/wez/wezterm/issues/2178
2022-06-30 07:14:22 -07:00
Wez Furlong
ad42f1d7c4 lua: we now watch require'd files in addition to the main config file
Finally got around to https://github.com/wez/wezterm/discussions/914#discussioncomment-960983
2022-06-29 15:13:37 -07:00
Wez Furlong
d23414105e allow debug overlay to open even if the config file is busted
refs: https://github.com/wez/wezterm/issues/1174
2022-06-29 14:47:45 -07:00
Wez Furlong
eb50c68228 config: allow reloading after config errors detected
This commit adjusts the config loading code so that we can return
information about the paths the should be watched for a subsequent
reload even in the more common error cases.

refs: #1174
2022-06-29 14:34:28 -07:00
Wez Furlong
a10dc25e0c fix colors.indexed in toml file
refs: https://github.com/wez/wezterm/issues/2197
2022-06-28 06:22:31 -07:00
Wez Furlong
80671f29bd add wezterm show-keys command
This prints out the key and mouse assignments

refs: https://github.com/wez/wezterm/issues/2134
2022-06-22 09:14:34 -07:00
Benoit de Chezelles
f79ce00b65 Implement line selection for copy mode 2022-06-21 13:43:11 -07:00
Benoit de Chezelles
097abc4fe8 Implement o & O to move cursor to other end of selection in copy mode 2022-06-21 11:53:37 -07:00
Manolis Stamatogiannakis
bbb78b8845 Updates to documentation for hyperlinks.
- Add regex that captures URLs with IP addresses as hosts.
- Removed redundant non-capturing parentheses from the first regex.
  Mirrored the change to default_hyperlink_rules().
- Switched all but the first example to use literal strings for
  regex (more readable).
2022-06-19 15:35:37 -07:00
Wez Furlong
61510b8393 term: add enable_kitty_keyboard config option
It's been reported that something is funky with nvim, so default
this to false for now until I have time to debug it.

refs: https://github.com/wez/wezterm/issues/1141
2022-06-18 22:44:35 -07:00
Wez Furlong
32fe7106a9 remove x11_focus_change_repaint_delay_ms code
We found the real root of the problem in so we shouldn't need this any
longer

refs: https://github.com/wez/wezterm/issues/1992
refs: https://github.com/wez/wezterm/issues/1628
refs: https://github.com/wez/wezterm/issues/2063
2022-06-18 07:39:56 -07:00
Wez Furlong
297377ae9a rename focus_change_repaint_delay -> x11_focus_change_repaint_delay_ms
and add changelog!

refs: #2111
2022-06-15 20:50:33 -07:00
Patrick Jones
3f01c04911 x11: allow configuration of repaint delay
Adds a configuration option, `focus_change_repaint_delay` to allow customisation of the delay added in 9b6329b454.

The default delay remains 100ms, and can be disabled by setting it to `0`, if the workaround is not required on the user's system.

refs: #2063
refs: #1992
2022-06-15 20:42:26 -07:00
Wez Furlong
df7c09d760 track dpi in mux and terminal model
refs: https://github.com/wez/wezterm/issues/2085
2022-06-15 18:54:51 -07:00
Wez Furlong
62744bf09c exit_behavior = "Close" is now the default
Tired of fielding questions about it :-/

refs: https://github.com/wez/wezterm/issues/2105
2022-06-14 09:48:17 -07:00
Wez Furlong
45a16fa493 make enable_wayland = true the default
refs: https://github.com/wez/wezterm/issues/2104
2022-06-14 09:48:17 -07:00
Wez Furlong
75066cb522 deps: update
Main thing to note here is that the open crate has deprecated
open::that_in_background, but made open::that non-blocking.

I think this is OK, but I'm a little cagey about what will
happen with this on Windows.  We may need to spawn our own
thread for this if things go awry.
2022-06-12 20:17:48 -07:00
Wez Furlong
af815a2e1b fonts: add freetype_pcf_long_family_names option
Freetype has a compile-time feature that, when enabled, rewrites the
font names of PCF fonts to include the foundry and wide status of the
font in order to disambiguate the various versions of fonts all named
"Fixed".

That option is enabled by default in some linux distributions but not
all; it's not enabled in Fedora, for example.

When that feature is enabled it causes problems for the Terminus font as
the PCF version of the fonts are no longer resolvable via the simple
"Terminus" name but via "xos4 Terminus" instead.

wezterm builds its own version of freetype (for consistency and cross
platform support reasons), and is unaware of the choice used by the
distro.

The result of that is that fontconfig may see PCF fonts as having
different font names than how wezterm sees them.

A concrete problem is on such a system, when requesting "xos4 Terminus",
fontconfig will present a match with that name, but when wezterm opens
the font and sees that it has name "Terminus" (because of the difference
in this feature in the freetype libraries in use), wezterm will reject
that match.

This commit enables that option in the freetype library and adds a
wezterm config level option (freetype_pcf_long_family_names) that can be
used to control the underlying pcf font driver configuration.

The upshot of this is that this commit doesn't change any default
behavior, but allows users of those systems to set
`freetype_pcf_long_family_names = true` to turn that behavior on.

My personal opinion on this is that users probably shouldn't use this if
they can avoid it (and PCF fonts in general), and instead install the
OTB version of the Terminus font, which doesn't have this legacy baggage
associated with it!

refs: https://github.com/wez/wezterm/issues/2100
2022-06-09 20:09:47 -07:00
Wez Furlong
b59b51ee2a windows: default allow_win32_input_mode=true
refs: #2098
refs: #2009
refs: #1904
closes: #1509
2022-06-09 07:26:53 -07:00
Wez Furlong
a0e2a805d9 deps: notify -> 5.0.0-pre.15
This allows moving past a number of outdated deps, but importantly,
allows updating miow to a version that has the correct memory layout
for SocketAddr, and satisfies a dependabot alert.
2022-06-07 23:34:58 -07:00
Wez Furlong
35f14ec34c box model: allow for eased colors to be set
I did an ad-hoc test where I set the new tab button background to
an Animated value and saw that it eased in and out.

However, this commit doesn't make anything use this yet.
2022-06-03 06:58:57 -07:00
Wez Furlong
2b083cc131 background: cache computed gradient images
Avoid recomputing on each config change/reload.
2022-06-01 07:29:24 -07:00
Wez Furlong
d9f54a7c41 docs for new background config 2022-05-31 23:20:11 -07:00
Wez Furlong
5f56b96dd2 background: allow repeat to mirror 2022-05-31 21:49:12 -07:00
Wez Furlong
590bcf2f75 background: implement offsets and alignment 2022-05-31 19:39:28 -07:00
Wez Furlong
1360e13f24 background: use Dimension for background size 2022-05-31 12:36:47 -07:00
Wez Furlong
040cd19f88 background: allow specifying the repeat interval
Useful if you want to add smaller items to your background layers
every so often; you can specify the distance between them and make
it independent of the item height.
2022-05-31 12:11:27 -07:00
Wez Furlong
e85258a212 background: allow specifying a solid color layer
The color can have alpha and blend with other layers.
This is helpful if your image has fully transparent portions
and you want to explicitly place a color in there.
2022-05-31 08:47:28 -07:00
Wez Furlong
4cb75c154f background: allow specifying the animation speed for images
The `File` variant for background layers may now be an object
that specifes a speed factor.  That factor is applied to the
animation frame durations in the loaded image, allowing the
playback rate to be adjusted.
2022-05-31 07:32:05 -07:00
Wez Furlong
62532704c2 background: implement attachment scrolling and parallax!
```lua
return {
  background = {
    {
      source = {File="/home/wez/Downloads/grey-bricks.png"},
      -- attachment = "Scroll",
      attachment = {Parallax=0.1},
      hsb = { brightness = 0.3, },
    },
  },
}
```
2022-05-30 07:20:14 -07:00
Wez Furlong
27511c59ef background: implement scaling and repeating options 2022-05-30 07:20:14 -07:00
Wez Furlong
5d44ed6f85 notionally allow multiple background image layers
This adds some types that will enable richer background images.

* Can specify multiple layers
* Each layer can select from image files or gradient definitions
* Layers have additional properties to specify positioning, scaling,
  tiling and whether they scroll with the viewport.

None of the additional properties are hooked up yet.
2022-05-30 07:20:14 -07:00
Erlend Lind Madsen
c3ea11487c gui: add Linear gradient 2022-05-26 16:45:19 -07:00
Wez Furlong
3be4dbc878 pane select: allow bg to have alpha channel
Wraps up the changes from the following diff and allows for the modal
layer (and box model) to use alpha for poly quads.

Change the default background color for pane select to be slightly
transparent.
2022-05-25 23:25:09 -07:00
Wez Furlong
2725559fc0 paneselect: add mode parameter and a mode for swapping panes
Extends the pane selector to allow:

```
wezterm --config 'keys={{key="p", mods="CTRL", action=wezterm.action{PaneSelect={mode="SwapWithActive"}}}}'
```

to swap the active pane with the selected pane.
Similar to https://wezfurlong.org/wezterm/config/lua/keyassignment/RotatePanes.html
except that only the active and the selected panes have their positions
adjusted.

refs: https://github.com/wez/wezterm/issues/1842
refs: https://github.com/wez/wezterm/issues/1975
2022-05-24 22:52:54 -07:00
Wez Furlong
478b0df58b Add wezterm.strftime_utc 2022-05-24 17:24:19 -07:00
Wez Furlong
a5162765e9 config: make wezterm.action more ergonomic
you can try this in the debug overlay repl:

```
> wezterm.action{QuickSelectArgs={}}
{
    "QuickSelectArgs": {},
}
```

```
> wezterm.action.QuickSelectArgs
{
    "QuickSelectArgs": {
        "alphabet": "",
        "label": "",
        "patterns": {},
    },
}
```

```
> wezterm.action.QuickSelectArgs{alphabet="abc"}
{
    "QuickSelectArgs": {
        "alphabet": "abc",
    },
}
```

```
> wezterm.action.QuickSelectArgs{}
{
    "QuickSelectArgs": {},
}
```

```
> wezterm.action.Copy
"Copy"
```

```
> wezterm.action.ActivatePaneByIndex(1)
{
    "ActivatePaneByIndex": 1,
}
```

refs: https://github.com/wez/wezterm/issues/1150
2022-05-23 23:01:18 -07:00
Wez Furlong
5bf736bd21 add PaneSelect key assignment
This is still a bit of a WIP, but this commit:

* Introduces a new "Modal" concept to the GUI layer. The intent is
  that modal intercepts key and mouse events while active, and renders
  over the top of the rest of the normal display.
  I think there might be a couple of cases where key events skirt
  through this, but this is good enough as a first step.
  Also, the render is forced into layer 1 which has some funny side
  effects: if the modal choses to render transparent, it will poke
  a hole in the window because all the rendering happens together:
  there aren't distinct layer compositing passes.

* Add a new PaneSelect action that is implemented as a modal.
  It uses quickselect style alphabet -> pane label generation and
  renders the labels over ~the middle of each pane using an
  enlarged version of the window frame font.  Typing the label
  will activate that pane.  Escape will cancel the modal.

More styling and docs will follow in a later commit.

refs: #1975
2022-05-23 08:16:52 -07:00
Wez Furlong
efb8d14064 config: avoid rebuilding when git index changes
Focus instead on the head and check whether a commit is made.
2022-05-23 08:16:52 -07:00
kumattau
c890c238c1 Add support of IME preedit rendered by system on Windows 2022-05-22 06:02:51 -07:00