This example demonstrates how to use the OSC parser to parse an OSC sequence, extract command information, and retrieve command-specific data like window titles.
#include <stddef.h>
#include <stdio.h>
#include <string.h>
int main() {
return 1;
}
const char *title = "hello";
for (size_t i = 0; i < strlen(title); i++) {
}
printf("Command type: %d\n", type);
printf("Extracted title: %s\n", title);
} else {
printf("Failed to extract title\n");
}
return 0;
}
GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command)
struct GhosttyOscCommand * GhosttyOscCommand
struct GhosttyOscParser * GhosttyOscParser
bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData data, void *out)
void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte)
GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator)
void ghostty_osc_free(GhosttyOscParser parser)
GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParser *parser)
@ GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR