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

1431 Commits

Author SHA1 Message Date
Wez Furlong
b7771feef6
imgcat: work better with tmux and conpty
Neither of these understand image protocols, and both are
an additional processing layer between the application and
wezterm.

This commit detects and wraps OSC sequences in tmux's passthru
sequence so that the data is passed on to wezterm rather than
elided from the data stream.

For image protocols in both tmux and conpty, work a little
smarter and explicitly move the cursor position to the same
location that wezterm would move it to.  That prevents the
display from being as mangled by tmux/conpty due to a diverging
understanding of the cursor position.

The logic isn't perfect, and can result in the x-coordinate
being incorrect, and this won't work with the new --position
argument either in its current state, without adding a lot
of complexity to deal with scrolling and relative and absolute
positioning handling.

To facilitate that, a new termwiz Terminal trait method has
been added to probe the terminal name, version, cell and pixel
dimensions. It's not pretty.

refs: https://github.com/wez/wezterm/issues/3624
refs: https://github.com/wez/wezterm/issues/3716
2023-07-15 22:13:19 -07:00
Wez Furlong
31eb4fe271
fix window:perform_action
Accidentally broken by 750f49f0ae

refs: https://github.com/wez/wezterm/issues/3981
2023-07-13 07:37:05 -07:00
Wez Furlong
750f49f0ae
deps: upgrade mlua to 0.9.0-rc.1
refs: https://github.com/khvzak/mlua/issues/291
refs: #3849
2023-07-12 14:14:55 -07:00
Wez Furlong
c7ff432581
mux server: register additional domains
Relocate the helper function to mux-server-impl and have both the GUI
and the mux server call it at the appropriate times.

Introduce default_mux_server_domain which is used instead of
default_domain in the mux server.  This is to avoid recursive
cycles when starting up the mux; we don't want the default
domain to be a unix client that connects to our selves because
we'll try to connect to ourselves, then in act of handling that
spawn in the default domain and try to connect to ourselves and
repeat.

refs: https://github.com/wez/wezterm/issues/3907
2023-07-11 09:34:34 -07:00
Magnus Groß
087e11ebbb Drop duplicate entries from CharSelect menu
Previously the same emoji was able to appear multiple times in the
CharSelect modal for emoji input, because one emoji might have multiple
aliases. In fact, often the aliases have similar names, making it
especially likely that a fuzzy match matches multiple aliases at the
same time.

The same Unicode char may even match multiple times both as
Character::Unicode as well as a Character::Emoji.

To make the deduplication easy, store the results in a hash map instead
of a vector. We use the glyph as the key of the map to get free
deduplication.

Only update the mapped value, if a duplicate entry would improve the
score.

Performance-wise this is pretty much identical to the previous state.
We do see minor performance regression for very large n - granted, this
is expected as we do more work - but the use of the HashMap covers up
for a large part of it.

If the user types more than 3 characters, the performance is absolutely
identical. For less than 3 characters, the performance was unacceptable
anyway (700 ms before this patch, 800 ms after this patch on my system).

Here is a side-by-side comparison for a user iteratively typing the
query "no-evil":

#  Before         After
1  718.361276ms   837.612275ms
2  719.532450ms   816.348394ms
3  349.625101ms   369.726458ms
4  356.349671ms   354.367768ms
5  363.862194ms   361.985546ms
6  372.339582ms   370.022932ms
7  381.123785ms   378.349672ms

In fact, for small n, the hash map seems to perform even slightly better
than the vector.
For large n we need to optimize the performance anyway, as both 700ms
and 800ms are unacceptable.
Thus, this is worth it for the benefit of Unicode symbol deduplication.
2023-07-10 17:16:23 -07:00
Rémi Labeyrie
da2c035ad2 feat: handle horizontal mousewheel events 2023-07-10 12:55:13 -07:00
Wez Furlong
f901dfbf68
deps: tiny-skia -> 0.11 2023-07-09 18:28:48 -07:00
Wez Furlong
96f5c2b562
images: wait for first frame of decoded images
Avoid flickering with the interim black frame but waiting up to 125ms
for the first frame to be decoded.

refs: #3882
2023-07-09 16:29:59 -07:00
Wez Furlong
2334e679a9
launcher: add ctrl-j/k assignments
refs: #3909
2023-06-29 07:59:41 -07:00
Wez Furlong
c1f495099e
deps: fastrand -> 2.0 2023-06-19 10:44:21 -07:00
Wez Furlong
c1147720bc
remove old paste chunking logic
I believe that this was obsoleted long ago by the ThreadedWriter
logic that is present in the terminal implementation so we no
longer need to limit the write chunk size.

refs: #3683
2023-05-29 15:10:57 -07:00
Wez Furlong
853fb00302
even more fallout from Nerd Font symbols breaking changes in 3.0 2023-05-29 14:15:00 -07:00
Wez Furlong
7e2b7ca84d
deps: update tiny-skia
closes: https://github.com/wez/wezterm/pull/3794
2023-05-28 20:18:00 -07:00
Ye Sijun
95ab807aab add color config for char select
Signed-off-by: Ye Sijun <junnplus@gmail.com>
2023-05-28 09:01:22 -07:00
Wez Furlong
9b31092e1d
fix fallback scaling for background images
We weren't redrawing the background image with the scale factor
that we'd computed when noticing that we had run out of texture space.

refs: #3773
2023-05-27 14:06:18 -07:00
Wez Furlong
6b21e6ffde
fixup tests for symbols font changes 2023-05-21 10:07:07 -07:00
Wez Furlong
098e0e0201
fix CopyMode(EditPattern) not activating search_mode key table
refs: #3746
2023-05-21 10:04:56 -07:00
Wez Furlong
281e0e1737
windows: fix overlay/modal shortcuts
Arrow keys have ENHANCED_KEY set in the mods, and shifted keys had
positional mods in things like quickselect.

Strip them out.

I think I got all the cases, but it's possible that one slipped
through.

refs: https://github.com/wez/wezterm/issues/3617
2023-05-20 20:00:24 -07:00
Wez Furlong
e41c4405c7
palette: avoid spurious warning when opening command palette
If you haven't registered an augment-command-palette event,
you'd see:

```
16:29:02.641 WARN wezterm_gui::termwindow::palette >
augment-command-palette: error converting Lua nil to Rust Type (Cannot
convert `Null` to `Vec`)
```

refs: https://github.com/wez/wezterm/issues/3595
2023-05-20 19:54:24 -07:00
Wez Furlong
4ae176dd8a
try scaling down images that don't fit in the texture atlas
When trying to display a 4k image there is a high chance that
we'll run out of texture space and then render with no images
displayed.

This commit changes the binary yes/no allow-images into a a series
of attempts: display at natural size, scale down by 2, 4, then 8,
then give up on images.

While looking at this, I noticed that we had a TOCTOU in the blob lease
stuff in the case where we might very quickly try the handle the same
image in succession, and end up deleting a file out from under a live
lease.

I've put in place a simple bandaid for that, but it's probably worth
revisiting the concurrency model for that.
2023-05-19 08:57:38 -07:00
Wez Furlong
134bf0a74d
fix decoding of grayscale pngs
refs: #3742
2023-05-19 06:31:33 -07:00
Wez Furlong
bdb173f18f
webgpu: avoid panic when we try to exceed max texture size
This echoes equivalent logic we have for EGL; what happens when
this triggers is that we'll retry rendering with images disabled.

refs: #3713
2023-05-13 07:36:21 -07:00
Wez Furlong
6d8e266698
fixup setting background layer(s) to solid colors
This is a regression caused by recent work such as 27fbff4ae1

This config wouldn't set the background color to red because we'd never
consider the frame to be loaded:

```lua
local wezterm = require 'wezterm'

local config = wezterm.config_builder()

config.background = {
  { source = { Color = '#FF0000' }, width = '100%', height = '100%' },
}

return config
```
2023-05-10 06:29:45 -07:00
Wez Furlong
349ce3cf3c
webgpu: allow using Gl backend
This works for me on my radeon drivers.

It undoes a bail out that I added as part of 3565.

I'm not sure how best to handle the broken virtualbox driver situation
at this time.

refs: https://github.com/wez/wezterm/issues/3691
refs: https://github.com/wez/wezterm/issues/3565
2023-05-07 10:34:59 -07:00
Wez Furlong
27fbff4ae1
show terminal background while waiting for background image to load
Avoid a "flash" of a single black but likely overly stretched and
awkwardly interpolated frame while we wait for big/animated/complex
images to load and decode.

For corrupt images, or images with an incorrect or typo'd filename in
the config, this prevents us from punting and just showing a transparent
background instead of something reasonable.
2023-05-07 09:16:44 -07:00
Wez Furlong
989bd6ce77
cargo update 2023-05-01 08:36:25 -07:00
Wez Furlong
9bc7de70ea
fix image display in wezterm ssh
Move the blob lease init into the common code, rather than just
the bit that runs for the regular gui init.

refs: #3624
2023-04-27 06:35:11 -07:00
Wez Furlong
6686adba04
fix panic with corrupt webp file
There were a couple of layers of issue here:

* In the ImageDataType::decode method, we didn't detect and do something
  reasonable when the decoded image had 0 frames, later leading to
  a panic in glyphcache when trying to index frame 0 of an empty vec.
* We shouldn't have been using ImageDataType::decode for window
  background images
* Make the fallback/placeholder black rather than fully transparent
  in the more modern decoder thread routine that we use for image
  decoding at the gui layer.

refs: #3614
2023-04-25 08:39:42 -07:00
Wez Furlong
dc2cd706dc
macos: remove about dialog
Replace it with a menu item that shows the version number, and
that you can click to copy the version number.

closes: https://github.com/wez/wezterm/issues/3507
2023-04-24 11:08:18 -07:00
Wez Furlong
26090da81e
deps: tiny-skia -> 0.9 2023-04-24 09:13:44 -07:00
Wez Furlong
5c2e3fe809
wgpu: better approach than 38dd3045a3
Attempting to run when SURFACE_VIEW_FORMATS isn't successful,
so the alternative approach is to more gracefully report the
error.

refs: https://github.com/wez/wezterm/issues/3565
2023-04-23 17:48:40 -07:00
Wez Furlong
9ec7973326
webgpu: allow using pre-multiplied alpha if available
We prefer post-multipled, but if the implementation doesn't
support that, pretend that we are pre-multiplied.

refs: https://github.com/wez/wezterm/issues/3589
2023-04-23 14:19:57 -07:00
Wez Furlong
f8bafc3c67
palette: add augment-command-palette event
This allows the user to add entries to the command palette without
having to define dummy key assignments for them.

refs: https://github.com/wez/wezterm/issues/3595
2023-04-23 09:39:16 -07:00
Wez Furlong
70d809fa88
un-zoom/re-zoom around PaneSelect
refs: https://github.com/wez/wezterm/issues/3573
2023-04-20 21:52:09 -07:00
Wez Furlong
8c975a7681
keys: don't hide mouse cursor when pressing only modifier keys
Further constrain the hiding logic for key-down events, so that
we are less likely to hide for things ctrl-shift-c when the user
is mousing around and copy/pasting.

Also, consider CapsLock to be a modifier for this and other
similar purposes.

refs: #3570
refs: #3306
2023-04-20 07:53:20 -07:00
Wez Furlong
38dd3045a3
webgpu: attempt to run on non-comformant devices
refs: https://github.com/wez/wezterm/issues/3565
2023-04-19 23:22:43 -07:00
Wez Furlong
d5eee1817a
deps: upgrade wgpu 0.15 -> 0.16 2023-04-19 21:48:13 -07:00
Wez Furlong
68928178ed
rustfmt 2023-04-18 15:05:05 -07:00
Josiah Outram Halstead
588ce8013f Add custom eighth block corner glyphs 2023-04-18 15:04:47 -07:00
Wez Furlong
0a47f8ea76
remove transitive dep on time 0.1
chrono still is pulling this in for some reason. Super frustrating.

refs: https://github.com/chronotope/chrono/issues/602
2023-04-18 13:53:59 -07:00
Wez Furlong
44eccffe0c
macos: fix font size issue when spawning on external monitor
The main part of the problem is that NSWindow::isZoomed lies to us
sometimes.

This is a relatively gross workaround.

Add missing invalidation after setting the content size; that prevents
janky when dragging the window between monitors.
Removed some redundant Dimensions computation from that method; nothing
ever read it.

refs: https://github.com/wez/wezterm/issues/3503
2023-04-18 10:35:58 -07:00
Wez Furlong
87cd9c5f6c
adjust_window_size_when_changing_font_size now considers tiling WMs
It's a little limited in the scope of its detection: we have a built-in
list of tiling WM environments and if the current one is on the list
then we set an appropriate value for this option.

The list currently has just a single entry.
2023-04-17 21:58:08 -07:00
Wez Furlong
bcac0bfa8f
debug overlay: OpenGL version -> WebGpu for webgpu
Don't prefix the renderer info with OpenGL.
Make the per-renderer include that prefix.
2023-04-17 18:09:01 -07:00
Wez Furlong
075388fbe5
add window:keyboard_modifiers() method 2023-04-16 19:53:32 -07:00
Wez Furlong
7aa611f4cb
windows: fix linger wezterm-gui when closing with overlay active
refs: #3522
2023-04-16 12:23:00 -07:00
Wez Furlong
f627d6d704
windows: improve hit test for integrated max button
refs: https://github.com/wez/wezterm/issues/3499

but isn't the cause of it
2023-04-16 11:37:58 -07:00
Wez Furlong
4ba653c716
fix width of format-tab-title that returns embedded escapes
closes: #3481
2023-04-16 08:28:35 -07:00
Wez Furlong
8435a12e12
rustfmt 2023-04-16 06:57:28 -07:00
Wez Furlong
6ec11393d5
fix decoding png images without an alpha channel
refs: #3529
2023-04-15 23:59:02 -07:00
Wez Furlong
8d0b84a5ce
glyphcache: add some more error context 2023-04-15 23:33:50 -07:00
Wez Furlong
8c931dcbcb
paint: add some error context
The error described in https://github.com/wez/wezterm/discussions/3527
is missing context, so add a bit more.
2023-04-15 23:15:53 -07:00
Wez Furlong
3c40846d95
keyboard: move led status to separate enum 2023-04-15 14:52:54 -07:00
Wez Furlong
08972faff2
user-var-changed event should only trigger in the containing window
refs: https://github.com/wez/wezterm/issues/3524
2023-04-15 11:33:01 -07:00
Wez Furlong
7d66bc761d
termwiz::Modifiers is now wezterm_input_types::Modifiers 2023-04-13 14:18:13 -07:00
Wez Furlong
9b1321fac1
try again with squashing out caps+numlock
refs: https://github.com/wez/wezterm/issues/3514
2023-04-13 09:01:50 -07:00
Wez Furlong
0abc28dae0
fix numlock and capslock interfering with mouse assignments
refs: https://github.com/wez/wezterm/issues/3514

follow up from eaab3d08ae
2023-04-13 07:41:27 -07:00
Wez Furlong
eaab3d08ae
x11/wayland: unbreak key bindings when capslock or numlock are active
Treat these similarly to positional key modifiers, but handle them
centrally to avoid broader issues with eg: interpreting ESC in
the command palette.
2023-04-10 10:04:19 -07:00
Wez Furlong
e241ea58be
kitty keeb: move encoding logic to wezterm-input-types
We need access to the underlying raw/physical key in order
to correctly encode in some modes, so we need the full KeyEvent
struct for that.

Move the encoder up so it sits alongside the win32 input mode
encoder.

This should give us better results for both shifted/unshifted
and the "base layout" (US english) representations of a number
of keys.

Note that this is still not 100% technically correct: the unshifted
keys require knowledge of the keyboard layout that we don't have
at this OS-independent layer.

Right now we're assuming a US layout to unshift punctuation, which
is not right if you're not using that layout.  To resolve that,
more work is needed on each OS to be able to extract that information
and then to store it in the KeyEvent.

refs: https://github.com/wez/wezterm/issues/3479
refs: https://github.com/wez/wezterm/issues/2546
2023-04-10 08:54:03 -07:00
Wez Furlong
f4995511e2
keyboard: improve support for numpad buttons
We were missing encoding of these for the base xterm encoding
(I haven't daily driven a keyboard with a numpad in over 10 years!).

Improve mapping for the kitty protocol.

refs: https://github.com/wez/wezterm/issues/3478
2023-04-09 12:28:30 -07:00
Wez Furlong
2dcf7ad98d
keyboard: plumb more modifier+state information through
This commit teaches the termwiz layer about positional modifiers,
and expands our modifier concept to also pass through led states
such as caps lock and num lock.

Those aren't actually keyboard modifiers, but the state is useful
to recognize.

Adjust the shift key normalization so that we don't uppercase
alpha characters when both SHIFT and CAPS_LOCK are held.
This processing will remove both SHIFT and CAPS_LOCK in that
situation.

Add a method to KeyEvent that will undo the OS keyboard layer
normalization of positional to generic modifier key presses.
eg: the OS may map LeftControl -> Control, but we actually
prefer to have LeftControl so if we can unambiguously reverse
that mapping, we do so.

refs: #3476
refs: #3475
2023-04-09 10:34:53 -07:00
Wez Furlong
b9b0f36692
fix OS keymapping issue with modals
Need to defer to the second pass (when we have mapped from physical
keys) before we route the key event to the modal.

refs: https://github.com/wez/wezterm/issues/3470
2023-04-08 15:31:48 -07:00
Wez Furlong
62256c80b4
config: defer evaluating default wsl domains
The stack trace in https://github.com/wez/wezterm/issues/3425
shows a recursive borrow triggered indirectly by spawning
a subprocess and having that trigger the wndproc.

This commit doesn't really fix the recursive problem, but may
sidestep it, and it's probably best to avoid always running
the `wsl` command to get this list anyway, similar to the
change in 25255d90d6

refs: https://github.com/wez/wezterm/issues/3425
2023-04-08 08:51:47 -07:00
Wez Furlong
b1c58bad39
Make background painting more consistent when window is transparent
These conditions were from the earliest days of panes and aren't
needed any more, especially because they make it hard to have
consistent behavior!

refs: https://github.com/wez/wezterm/issues/3450
2023-04-06 19:55:55 -07:00
Wez Furlong
0ca050e09d
expose the tty name associated with a pane 2023-04-06 17:13:07 -07:00
Wez Furlong
760864b6b2
quick select: make user patterns take precedence
I think the future for this is to extend the Pattern type to accept
a list of regexes and use a RegexSet to unambiguously handle multiple
patterns with captures.

That might help a little with https://github.com/wez/wezterm/issues/3247
but the stated use in that issue may not even work with the rust
regex crate.

For now we do the simple thing and match the user's patterns
first.

refs: https://github.com/wez/wezterm/issues/3456
2023-04-06 15:52:52 -07:00
Wez Furlong
e3e9821c4d
Add InputSelector action
Allows prompting the user to select from a list and then
triggering some action on the selected item.

This is the guts of the launcher menu hooked up to user-supplied
arbitrary entries.
2023-04-05 17:22:09 -07:00
Wez Furlong
153497d01d
admit defeat to intel shader weirdness
I dug out my pixelbook which has intel graphics and runs linux
to try to make sense of this issue, but I'm baffled.
It doesn't appear to NaN going in, but we end up with something
weird happening if we don't fixup the alpha.

Relevant entry to the discussion/background on this is:
https://github.com/wez/wezterm/issues/1180#issuecomment-1496102764

I don't think it's worth sweating over this, so let's just suck it
up.

refs: https://github.com/wez/wezterm/issues/1180
2023-04-05 15:07:22 -07:00
Wez Furlong
37e8a5041f
refine charselect move logic per comments on #3449 2023-04-05 08:45:02 -07:00
Chris
6354f01327
character select pgup/down, less jerky navigation, selected centered in list (#3449)
* character select pgup/down support for bigger jumps

* fix jerky selected_row clamping, keeps selected center offset

* die dead code

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* thx silly rustisms

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* charselect movements now spcified by amount, or 0 which does full pgsz

* rustfmt

---------

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2023-04-05 08:41:30 -07:00
Wez Furlong
336fefb52f
Add PromptInputLine and examples of (re)naming tabs/workspaces
refs: https://github.com/wez/wezterm/issues/522
refs: https://github.com/wez/wezterm/issues/1598
2023-04-04 21:11:08 -07:00
Wez Furlong
d3492b27c6
fix: 'wezterm connect --workspace foo dom' part 2
In the spawn initial mux case, we didn't verify that the mux
had no windows with the requested workspace, so we'd start up
with just the default session spawned by the mux when it starts
up.

This commit tries a bit harder to confirm that there is matching
domain/workspace combo before deciding that it is sufficient.

refs: #2734
2023-04-03 08:10:47 -07:00
Wez Furlong
718397d054
render: ensure alt color and mix are well-defined for poly quads
Potentially the root cause of the gnome-style button alpha issue

https://github.com/wez/wezterm/issues/1180#issuecomment-1493818652
a278dbf43f

refs: #1180
2023-04-03 07:47:02 -07:00
Wez Furlong
3dc2ac0a75
fix wezterm connect --workspace
When creating the initial window, we didn't pass through the
provided workspace name.

refs: #2734
2023-04-02 14:04:20 -07:00
Wez Furlong
7735602bfa
suppress dead code warning for locate_app_wide_key_assignment
It is used, just not currently on all platforms, and I want to
compile and verify it on linux which I use most often.
2023-04-02 13:36:13 -07:00
Wez Furlong
25255d90d6
config: lazyily produce ssh domain list
I noticed that in debug builds, `wezterm set-working-directory` had
high/variable latency, and I traced part of it to the ssh config parsing
logic.

Make that lazily evaluate the ssh config.

refs: #3402
2023-04-02 10:34:46 -07:00
Wez Furlong
741570563d
add wezterm cli rename-workspace
refs: #2787
2023-04-02 07:37:45 -07:00
Wez Furlong
ee68e31bbd
tab navigator: use tab title > pane title if set
refs: #1598
refs: #522
2023-04-01 21:52:46 -07:00
Wez Furlong
dd7d22ed6b
mux: propagate tab and window title when it changes
refs: #1598
2023-04-01 21:31:37 -07:00
Wez Furlong
ac3e2307d2
default format-tab-title now respects tab:set_title
Finally getting around to wrapping this up; previously you had
to define your own format-tab-title event handler if you wanted
to show the title that you had set via `tab:set_title`.

Now, if that string is not empty, it will be used instead of
the title string from the active pane.

refs: #1598
2023-04-01 20:06:18 -07:00
Wez Furlong
ea28fb891a
add window:active_tab(), window:active_pane(), tab:active_pane() 2023-04-01 19:46:15 -07:00
Wez Furlong
ed67d0449a
refactor: remove opengl and OpenGL from names
It's not opengl specific any more and those names are overly
long and slightly misleading, so fix them up.
2023-04-01 07:06:26 -07:00
Wez Furlong
aa51468e28
refactor: tidy up window_buttons a little 2023-04-01 06:56:37 -07:00
Wez Furlong
5838b2c98b
refactor: split render.rs into smaller modules 2023-04-01 06:47:27 -07:00
Wez Furlong
edb6aa38f2
integrated buttons: tweak gnome button logic
The pixel sizes are too tiny on my retina mac display, so I wanted
to make them larger. I noticed that the background color was transparent
which resulted in the appearance of a cross behind the button; that's
due to the way that the rounded corners are applied, so we need to
explicitly fill the background with the same color.

Refactor to make changing the size in the future a DRY operation,
but I left the size as-is because it needs more finesse and
I want to come back to that tomorrow.
2023-03-31 23:49:17 -07:00
Wez Furlong
2168709836
minor tidy up of hover handling for maximize button
Remove an unsafe global variable and replace with a member variable
that works similarly to the drag tracking.

Doing this from a mac... may not compile on a windows box!
2023-03-31 23:10:12 -07:00
Wez Furlong
ba34f9608e
rename PushOval -> Oval 2023-03-31 23:10:11 -07:00
Wez Furlong
0a4932cf29
tab bar: fixup placement of macos native titlebar buttons 2023-03-31 22:47:40 -07:00
Wez Furlong
a278dbf43f
remove redundant mix operation from shader
The o_fg_color_mix alpha should already be in range and we
shouldn't need to alter it here.
2023-03-31 21:56:01 -07:00
Wez Furlong
706db2650d
avoid bespoke lightness calc, reuse hsl function 2023-03-31 21:47:12 -07:00
Wez Furlong
422ae51577
allow using Gnome and Windows styles on macos.
Rename macos to MacOsNative to make its intended purpose clearer
2023-03-31 20:35:26 -07:00
Wez Furlong
5b5ae93052
remove some macos conditional compilation
Prefer to configure based on runtime config
2023-03-31 20:23:20 -07:00
YuraIz
6b2137de0b
integrated-title-bar: Add Native button style parameter 2023-03-31 19:59:03 -07:00
YuraIz
ab52277393
integrated-title-bar: Replace window button recoloring
also change shape of rounded corners to ovals
2023-03-31 19:59:01 -07:00
YuraIz
bcd1b03569
integrated-title-bar: Use snap layouts for any maximize button 2023-03-31 19:55:13 -07:00
YuraIz
eab21a669d
integrated-title-bar: Improve windows support 2023-03-31 19:53:45 -07:00
YuraIz
01aeb506c0
integrated-title-bar: Update config options
and rename the "FANCY" option to "INTEGRATED_BUTTONS"
2023-03-31 19:51:46 -07:00
YuraIz
c553646ea4
integrated-title-bar: Remove commented line 2023-03-31 19:45:28 -07:00
YuraIz
baebf907f6
integrated-title-bar: Remove macos button style
macos uses native buttons
2023-03-31 19:45:28 -07:00
Yuri Izmer
e354791c34
integrated-title-bar: Add macOS support 2023-03-31 19:45:28 -07:00
YuraIz
7d79933d28
integrated-title-bar: Ignore style config on macos and windows 2023-03-31 19:45:28 -07:00
YuraIz
6c40c2397e
integrated-title-bar: Add button style option 2023-03-31 19:45:28 -07:00
YuraIz
d39bccca10
integrated-title-bar: Add option to remove useless buttons 2023-03-31 19:45:28 -07:00
YuraIz
2333046e1b
integrated-title-bar: Add button placement option 2023-03-31 19:45:26 -07:00
YuraIz
0401dc26d6
integrated-title-bar: Add libadwaita styled buttons 2023-03-31 19:44:20 -07:00
YuraIz
2cd325fecd
integrated-title-bar: Add initial shape for macos buttons 2023-03-31 19:44:19 -07:00
YuraIz
29fe4709ce
integrated-title-bar: Add color configuration 2023-03-31 19:44:19 -07:00
YuraIz
93308317d7
integrated-title-bar: Add windows support 2023-03-31 19:44:19 -07:00
YuraIz
36f41af81e
integrated-title-bar: Add window buttons to the tabbar 2023-03-31 19:44:13 -07:00
Wez Furlong
76060b7cc2
win:perform_action now works with Copy Mode and other overlays
refs: #3209
2023-03-30 19:46:02 -07:00
Wez Furlong
4a555be7d9
gui: win:perform_action now awaits the underlying perform_key_assignment
This should help a bit with https://github.com/wez/wezterm/issues/3405
even though there is a better solution for the scenario mentioned there.
2023-03-30 19:31:40 -07:00
Wez Furlong
29d10946aa
surface config errors when running wezterm connect
Broken config could cause the gui to exit before it would normally
print the config warnings and errors, making it harder to understand
what is going on.

This commit bundles the config error text together with whatever
caused it to error out in the fatal error case.
2023-03-30 16:19:25 -07:00
Wez Furlong
2c9fd0ef6c
serial: fix some FIXMEs
Now that we have a more regular domain-shaped serial thingy,
refactor the `wezterm serial` command to re-use the common
gui setup and running logic.  This removes some FIXMEs from
around the wonky setup of the domain, which is nice.
2023-03-29 19:34:10 -07:00
Wez Furlong
1e688a5128
Add serial_ports config
This commit teaches the config about SerialDomains, and the mux
layer about constructing a SerialDomain, then changes the GUI
layer to use those pieces to set up `wezterm serial`.

A new `serial_ports` config is added, and the GUI layer knows how
to apply it to the set of domains in the mux.

The result of this is that you can now define a domain for each
serial port and spawn a serial connection into a new tab or window
in your running wezterm gui instance.
2023-03-29 19:05:13 -07:00
Wez Furlong
a7fde7935b
raise ulimit nofile and nproc to a reasonable min value on unix systems
It's a tremendous PITA for the user to do this at the system level on a
mac, where it is sorely needed.  This commit allows raising to a desired
minimum level, but won't decrease from an already larger soft limit.

refs: https://github.com/wez/wezterm/discussions/3353
2023-03-28 07:29:47 -07:00
Wez Furlong
fa50a065d7
fix stray debug 2023-03-27 21:18:43 -07:00
Wez Furlong
8ea49ab69f
fix overflowing sub assertion in debug mode 2023-03-27 19:24:30 -07:00
Wez Furlong
59503034c7
tidy up some debug logging 2023-03-25 20:33:23 -07:00
Wez Furlong
8dd365d4c5
mux: fix some dpi and pixel size issues
Three issues:

* The initial connect would leave the dpi assigned to 0, resulting
  in incorrect scaling when using imgcat until the window was resized
  and the correct dpi was passed up.
* On resize, we'd only compare the row/col count and not notice changes
  in pixel dimensions/dpi
* On the server side, when processing a resize and recomputing
  the tab size, we would omit the pixel dimensions and leave
  the resulting tabs and panes with 0 dimensions, breaking imgcat
  because it thought the window was 0x0.

refs: https://github.com/wez/wezterm/issues/3366
2023-03-25 20:24:57 -07:00
Wez Furlong
d491c736ef
When a modal is active, it gets first dibs on key processing
This fixes a surprising interaction between copy mode and the
command palette, but is also the root cause of another issue
with CharSelect mode.

refs: https://github.com/wez/wezterm/issues/2947
2023-03-25 18:32:38 -07:00
Wez Furlong
500934bc9c
palette: exclude copy mode actions unless copy mode is active 2023-03-25 18:10:00 -07:00
Wez Furlong
1c55ca14b0
macos: invalidate window when dispatching from menubar
refs: https://github.com/wez/wezterm/issues/3365
2023-03-25 13:47:54 -07:00
Wez Furlong
c3b265b8c4
fmt 2023-03-25 13:30:15 -07:00
Wez Furlong
133faf8305
Add new-tab-button-click event
refs: #323
refs: https://github.com/wez/wezterm/discussions/3364
2023-03-25 13:26:16 -07:00
Wez Furlong
ca283c1310
palette: prioritize platform-appropriate shortcuts
On macOS prefer CMD, but on other platform prioritize shortcuts
that don't use CMD, as those tend to reserve the CMD based shortcuts
for the system.

Allow specifying how many shortcuts to show if an action has
multiple assignments.  The default is 1.

refs: https://github.com/wez/wezterm/issues/3335
2023-03-25 11:14:54 -07:00
Wez Furlong
c7e4c7fcd0
palette: refactor slightly
Avoids emitting blank padding for rows that have no key assignments
2023-03-25 10:47:50 -07:00
Wez Furlong
c5213b4f85
palette: add config for how ui key caps render
added a new `ui_key_cap_rendering` option that accepts the following
values:

```lua
-- Super, Meta, Ctrl, Shift
config.ui_key_cap_rendering = 'UnixLong'

-- Super, M, C, S
config.ui_key_cap_rendering = 'Emacs'

-- Apple macOS style symbols
config.ui_key_cap_rendering = 'AppleSymbols'

-- Win, Alt, Ctrl, Shift
config.ui_key_cap_rendering = 'WindowsLong'

-- Like WindowsLong, but using a logo for the Win key
config.ui_key_cap_rendering = 'WindowsSymbols'
```

refs: https://github.com/wez/wezterm/issues/3335
2023-03-25 09:18:52 -07:00
Wez Furlong
1531dd8471
update tests for updated JetBrainsMono 2023-03-25 07:21:36 -07:00
Wez Furlong
d60cdbf74e
palette: show key assignment alongside entries
For items in the main set of key assignments, show the keyboard
shortcut to the right.

Some items have multiple key assignments; we show only the first
one. We'll probably want to be a bit smarter. For instance,
both linux and windows tend to occupy the Windows/Super key
assignments, so we should probably prioritize showing the Ctrl+Shift
variants on those platforms.

refs: https://github.com/wez/wezterm/issues/3335
2023-03-24 23:34:49 -07:00
Wez Furlong
499e5f73d0
palette: show the label from the command in the palette
Given an assignment like this:

```
{
  key = "b",
  mods = "ALT",
  action = wezterm.action.SplitPane {
    direction = 'Right',
    command = {
      label = 'Bash Right',
      args = {'/usr/bin/bash' }
    }
  }
}
```

we should show the label from the command in the palette.
That's what this commit enables.

If there is no label, but the arguments are set, then the
arguments will be shown instead.

refs: #3252
2023-03-24 21:05:14 -07:00
Wez Furlong
604ef152be
add wezterm cli activate-pane, wezterm cli activate-tab
refs: #3352
refs: https://github.com/wez/wezterm/issues/886
2023-03-24 17:32:55 -07:00
Wez Furlong
622ea1add8
mux: notify clients when the size/structure of a tab changes
This helps to notify when eg: splits are changed, or the tab
is resized by another client.

refs: https://github.com/wez/wezterm/issues/2133
refs: https://github.com/wez/wezterm/issues/2351
refs: https://github.com/wez/wezterm/issues/783
2023-03-24 17:28:34 -07:00
Wez Furlong
f71bce1727
mux: propagate pane focus change events to clients
This commit causes the mux to generate a PaneFocused notification
when the active pane is changed.

The mux server will forward that as a unilateral PDU to connected
clients.

The clientpane implementation will handle that by applying the
same state to the local mux.

refs: #2863
2023-03-24 13:13:31 -07:00
Wez Furlong
2e488d57c7
update terminfo to 0.8 2023-03-24 10:12:49 -07:00
Wez Furlong
bc7acc18e0
fixup images with the multiplexer
* Translate from File to EncodedFile as needed
* Adopt blob leases in the mux server
* Fix an issue where the first image sent by the mux server would
  be replaced on the client by its background image, if configured.
  Removed the ImageData::id field to resolve this: you should use
  the hash field instead to identify and disambiguate images.
  Bumped the termwiz API version because this is conceptually
  a breaking change to the API

refs: https://github.com/wez/wezterm/issues/3343
2023-03-23 21:43:28 -07:00
Wez Furlong
57a1b7f2ef
factor window border sizes when computing window sizes
This one was a bit weird because something appeared to be a bit
non-deterministic.  With this config:

```lua
local wezterm = require 'wezterm'

return {
  window_frame = {
    border_left_width = '1cell',
    border_right_width = '1cell',
    border_bottom_height = '0.5cell',
    border_top_height = '0.5cell',

    border_left_color = '#444',
    border_right_color = '#444',
    border_bottom_color = '#444',
    border_top_color = '#444',
  },

  window_padding = {
    left = '1.5cell',
    right = '1.5cell',
    top = '0.5cell',
    bottom = '0.5cell',
  },
}
```

starting wezterm could result in a terminal that reported either 23 or
24 lines. I got 24 when running the build from da7e29df but usually
23 when running a build out of my repo.

Looking closely, the issue is that the initial window size didn't
account for the configured border size, and that we'd subsequently
fix that up when we later do a resize fixup after creating the window.

This commit refactors the window border logic so that it can be
used prior to having fully constructed the terminal window and then
uses that to fixup the initial computed dimensions.

I also noticed with this config that increasing the font size
with CTRL-+ could also result in an inconsistency between the displayed
terminal size and the pty size we set in the kernel: it was missing
the border adjustment as well, so I added it in there.

refs: #3333
2023-03-23 07:11:07 -07:00
Wez Furlong
1a32908beb
fix lua string escaping in wezterm show-keys
We didn't render stuff like this correctly:

```
{ key = "{", mods = "SHIFT|CMD", action = wezterm.action.SendString("\2p") },
```

refs: https://github.com/wez/wezterm/issues/3326
2023-03-22 18:49:47 -07:00
Wez Furlong
b384dc999f
fix delegation of --skip-config to wezterm-gui
refs: #3325
2023-03-22 07:24:02 -07:00
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