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

908 Commits

Author SHA1 Message Date
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
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
d41ed68b1a lua: save and restore debug overlay repl history 2022-06-28 17:48:18 -07:00
Wez Furlong
b5518d5cd9 x11: avoid protocol error around DestroyWindow request
This is a bit of an unsatisfactory commit... the bulk of it is
augmenting our calls into XCB to ensure that we check the status of each
request; the idea was that doing so would highlight the source of the
bad drawable error that is being surfaced in #2198, but after doing
that, it still doesn't highlight the offending call.

My conclusion is that either something in MESA/EGL or the IME is
generating calls that we cannot see into and that one of those is
referencing the window id that we just destroyed.

The resolution then is a bit gross: instead of destroying the window
when we need to close it, we first unmap it to remove it from the
screen, then after 2 seconds we destroy it.

refs: https://github.com/wez/wezterm/issues/2198
2022-06-28 08:30:52 -07:00
Wez Furlong
f1c53495e7 lua: add window:mux_window() and pane:mux_window() methods
These allow converting the gui versions of these objects
to the mux versions.

refs: https://github.com/wez/wezterm/issues/225
2022-06-27 20:28:26 -07:00
Wez Furlong
fb1a659c4c fix wezterm connect sshdomain when password auth is needed
We need the mux window builder to notify in order for the ConnectionUI
to show up, but we wouldn't trigger the notify (which happens on drop)
until we'd awaited the connection ui completing password auth.

Force it to drop earlier to unblock.

refs: https://github.com/wez/wezterm/issues/2194
2022-06-27 16:49:05 -07:00
Wez Furlong
a282d07776 mux: add titles to mux window and tab objects
Previously, the mux layer had no internal understanding of titles other
than the Pane::get_title method to return state from a pane.

Users have asked for ways to explicitly set titles on windows and tabs,
so this commit is a step towards that.

The mux window and tab objects now store a title string.

The terminal layer now emits Alert::WindowTitleChanged when the window
title is changed via eg: OSC 0 or OSC 2.

The mux layer will respond to Alert::WindowTitleChanged by resolving the
window that corresponds to the source pane and amending its title.

The MuxWindow and MuxTab objects now provide accessor methods for the
title.

TabInformation (as used by format-tab-title and format-window-title) now
exposes the underlying window_id as well as tab_title and window_title.

The tab title can be changed via the lua MuxTab type, but there is not
currently an escape sequence associated with this.

The defaults for format-tab-title and format-window-title don't
currently consider these new title strings.

refs: https://github.com/wez/wezterm/issues/1598
2022-06-27 12:01:40 -07:00
Wez Furlong
21f1e63218 show-keys: make keys more readable to humans
refs: #2134
2022-06-22 11:33:25 -07:00
Wez Furlong
1b766326fd debug overlay: now supports statements as well as expressions
Previously, trying to do something like `foo = "bar"` in the debug
overlay wouldn't succeed, because we were always trying to wrap
the line inside `return {line}`, which allowed for only expressions
to be used.

Now we also allow a fully formed statement to be used, which means
that that kind of assignment can be performed in the repl, making
it a bit more convenient to try stuff out.

refs: https://github.com/wez/wezterm/issues/1238
2022-06-22 11:16:11 -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
Funami580
6a9056d77c Fix mouse selection including the first character of the next line
ref: #2089

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2022-06-21 14:52:09 -07:00
Benoit de Chezelles
f79ce00b65 Implement line selection for copy mode 2022-06-21 13:43:11 -07:00
Benoit de Chezelles
6767144a09 Update wezterm-gui/src/overlay/copy.rs
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2022-06-21 11:53:37 -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
Funami580
b3e160ff4a Fix scrollbar thumb position for modified minimum thumb sizes 2022-06-20 08:08:53 -07:00
Wez Furlong
347e1fdc46 completions: improve zsh completions for --cwd, --config-file, prog
Make these complete the appropriate type of thing
2022-06-19 16:27:59 -07:00
Wez Furlong
e0616e5eb3 fix AltGr-7 reporting for win32 input mode
We need to carry the RIGHT_ALT modifier flag through to the win32
input mode encoder so that it is correctly handled by both win32
and wsl apps.

Take care to avoid RIGHT_ALT being encoded as ALT for the
non-win32-input-mode case.

refs: https://github.com/wez/wezterm/issues/2127
refs: https://github.com/wez/wezterm/issues/2098
2022-06-18 10:48:07 -07:00
Wez Furlong
66033e4c6d lua api: improve error handling
Don't prevent wezterm from starting up if the gui-startup event
errors out.

Show a toast notification with the error message.

refs: #674
2022-06-18 07:25:05 -07:00
Wez Furlong
699bbce8e2 add gui-startup and mux-startup events
Using the newly exposed-to-lua mux apis, you may now run some lua code
at GUI startup and/or mux startup, just prior to any default windows
being created.

If you happen to spawn any panes as a result of this, wezterm will
skip creating the default program.

```lua
local wezterm = require 'wezterm'
local mux = wezterm.mux

-- This produces a window split horizontally into three equal parts
wezterm.on("gui-startup", function()
  wezterm.log_info("doing gui startup")
  local tab, pane, window = mux.spawn_window{}
  mux.split_pane(pane, {size=0.3})
  mux.split_pane(pane, {size=0.5})
end)

wezterm.on("mux-startup", function()
  wezterm.log_info("doing mux startup")
  local tab, pane, window = mux.spawn_window{}
  mux.split_pane(pane, {size=0.5, direction="Top"})
end)

return {
  unix_domains = {
    {name="unix"}
  },
}
```

refs: #674
refs: #1949
2022-06-17 12:37:19 -07:00
Wez Furlong
e8bb0e03ee add wezterm.mux lua module
The intent is to expose Mux related functions to lua, so `wezterm.mux`
will be that module table.

In order to test this out in the debug overlay, I realized that the
overlay was running functions in a different thread and didn't have
access to the mux, so this commit also tweaks the debug overlay repl to
execute the input in the main thread.

The result is that it is now possible to do
`wezterm.mux.active_workspace()` in the debug overlay to print the
active workspace name.

More functions will follow.

refs: https://github.com/wez/wezterm/issues/225
2022-06-17 07:46:25 -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
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
d85b7bf3b9 win32: add extended/enhanced key concept for win32 input mode
refs: https://github.com/wez/wezterm/issues/2009
refs: https://github.com/microsoft/terminal/issues/13134#issuecomment-1148000328
2022-06-08 07:41:19 -07:00
Wez Furlong
402e5b7382 background: round down fractional pixels when tiling 2022-06-03 09:28:24 -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
f60e39b4c3 gui: speculative fix for #2068
refs: https://github.com/wez/wezterm/issues/2068
2022-06-02 21:06:19 -07:00
Wez Furlong
a0ad3dd378 gui: move ease/interpolation into shader
This is prep for future work where I'll be moving more of the main
monospace rendering into the box model code and factoring out
this aspect of animation.
2022-06-02 07:10:57 -07:00
Wez Furlong
3dfb570162 background: round down fractional y offsets
Otherwise there is a chance that we'll end up with a 1-pixel
transparent gap between tiled textures
2022-06-01 20:44:27 -07:00
Wez Furlong
749db1435d background: avoid allocating empty layers
Only increment the layer index if we allocated any quads into it
2022-06-01 12:07:14 -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
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
3ef533e858 background: respect alpha in background images 2022-05-30 08:51:48 -07:00
Wez Furlong
7738f89381 background: use the actual sprite width
not the width of the full texture
2022-05-30 08:05:26 -07:00
Wez Furlong
303b908f9b fmt 2022-05-30 07:24:13 -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
08d2ec67dc background: refactor where we trigger background painting
moving it so that we have access to the full set of positioned panes
in a subsequent commit.
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
77b2674f6c render multiple backgrounds with alpha
Adjusts the background rendering logic so that we now allocate
a render layer for each defined background layer. This allows
their individual opacity value to multiple and blend together.

As part of this, I noticed that the big jpegs I was using could
take 400ms or more to load, so I added a basic cache to avoid
loading the same image multiple times around a config reload.
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
Wez Furlong
f857ec6a5a deps: structopt -> clap 3 2022-05-28 07:07:52 -07:00
Wez Furlong
c4a248f1a3 mux: split-pane can optionally move an existing pane into the split
This commit allows for the SplitPane internal action to use the
pane id of an existing pane as the source of the pane to be added
in the new split target, rather than spawning a new command.

This can be used to move a pane from one tab to another, and is
analagous to tmux's `join-pane` command.

refs: https://github.com/wez/wezterm/discussions/2043
refs: https://github.com/wez/wezterm/issues/1253
2022-05-27 19:47:12 -07:00
Wez Furlong
8d29631808 gui: fixup config overrides typing
refs: https://github.com/wez/wezterm/issues/2042
2022-05-27 18:41:48 -07:00
Erlend Lind Madsen
c3ea11487c gui: add Linear gradient 2022-05-26 16:45:19 -07:00
Wez Furlong
4e00b24dbf gui: allow layers to be allocated for zindex on the fly
Make the layer allocation more dynamic, which makes it
possible for the box model stuff to allocate a layer based
on the zindex for an element.

Adjust the box model code to cascade the base zindex via
the layer context so that the render stage can select
the correct layer.

This fixes up rendering tabs over the top of the right status
area.
2022-05-26 08:32:55 -07:00