1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 10:52:16 +03:00
Commit Graph

1350 Commits

Author SHA1 Message Date
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