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

419 Commits

Author SHA1 Message Date
Wez Furlong
bc083ee470 termwiz: ColorSpec now allows for alpha to be tracked
This doesn't really change any behavior, but adjusts the types
such that CSIs that set colors have the potential to track the
alpha channel and that can make it through to the GUI/render layer.
2022-07-26 19:39:53 -07:00
Wez Furlong
39adbb984d Pane::search: expose range, limit. Limit quickselect by default
The recent work on the scrollback made it easier to constrain the
search region, so expose those parameters to the Pane::search
interface and to the mux protocol.

Use those new parameters to constrain quickselect search to
1000 rows above and below the current viewport by default, and
add a new parameter to QuickSelectArgs that allows overriding that
range.

A follow-up commit could make the search/copy overlay issue a series
of searches in chunks so that it avoids blocking the UI when
searching very large scrollback.

refs: https://github.com/wez/wezterm/pull/1317
2022-07-25 18:31:27 -07:00
Wez Furlong
50d5f94ab0 color schemes: add alias concept
Various color schemes have been duplicated as they have been added to
different scheme collections.  They don't always have identical names
(eg: some remove spaces) and sometimes they have very different names
(eg: _bash vs. nightfox, or Miu vs. Blazer).

We already detected duplicates from different collections but previously
we would omit those dupes.

This commit allows us to track those duplicates by recording their
aliases.

When we write out our data, we only include "interesting" alias names;
those where the name isn't trivially identical.

Some scheme collections (eg: iterm2 color schemes) have duplicates
(eg: zenbones and zenbones_light are identical) and we have previously
shipped with both of those names, so we special case to emit dupes
for which we have prior version information in order to avoid
breaking backwards compatibility for our users.

In the doc generation we can generate links to the aliases if we
included them, but also note about the other names and how we don't
include them.  That is so that someone searching the docs for say
"_bash" can discover that it is actually a duplicate of "nightfox" and
use nightfox instead.
2022-07-20 07:32:46 -07:00
Wez Furlong
ffb6ea76cd sync nightfox color schemes
note that "_bash (Gogh)" is removed by this as it is actually
a duplicate of nightfox but with a different name, according
to my dedup logic.

I may add a way to express aliases as a followup.

refs: https://github.com/EdenEast/nightfox.nvim/pull/184
refs: https://github.com/EdenEast/nightfox.nvim/issues/183
refs: https://github.com/EdenEast/nightfox.nvim/issues/156
2022-07-20 05:40:06 -07:00
Wez Furlong
badfae7d23 gui-startup event now accepts SpawnCommand
This allows the hook to choose how to handle eg: `wezterm start -- top`.
Previously, if you had implemented this event you would essentially lose
the ability to specify a command that you wanted to launch.

refs: https://github.com/wez/wezterm/issues/284
2022-07-19 19:45:27 -07:00
Wez Furlong
77b6870ff3 config: revert taking name from the first comment line of toml color scheme files
I needed this while swinging through to the new color scheme data stuff,
but I don't need it any more, and it causes problems with external toml
files.
2022-07-19 12:02:23 -07:00
Wez Furlong
112feb3374 add MuxTab:set_zoomed and SetPaneZoomState keyassignment
refs: #2284
2022-07-19 05:52:38 -07:00
Wez Furlong
dd327617b1 lua: add wezterm.time.call_after and wezterm.reload_configuration
These allow setting up some basic timers and constructing time-dependent
config files.

Needs to be used respsonsibly!
2022-07-18 07:37:41 -07:00
Wez Furlong
85fb78d788 lua: add wezterm.time and Time object
Includes a method for determining sunrise/sunset.
2022-07-17 11:38:02 -07:00
Wez Furlong
30e2a1a6d1 add Catppuccin color schemes
refs: https://github.com/catppuccin/wezterm/issues/6
refs: https://github.com/wez/wezterm/pull/2221
2022-07-16 06:55:37 -07:00
Wez Furlong
bbd2983bbc schemes: prefer name from metadata when loading toml
refs: https://github.com/catppuccin/wezterm/issues/6
2022-07-16 06:14:18 -07:00
Wez Furlong
3d616ffb3d color scheme: allow exporting schemes that set index colors
refs: https://github.com/catppuccin/wezterm/issues/6
2022-07-15 15:43:35 -07:00
Wez Furlong
8484248010 add wezterm.color.save_scheme for exporting color schemes 2022-07-14 23:22:02 -07:00
Wez Furlong
181401a2ca add lua functions for importing color scheme files 2022-07-14 23:03:18 -07:00
Wez Furlong
e566885e7f colors: move wezterm.get_builtin_color_schemes to wezterm.colors.get_builtin_schemes 2022-07-14 21:52:49 -07:00
Wez Furlong
548adf484b add wezterm.color.get_default_colors 2022-07-14 21:41:39 -07:00
Wez Furlong
f9ab69950a color schemes: add version metadata
Record the version in which we first saw a color scheme.
For schemes from iterm2-color-schemes, we just assume that
we've had them forever as it isn't easy to reverse engineer
that metadata.

Everything else is tagged as 'nightly builds only' and I'll update
that to match the version number in the next release.

Newly discovered items will be added with 'nightly builds only'
from this point onwards.
2022-07-14 08:45:29 -07:00
Wez Furlong
0ce5ddbb13 color schemes: remove : splitting for prefix extraction
Originally I had names like `base 16:foo` but wanted `foo` to
sort with `f` rather than `b`, so this prefix extraction
handled that.

I later changed the names to be `foo (base 16)` so we don't
need this.

This moves the `X::Erosion` scheme to sort under `x` where it
feels more natural.

Ensure that scheme_data.rs has a deterministic sort order that
matches the json data.
2022-07-14 07:40:50 -07:00
Wez Furlong
810512c2c5 colors: refine importer
Adjust importer to read directly from the source .itermcolors
files in the upstream repo.  Extract some author information
from the comments in those files.

All data is now fetched (and cached!) via relatively minimal
http requests rather than requiring a git repo locally.

Also search for .yml files in base16 repos; found another
couple of schemes this way.

The toml files under assets/colors are no longer read by
anything in the repo. I plan to remove them, but since the
docs reference them as examples, I will first ensure that
there are docs and tooling that explains how to write and
share your own scheme files.
2022-07-14 00:14:16 -07:00
Wez Furlong
d4d33369f2 color schemes: import all official base16 schemes 2022-07-12 11:51:19 -07:00
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