Commit Graph

251 Commits (layouts)

Author SHA1 Message Date
Mitchell Hashimoto 781f8c4661
apprt/embedded: expose C APIs for layouts 2025-11-28 15:01:09 -08:00
Mitchell Hashimoto dbd0d2396c
apprt: add new_window_layout action 2025-11-28 14:53:20 -08:00
Mitchell Hashimoto 2ee2d000f5
apprt actions for search progress 2025-11-26 08:50:05 -08:00
Mitchell Hashimoto b7e70ce534
apprt: end_search 2025-11-26 08:50:04 -08:00
Mitchell Hashimoto aeaa8d4ead
add start_search binding and apprt action 2025-11-26 08:50:03 -08:00
Mitchell Hashimoto 901708e8da
input: write_*_file actions take an optional format
Fixes #9398
2025-10-31 09:49:59 -07:00
Mitchell Hashimoto 0f1c46e4a4
macos: support setting multiple clipboard content types 2025-10-30 14:01:58 -07:00
Mitchell Hashimoto 7d7c0bf5cd
lib-vt: Wasm SGR helpers and example (#9362)
This adds some convenience functions for parsing SGR sequences
WebAssembly and adds an example demonstrating SGR parsing in the
browser.
2025-10-26 13:19:55 -07:00
Mitchell Hashimoto a82ad89ef3
lib-vt: C API for SGR parser (#9352)
This exposes the SGR parser to the C and Wasm APIs. An example is shown
in c-vt-sgr.

Compressed example:

```c
#include <assert.h>
#include <stdio.h>
#include <ghostty/vt.h>

int main() {
  // Create parser
  GhosttySgrParser parser;
  assert(ghostty_sgr_new(NULL, &parser) == GHOSTTY_SUCCESS);

  // Parse: ESC[1;31m (bold + red foreground)
  uint16_t params[] = {1, 31};
  assert(ghostty_sgr_set_params(parser, params, NULL, 2) == GHOSTTY_SUCCESS);

  printf("Parsing: ESC[1;31m\n\n");

  // Iterate through attributes
  GhosttySgrAttribute attr;
  while (ghostty_sgr_next(parser, &attr)) {
    switch (attr.tag) {
      case GHOSTTY_SGR_ATTR_BOLD:
        printf("✓ Bold enabled\n");
        break;
      case GHOSTTY_SGR_ATTR_FG_8:
        printf("✓ Foreground color: %d (red)\n", attr.value.fg_8);
        break;
      default:
        break;
    }
  }

  ghostty_sgr_free(parser);
  return 0;
}
```

**AI disclosure:** Amp wrote most of the C headers, but I verified it
all. https://ampcode.com/threads/T-d9f145cb-e6ef-48a8-ad63-e5fc85c0d43e
2025-10-25 21:26:06 -07:00
Mitchell Hashimoto c133fac7e7
lib-vt: wasm convenience functions and a simple example (#9309)
This adds a set of Wasm convenience functions to ease memory management.
These are all prefixed with `ghostty_wasm` and are documented as part of
the standard Doxygen docs.

I also added a very simple single-page HTML example that demonstrates
how to use the Wasm module for key encoding.

This also adds a bunch of safety checks to the C API to verify that
valid values are actually passed to the function. This is an easy to hit
bug.

**AI disclosure:** The example is AI-written with Amp. I read through
all the code and understand it but I can't claim there isn't a better
way, I'm far from a JS expert. It is simple and works currently though.
Happy to see improvements if anyone wants to contribute.
2025-10-22 14:25:52 -07:00
Mitchell Hashimoto da7736cd44
renderer: emit scrollbar apprt event when scrollbar changes 2025-10-15 21:45:01 -07:00
Mitchell Hashimoto bf9f025aec
lib-vt: begin paste utilities exports starting with safe paste 2025-10-06 21:09:28 -07:00
Mitchell Hashimoto 725203d494
lib-vt: split header to be more consumable 2025-10-06 20:48:49 -07:00
Mitchell Hashimoto 9194d6c496
doxygen: integrate examples into documentation 2025-10-06 08:44:47 -07:00
Mitchell Hashimoto fd0851bae7
lib-vt: update documentation with more examples 2025-10-05 14:54:58 -07:00
Mitchell Hashimoto 61fe78c1d3
lib-vt: expose key encoding as a C API 2025-10-05 14:40:20 -07:00
Jeffrey C. Ollie 07124dba64
core: add 'command finished' notifications
Fixes #8991

Uses OSC 133 esc sequences to keep track of how long commands take to
execute. If the user chooses, commands that take longer than a user
specified limit will trigger a notification. The user can choose between
a bell notification or a desktop notification.
2025-10-02 12:40:40 -05:00
Mitchell Hashimoto cc0b7f74fd
lib-vt: document allocators 2025-09-29 09:12:12 -07:00
Mitchell Hashimoto 15670a77f3
lib-vt: document main html page 2025-09-29 08:59:16 -07:00
Mitchell Hashimoto 3bc07c24aa
lib-vt: OSC data extraction boilerplate
This also changes OSC strings to be null-terminated to ease lib-vt
integration. This shouldn't have any practical effect on terminal
performance, but it does lower the maximum length of OSC strings by 1
since we always reserve space for the null terminator.
2025-09-29 06:40:01 -07:00
Mitchell Hashimoto cfe9f19454
lib-vt: expose command type enum 2025-09-28 07:21:46 -07:00
Mitchell Hashimoto f564ffa30b
lib-vt: expose ghostty_osc_end 2025-09-27 15:15:51 -07:00
Mitchell Hashimoto 6b1f4088dd
lib-vt: add the C functions for command inspection 2025-09-27 15:03:38 -07:00
Mitchell Hashimoto b3d1802c89
lib_vt: osc_next/reset 2025-09-27 13:25:56 -07:00
CoderJoshDK dc03a47558
chore: sync changes with ghostty_string_s 2025-09-24 17:47:24 -04:00
CoderJoshDK c5786c5d38
fix: alloc free off by one 2025-09-24 16:58:39 -04:00
Mitchell Hashimoto 232b1898fa
lib-vt: update header comments 2025-09-24 12:50:25 -07:00
Mitchell Hashimoto 37372fa50b
more docs 2025-09-24 12:45:21 -07:00
Mitchell Hashimoto 37e238c2f6
remove vt prefixes 2025-09-24 12:36:50 -07:00
Mitchell Hashimoto 96e9053862
move header into subdirectory 2025-09-24 12:30:37 -07:00
Mitchell Hashimoto 48827b21d8
some PR feedback 2025-09-24 12:25:43 -07:00
Mitchell Hashimoto e7a0198103
lib-vt: docs 2025-09-24 10:46:24 -07:00
Mitchell Hashimoto 2c78ad8889
lib-vt: setup a default allocator if null 2025-09-24 10:30:13 -07:00
Mitchell Hashimoto e1429dabae
example/c-vt 2025-09-24 09:54:08 -07:00
Mitchell Hashimoto 969fcfaec3
lib: allocator interface based on Zig allocators 2025-09-24 09:27:17 -07:00
Mitchell Hashimoto b006101ddd
lib-vt: boilerplate to build a shared object 2025-09-23 12:35:39 -07:00
Mitchell Hashimoto e8217aa007
macOS: firstRect should return full rect width/height
Fixes #2473

This commit changes `ghostty_surface_ime_point` to return a full rect
with the width/height calculated for the preedit.

The `firstRect` function, which calls `ghostty_surface_ime_point` was
previously setting the width/height to zero. macOS didn't like this. We
then changed it to just hardcode it to width/height of one cell. This
worked but made it so the IME cursor didn't follow the preedit.
2025-09-02 13:08:46 -07:00
Mitchell Hashimoto 0b58830882
macOS: Progress bar for OSC9 progress reports 2025-08-31 20:42:34 -07:00
Mitchell Hashimoto f1ea30dcf1
macos: when executing a script directly, always wait after command 2025-08-28 11:26:33 -07:00
Mitchell Hashimoto a90bf58080
config: change quick terminal size C layout to tagged union 2025-08-26 09:52:26 -07:00
Friedrich Stoltzfus 466fdfffe6 macOS: rename c struct, relocate QuickTerminalSize file
Renamed the ghostty_quick_terminal_size_u to
ghostty_quick_terminal_size_s and moved the QuickTerminalSize file to
the Ghostty folder as requested.
2025-08-26 09:47:31 -07:00
Friedrich Stoltzfus 17f7f204e1 macOS: update zig and c structs for quick terminal size
Applying the feedback given by @pluiedev to use an enum to specify the
type of quick terminal size configuration given (pixels or percentage).
Updated the Swift code to work with the enum as well.
2025-08-26 09:47:31 -07:00
Friedrich Stoltzfus 63cd424678 macOS: Add support for quick terminal sizing configuration
Added C bindings for the already existing quick-terminal-size
configuration. Created a new QuickTerminalSize struct to hold these
values in Swift. Updated the QuickTerminal implementation to use the
user's configuration if supplied. Retains defaults. Also adds support to
customize the width of the quick terminal (height if quick terminal is
set to right or left).
2025-08-26 09:47:31 -07:00
Jeffrey C. Ollie 52a25e9c69
parameterize close_tab
- Add mode (`this`/`other`) parameter to `close_tab` keybind/apprt action.
- Keybinds will default to `this` if not specified, eliminating backward
  compatibility issues (`keybind=x=close_tab` === `keybind=x=close_tab:this`).
- Remove `close_other_tabs` keybind and apprt action.
2025-08-25 11:00:26 -05:00
jamylak c26323d697 Close other tabs feature on Mac.
Supporting command line, file menu and keybindings.
Default mac shortcut of `super + alt + o` (other)

Not able to test on Linux so excluding `close_other_tabs` from `gtk` for now
make a default short cut for close other tabs
2025-08-24 07:55:08 -07:00
Leah Amelia Chen 23048dbd33
gtk-ng: add show_on_screen_keyboard binding 2025-08-14 04:06:02 +08:00
Mitchell Hashimoto f0a0333bc0
apprt/gtk-ng: hook up surface render 2025-07-18 12:43:24 -07:00
Jeffrey C. Ollie 7a60fb2d08
core/gtk: add support for displaying a progress bar with OSC 9;4
Ghostty has had support for a while (since PR #3124) for parsing progress
reports but never did anything with them. This PR adds the core
infrastructure and an implementation for GTK.

On GTK, the progress bar will show up as a thin bar along the top of
the terminal. Under normal circumstances it will use whatever you have
set as your accent color. If the progam sending the progress report
indicates an error, it will change to a reddish color.
2025-07-17 22:36:27 -05:00
Jeffrey C. Ollie 58867b0717
cli/gtk: add some more C bits 2025-07-14 14:48:12 -05:00
Jeffrey C. Ollie 81358c8dca
cli/gtk: replace @hasDecl for performAction-style API
Instead of using @hasDecl, use a performAction-stype API. The C
interface for interfacing with macOS (or any other apprt where Ghostty
is embedded) is unfinished.
2025-07-14 14:48:11 -05:00