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

1194 Commits

Author SHA1 Message Date
eaglgenes101
4ee16328b8 Changed config option name to mouse_wheel_scrolls_tabs, made it default to true (matching current behavior) 2023-03-21 22:09:14 -07:00
eaglgenes101
8308887d21 Add config option for scrolling the tab bar 2023-03-21 22:09:14 -07:00
Wez Furlong
0b83c97427
keys: avoid scrolling to bottom when CapsLock is pressed
refs: https://github.com/wez/wezterm/issues/3306
2023-03-21 09:17:24 -07:00
Wez Furlong
001a49be4c
minor optimization for single-frame animated formats
Use 1-day duration for the single frame when an animated
format yields only a single frame.
2023-03-20 10:14:17 -07:00
Wez Furlong
829e5c15cf
fix potential deadlock when using wezterm cli split-pane
refs: #1818
2023-03-20 07:44:13 -07:00
Wez Furlong
f5ba73a1a2
add own open_url crate
The upstream open crate keeps making stuff async/blocking/not-working on
windows, so this is a step towards removing this dependency.

refs: https://github.com/wez/wezterm/issues/3288
2023-03-19 12:44:12 -07:00
Wez Furlong
7a6dce3ff0
fix hover state for retro tab bar
Make the math consistent between the hover logic and the render
logic.

refs: https://github.com/wez/wezterm/issues/3113
2023-03-19 09:09:54 -07:00
Wez Furlong
4d471807c3
mouse: don't over invalidate when hovering tabs
refs: #3276
2023-03-19 06:35:17 -07:00
Wez Furlong
4466997b88
clean up blob storage on shutdown
The static OnceCell didn't run destructors, so shift to something
where we can explicitly trigger them to run and clean up the
temporary directory area.
2023-03-18 22:19:46 -07:00
Wez Furlong
344a41f944
use blob leases for decoded animation frames
This allows the decoder thread to live only long enough
to decode the full set of frames; we can then store the
leases in memory and pull them in only when there is
a cache miss.

refs: https://github.com/wez/wezterm/issues/3263
2023-03-18 21:55:57 -07:00
Wez Furlong
7cd0cc21bf
ImageDataType::File -> EncodedLease
Adopt the new blob lease layer to storing and referencing
image files.

This reduces the number of open files needed when
images are being displayed in the terminal.

refs: https://github.com/wez/wezterm/issues/3263
2023-03-18 20:32:49 -07:00
Wez Furlong
203bd10d8e
handle unsupported images better 2023-03-17 13:52:43 -07:00
Wez Furlong
e090eb9eae
Image decoding is now done in a bg thread
Continuing from the previous commit, this shifts:

* In-memory data -> temporary file
* Image decoding -> background thread

The background thread asynchronously decodes frames and
sends them to the render thread via a bounded channel.

While decoding frames, it writes them, uncompressed, to
a scratch file so that when the animation loops, it is
a very cheap operation to rewind and pull that data
from the file, without having to burn CPU to re-decode
the data from the start.

Memory usage is bounded to 4 uncompressed frames while
decoding, then 3 uncompressed frames (triple buffered)
while looping over the rest.

However, disk usage is N uncompressed frames.

refs: https://github.com/wez/wezterm/issues/3263
2023-03-17 11:41:20 -07:00
Wez Furlong
aa929a1a9b
move animation decoding from term layer to gui layer
This makes decoding animation frames a lazy operation, but it
comes at the cost of needing to re-decode the image from scratch
when it loops, because the image crate doesn't provide a way
to rewind its frame iterator.

That initial decode can have a significant time cost; a small
webp file consistently takes 150ms to decode, which is too
much to do inline in the render thread.

Next steps will be to move that cost off the render thread.
2023-03-17 11:41:20 -07:00
Wez Furlong
c093b8861a
rustfmt 2023-03-16 18:13:30 -07:00
Wez Furlong
c2cf376d8f
fix DisableDefaultAssignment not working for CTRL|SHIFT P
refs: https://github.com/wez/wezterm/issues/3262
2023-03-16 18:08:37 -07:00
Wez Furlong
88e53a5f11
apply reloaded config to all panes, regardless of zoom state
refs: https://github.com/wez/wezterm/issues/3259
2023-03-16 09:31:32 -07:00
Wez Furlong
4576f46828
Set minimum animation frame duration to match max_fps
In #3260, the candidate animation had a frame delay of 1ms.  That is
problematic because there is no hope for wezterm running at 60fps (a
frame delay of ~16ms) to render that without dropping frames.

A consequence of such a short frame delay, coupled with the way that
images are carved up into cells, is that individual cells can easily
become visibled de-synchronized from their neighbors and results in what
looks like mpeg artifacts but are really regions where the cells are a
few frames ahead/behind their neighbors.

The solution is to clamp the frame duration up to match the minimum
displayable frame duration as governed by max_fps.

refs: https://github.com/wez/wezterm/issues/3260
2023-03-16 09:06:59 -07:00
Wez Furlong
2bfb29f1be
improve handling of animated webp images
Use mainline image crate to avoid an otherwise unavoidable panic
in the upstream: https://github.com/image-rs/image/issues/1775

Explicitly operate on the frames from the animation.

refs: https://github.com/wez/wezterm/issues/3250
2023-03-15 11:34:47 -07:00
Wez Furlong
4b2973a9d4
deps: open -> 4.0 2023-03-12 20:37:58 -07:00
Wez Furlong
73f50efb7f
ls-fonts: emulate the effect of normalize_output_to_unicode_nfc
This aids in debugging:

```
; wezterm --config normalize_output_to_unicode_nfc=false ls-fonts --text $(echo a$'\u301\u302')
LeftToRight
 0                   x_adv=8  cells=1  glyph=aacute,190  wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
                                      /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
 0 á̂  \u{61}\u{301}\u{302} x_adv=0  cells=0  glyph=uni0302,1646 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
                                      /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
```

```
; ./target/debug/wezterm --config normalize_output_to_unicode_nfc=true ls-fonts --text $(echo a$'\u301\u302')
LeftToRight
 0                   x_adv=8  cells=1  glyph=aacute,190  wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
                                      /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
 0 á̂   \u{e1}\u{302} x_adv=0  cells=0  glyph=uni0302,1646 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"})
                                      /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig
```

refs: #3093
2023-02-11 08:15:08 -07:00
Wez Furlong
51e0c1b393
x11/wayland: restore mouse copying to both clipboard and primary selection
I don't recall changing it to copy to the primary selection only, and
it doesn't feel like it is something I would want anyway, and I think
it generally makes things annoying for all but power users

https://fosstodon.org/@trentskunk@mstdn.social/109808345817367266
2023-02-09 12:56:51 -07:00
Antoine Busch
70d2829b79 palette: add CTRL-p / CTRL-n key bindings to move up/down 2023-02-08 07:13:18 -08:00
Wez Furlong
e5e5ce610e
palette: add full doc and enum name to text to match
refs: https://github.com/wez/wezterm/issues/1485
2023-02-07 15:41:37 -07:00
Wez Furlong
d2905d53b1
defer loading background until after rescaling in config reload
render metrics might be adjusted by the scaling logic, so we
should load the background after resizing.
2023-02-07 09:32:08 -07:00
Wez Furlong
f031acfe43
wgpu: ensure that the srgb format is available before using it
refs: https://github.com/wez/wezterm/issues/3032
2023-02-06 07:40:30 -07:00
Wez Furlong
9945c04e8f
fixup test for nerd font symbol update 2023-02-06 07:23:59 -07:00
Wez Furlong
74dc74b7c8
deps: wgpu -> 0.15
This might help with https://github.com/wez/wezterm/issues/3032
2023-02-06 07:19:31 -07:00
Wez Furlong
2b298f5f96
mux: pass gui window position through from new mux window
Threads through a GuiPosition from mux window creation to allow it to be
used when the corresponding gui window is created.

SpawnCommand now has an optional position field to use for that purpose.

```lua
wezterm.mux.spawn_window {
  position = {
    x = 10,
    y = 300,
    -- Optional origin to use for x and y.
    -- Possible values:
    -- * "ScreenCoordinateSystem" (this is the default)
    -- * "MainScreen" (the primary or main screen)
    -- * "ActiveScreen" (whichever screen hosts the active/focused window)
    -- * {Named="HDMI-1"} - uses a screen by name. See wezterm.gui.screens()
    -- origin = "ScreenCoordinateSystem"
  },
}
```

refs: https://github.com/wez/wezterm/issues/2976
2023-02-05 21:43:37 -07:00
Wez Furlong
d2fd2c6b1a
remove some debug prints
These are no longer needed
2023-02-05 18:00:22 -07:00
Wez Furlong
6968ad5c3c
Add quit_when_all_windows_are_closed config option
refs: https://github.com/wez/wezterm/issues/3057
2023-02-05 16:55:56 -07:00
Italo Cunha
09e82b353a
Add bindings for Home and End in copy_mode (#2762)
* Add bindings for Home and End in copy_mode

* Add Home/End bindings to copymode.md

---------

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2023-02-05 09:20:01 -07:00
Wez Furlong
1609fd386b
add wezterm cli get-text command
closes: https://github.com/wez/wezterm/pull/2729
2023-02-05 09:05:48 -07:00
Wez Furlong
9e3a5ba8fa
cargo fmt 2023-02-05 07:58:31 -07:00
Wez Furlong
d336c8a61e
deps: http_req -> 0.9 2023-02-05 07:38:55 -07:00
gzliew
20c8135fc5 fix(wezterm-gui): Move word able to jump next line 2023-02-05 06:33:57 -08:00
Wez Furlong
691ec187ba
macos: don't include LEADER based key assignments in menubar
refs: https://github.com/wez/wezterm/issues/3021
2023-01-27 15:52:54 -07:00
Wez Furlong
d7145561c2
Add wezterm start --domain DOMAIN --attach + gui-attached event
The motivation here was to remove some similar but not quite the same
logic that existed for starting up when using `wezterm connect`.

Now `wezterm connect DOMAIN` is implemented as `wezterm start --domain
DOMAIN --attach --always-new-process` and a little extra hand-wave to
ensure that the default domain is set correctly.

The startup events have been refactored a bit; a new gui-attached
event is emitted after attaching and starting any default programs
in the selected domain at startup.

That event can be used to maximize windows and so on, if desired.

The gui-attached event is independent of the startup command and fires
for `wezterm connect`, which `gui-startup` did not (and could not) do.
2023-01-26 15:56:11 -07:00
Wez Furlong
6f62a0f2b1
config: capture warnings and show them in config error window
This allows deprecated and invalid fields to be surfaced more visibly
in the config error window.
2023-01-24 14:18:15 -07:00
Wez Furlong
33f25e9ce6
reduce latency when heavily using foreground process info
The tcgetpgrp call appears to have high variance in latency, ranging
from 200-700us on my system.

If you have 10 tabs and mouse over the tab bar, that's around 7ms
spent per frame just figuring out the foreground process; that doesn't
include actually extracting the process executable or current working
directory paths.

This was exacerbated by the mouse move events triggering a tab bar
recompute on every pixel of mouse movement.

This commit takes the following steps to resolve this:

* We now only re-compute the tab bar when the UI item is changed by
  a mouse movement
* A simple single-item cache is now used on unix that allows the caller
  to proceed quickly with stale-but-probably-still-mostly-accurate data
  while queuing up an update to a background thread which can absorb
  the latency.

The result of this is that hovering over several tabs in quick
succession no longer takes a noticeable length of time to render the
hover, but the consequence is that the contents of a given tab may be
stale by 300-400ms.

I think that trade-off is worth while.

We already have a similar trade-off on Windows, although we don't
yet do the updates in a different thread on Windows. Perhaps in
a follow up commit?

refs: https://github.com/wez/wezterm/issues/2991
2023-01-21 15:25:57 -07:00
Wez Furlong
0dc7d92b6c
modals: invalidate window after assignment
On my mac, depending the config, I noticed that modals didn't always
render immediately; force a window invalidation after assigning to
encourage them to do so.
2023-01-20 12:09:07 -07:00
Wez Furlong
59b609f592
window:active_key_table now includes per-pane stacks
refs: https://github.com/wez/wezterm/discussions/2986
2023-01-20 07:03:19 -07:00
Wez Furlong
9a76a54081
add window activation items to palette and menubar
refs: https://github.com/wez/wezterm/issues/2973
2023-01-19 20:54:18 -07:00
gzliew
6164b871d5 chore(wezterm-gui): Create move_to_end_of_word 2023-01-19 19:08:07 -08:00
gzliew
15bb1a87a1 feat(wezterm-gui): Support move to word end 2023-01-19 19:08:07 -08:00
Wez Furlong
c042005ee0
mux: try harder to use default_workspace from config
There were a couple of cases where we didn't look at the config
when deciding on the workspace name.

refs: https://github.com/wez/wezterm/issues/2981
2023-01-19 07:47:27 -07:00
Wez Furlong
b01aa129f7
add WindowOps::focus, ActivateWindow, window:focus()
Only implemented on X11 so far.
Note that Wayland doesn't support this action at all.

refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 22:58:48 -07:00
Niclas Hoyer
962c10330f Use dpi from configuration while resizing 2023-01-18 19:07:43 -08:00
Wez Furlong
7bb6973473
palette: ensure reverse background block spans full width
This makes the command palette look a bit more consistent.

refs: https://github.com/wez/wezterm/issues/1485
2023-01-13 20:31:53 -07:00
Wez Furlong
67ce66a5b9
macos: enable opacity for webgpu
Seems to do the job for me!

refs: https://github.com/wez/wezterm/issues/2952
2023-01-12 22:39:01 -07:00