Commit Graph

8245 Commits

Author SHA1 Message Date
kadekillary
12815f7fa3 feat(cli): list keybindings from key tables
- Display keybindings grouped by their source table, with table name as prefix
- Sort default bindings before table bindings, maintaining visual hierarchy
- Support keybindings defined in key tables alongside default bindings
- Enable users to discover all available keybindings across the entire config
2025-12-23 08:19:45 -06:00
Mitchell Hashimoto
fbed63b047 config: improve key table parsing robustness (#10022)
Fixes #10020

This improves parsing key tables so that the following edge cases are
now handled correctly, which were regressions from prior tip behavior:

  - `/=action`
  - `ctrl+/=action`
  - `table//=action` (valid to bind `/` in a table)
  - `table/a>//=action` (valid to bind a table with a sequence)
2025-12-22 21:03:43 -08:00
Mitchell Hashimoto
56f5a14dde config: improve key table parsing robustness
Fixes #10020

This improves parsing key tables so that the following edge cases
are now handled correctly, which were regressions from prior tip
behavior:

  - `/=action`
  - `ctrl+/=action`
  - `table//=action` (valid to bind `/` in a table)
  - `table/a>//=action` (valid to bind a table with a sequence)
2025-12-22 20:58:21 -08:00
Mitchell Hashimoto
7ad1e6e2ea Chained Keybinds (#10015)
Fixes #9961 

This implements chained keybinds as described in #9961. 

```
keybind = ctrl+shift+f=toggle_fullscreen
keybind = chain=toggle_window_decorations
```

These work with tables and sequences. For tables, the chain is unique
per table, so the following works:

```
keybind = foo/ctrl+shift+f=toggle_fullscreen
keybind = foo/chain=toggle_window_decorations
```

For sequences, it applies to the most recent sequence:

```
keybind = ctrl+b>f=toggle_fullscreen
keybind = chain=toggle_window_decorations
```

## TODO

Some limitations to resolve in future PRs (make an issue) or commits:

- [x] GTK: Global shortcuts cannot be chained: #10019
- [x] Inspector doesn't show chained keybinds
- [x] `+list-keybinds` doesn't show chains

**AI disclosure:** AI helped write tests, but everything else was
organic. AI did surprisingly bad at trying to implement this feature, so
I threw all of its work away! 😄
2025-12-22 20:52:20 -08:00
Mitchell Hashimoto
c11febd0dd cli/list-keybinds: support chained keybindings 2025-12-22 20:43:52 -08:00
Mitchell Hashimoto
dcbb3fe56f inspector: show chained bindings 2025-12-22 20:37:39 -08:00
Jeffrey C. Ollie
76c0bdf559 input: fix performable bindings 2025-12-22 17:48:04 -06:00
Mitchell Hashimoto
931c6c71f2 fix up gtk 2025-12-22 13:38:46 -08:00
Mitchell Hashimoto
99325a3d45 config: docs for chains 2025-12-22 13:34:19 -08:00
Mitchell Hashimoto
7dd903588b input: formatter for chained entries 2025-12-22 13:34:19 -08:00
Mitchell Hashimoto
e4c7d4e059 input: handle unbind cleanup for leaf chains 2025-12-22 13:34:18 -08:00
Mitchell Hashimoto
578b4c284b apprt/gtk: handle global actions with chains 2025-12-22 13:34:18 -08:00
Mitchell Hashimoto
442146cf9f input: implement leaf_chained clone 2025-12-22 13:13:39 -08:00
Mitchell Hashimoto
b8fe66a701 input: parseAndPut handles chains 2025-12-22 13:06:29 -08:00
Mitchell Hashimoto
9bf1b9ac71 input: cleaner reverse mapping cleanup 2025-12-22 12:55:33 -08:00
Mitchell Hashimoto
67be309e3f input: Trigger.eql 2025-12-22 12:50:39 -08:00
Mitchell Hashimoto
a3373f3c6a input: appendChain reverse mapping 2025-12-22 12:47:04 -08:00
Mitchell Hashimoto
4fdc52b920 input: appendChain 2025-12-22 12:37:53 -08:00
Mitchell Hashimoto
457fededeb input: keep track of chain parent 2025-12-22 12:00:50 -08:00
Mitchell Hashimoto
42c21eb16b input: leaf_chained tagged union value 2025-12-22 10:19:54 -08:00
Mitchell Hashimoto
3877ead071 input: parse chains (don't do anything with them yet) 2025-12-22 09:13:41 -08:00
Mitchell Hashimoto
b171c8fd39 shell-integration: ensure shell resources exist (#9997)
Our automatic shell integrations require certain resource paths to
exist. If they're missing, the launched shell could end up in an
inconsistent and unexpected state.

For example, we temporarily set ZDOTDIR to our zsh shell integration
directory and then restore it from our .zshenv file, but if that script
isn't available, the user's shell environment will be broken.

The actual runtime logic change was simple: each shell integration
routine attempts to open its expected resource path and skips automatic
shell integration upon failure. The more complex change was reworking
our unit tests to run in a temporary resources directory structure.

See: #9941
2025-12-21 14:46:18 -08:00
Jon Parise
73fd007a83 shell-integration: log warnings for missing paths 2025-12-21 16:44:43 -05:00
Mitchell Hashimoto
8a8b06e74d config: document key tables for keybind 2025-12-21 13:28:14 -08:00
Henrique Albuquerque
97cd4c71d5 Fix typo 2025-12-21 17:57:23 +00:00
Jon Parise
9ce04b81b7 shell-integration: ensure shell resources exist
Our automatic shell integrations require certain resource paths to
exist. If they're missing, the launched shell could end up in an
inconsistent and unexpected state.

For example, we temporarily set ZDOTDIR to our zsh shell integration
directory and then restore it from our .zshenv file, but if that script
isn't available, the user's shell environment will be broken.

The actual runtime logic change was simple: each shell integration
routine attempts to open its expected resource path and skips automatic
shell integration upon failure. The more complex change was reworking
our unit tests to run in a temporary resources directory structure.
2025-12-21 12:34:19 -05:00
Mitchell Hashimoto
18c8c338e0 Reset key tables on config reload, bound max active key tables
Two unrelated changes to polish key tables:

1. Key tables should be reset (deactivated) when teh config is reloaded.
   This matches the behavior of key sequences as well, which are reset
   on config reload. 

2. A maximum number of active key tables is now enforced (8).
   This prevents a misbehaving config from consuming too much memory
   by activating too many key tables. This is an arbitrary limit we
   can adjust later if needed.
2025-12-21 08:14:37 -08:00
Mitchell Hashimoto
44972198ae apprt: add action for key table activation/deactivation 2025-12-20 19:53:12 -08:00
Mitchell Hashimoto
845bcdb498 config: copy key table name into arena 2025-12-20 15:15:30 -08:00
Mitchell Hashimoto
daa613482e keybind = clear and reset should reset tables, too 2025-12-20 14:57:37 -08:00
Mitchell Hashimoto
14bbc4893f implement one-shot key tables 2025-12-20 14:36:39 -08:00
Mitchell Hashimoto
36f891afd8 implement key table lookup in maybeHandleBinding 2025-12-20 14:30:36 -08:00
Mitchell Hashimoto
18ce219d78 input: activate/deactivate key table binding actions 2025-12-20 14:23:02 -08:00
Mitchell Hashimoto
34ae3848b6 core: key tables 2025-12-20 14:04:11 -08:00
Mitchell Hashimoto
8c59143c1a rename some key sequence state so it is clearer what it is 2025-12-20 14:04:03 -08:00
Mitchell Hashimoto
c53b3fffd5 config: keybind table parsing 2025-12-20 13:32:52 -08:00
Mitchell Hashimoto
63422f4d4e add the catch_all binding key
Part of #9963

This adds a new special key `catch_all` that can be used in keybinding
definitions to match any key that is not explicitly bound. For example:
`keybind = catch_all=new_window` (chaos!). 

`catch_all` can be used in combination with modifiers, so if you want to
catch any non-bound key with Ctrl held down, you can do:
`keybind = ctrl+catch_all=new_window`.

`catch_all` can also be used with trigger sequences, so you can do:
`keybind = ctrl+a>catch_all=new_window` to catch any key pressed after
`ctrl+a` that is not explicitly bound and make a new window!

And if you want to remove the catch all binding, it is like any other:
`keybind = catch_all=unbind`.
2025-12-19 15:03:38 -08:00
Mitchell Hashimoto
594195963d Update src/renderer/Metal.zig
Co-authored-by: Jon Parise <jon@indelible.org>
2025-12-19 09:31:10 -08:00
Mitchell Hashimoto
07b47b87fa renderer/metal: clamp texture sizes to the maximum allowed by the device
This prevents a crash in our renderer when it is larger.

I will pair this with apprt changes so that our mac app won't ever allow
a default window larger than the screen but we should be resilient at
the renderer level as well.
2025-12-19 09:24:49 -08:00
Mitchell Hashimoto
5a2f5a6b9e terminal: RenderState linkCells needs to use Page y not Viewport y
Fixes #9957

Our `Page.getRowAndCell` uses a _page-relative_ x/y coordinate system
and we were passing in viewport x/y. This has the possibility to leading
to all sorts of bugs, including the crash found in #9957 but also simply
reading the wrong cell even in single-page scenarios.
2025-12-18 13:54:35 -08:00
Jacob Sandlund
aecdacbe49 Merge remote-tracking branch 'origin/main' into shaping-positions 2025-12-17 10:02:06 -05:00
Jacob Sandlund
139a23a0a2 Pull out debugging into a separate function. 2025-12-17 09:57:32 -05:00
Jacob Sandlund
e28e4facf0 Merge remote-tracking branch 'origin/main' into shaping-positions 2025-12-17 09:18:10 -05:00
Elad Kaplan
67f9bb9e8a Fix link opening by resolving existing relative paths 2025-12-17 15:13:47 +02:00
Mitchell Hashimoto
50cb1bafd7 macOS: change window to new-window for macos-dock-drop-behavior (#9764)
Matches current option references and Swift implementation
2025-12-16 13:35:25 -08:00
Dominique Martinet
f37acdf6a0 gtk/opengl: print an error when OpenGL version is too old
#1123 added a warning when the OpenGL version is too old, but
it is never used because GTK enforces the version set with
gl_area.setRequiredVersion() before prepareContext() is called:
we end up with a generic "failed to make GL context" error:
warning(gtk_ghostty_surface): failed to make GL context current: Unable to create a GL context
warning(gtk_ghostty_surface): this error is almost always due to a library, driver, or GTK issue
warning(gtk_ghostty_surface): this is a common cause of this issue: https://ghostty.org/docs/help/gtk-opengl-context

This patch removes the requirement at the GTK level and lets the ghostty
renderer check, now failing as follow:
info(opengl): loaded OpenGL 4.2
error(opengl): OpenGL version is too old. Ghostty requires OpenGL 4.3
warning(gtk_ghostty_surface): failed to initialize surface err=error.OpenGLOutdated
warning(gtk_ghostty_surface): surface failed to initialize err=error.SurfaceError

(Note that this does not render a ghostty window, unlike the previous
error which rendered the "Unable to acquire an OpenGL context for
rendering." view, so while the error itself is easier to understand it
might be harder to view)
2025-12-16 13:30:37 -08:00
IceCodeNew
ccc2d32aa5 Fix macOS log command for Ghostty
Corrected the command for viewing Ghostty logs on macOS.
2025-12-17 05:16:27 +08:00
Mitchell Hashimoto
f9a1f526c8 update some copy for the background opacity toggle 2025-12-16 11:40:12 -08:00
himura467
ba2cbef1f1 apprt/gtk: list toggle_background_opacity as unimplemented 2025-12-16 11:32:10 -08:00
himura467
4c6d3f8ed2 macos: add toggle_background_opacity keybind action 2025-12-16 11:32:10 -08:00