xiterm

simple vte terminal emulator
git clone https://git.ce9e.org/xiterm.git

commit
3e87eaa0548dffef14e676484ea0d867559e08b7
parent
ab39c1fe37bcec2f49b17337fd752c0d1ee7894d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-02-19 12:52
define PALETTE_SIZE

this makes is easier to define a full 256 color palette

Diffstat

M xiterm.c 10 ++++++----

1 files changed, 6 insertions, 4 deletions


diff --git a/xiterm.c b/xiterm.c

@@ -11,15 +11,17 @@
   11    11 #define KEY(v, s) (event->keyval == (v) && modifiers == (GDK_CONTROL_MASK|(s)))
   12    12 #define KEY_S(v) (event->keyval == (v) && (GDK_SHIFT_MASK|modifiers) == (GDK_SHIFT_MASK|GDK_CONTROL_MASK))
   13    13 
   -1    14 #define PALETTE_SIZE 16
   -1    15 
   14    16 GtkWindow *window;
   15    17 GtkNotebook *notebook;
   16    18 VteRegex *url_regex;
   17    -1 GdkRGBA palette[16];
   -1    19 GdkRGBA palette[PALETTE_SIZE];
   18    20 double font_scale = 1;
   19    21 
   20    22 char *default_cmd[2] = {"/bin/bash", NULL};
   21    23 char *initial_cmd[4] = {"/bin/bash", NULL, NULL, NULL};
   22    -1 const char *colors[16] = {
   -1    24 const char *colors[PALETTE_SIZE] = {
   23    25 	"#000", "#c00", "#591", "#b71", "#16c", "#96a", "#299", "#ccc",
   24    26 	"#333", "#f33", "#7c0", "#ed0", "#6ad", "#c8b", "#0dd", "#fff",
   25    27 };
@@ -110,7 +112,7 @@ void setup_terminal(VteTerminal *term, char **cmd) {
  110   112 	vte_terminal_set_cursor_blink_mode(term, VTE_CURSOR_BLINK_OFF);
  111   113 	tag = vte_terminal_match_add_regex(term, url_regex, 0);
  112   114 	vte_terminal_match_set_cursor_name(term, tag, "pointer");
  113    -1 	vte_terminal_set_colors(term, &palette[15], NULL, palette, 16);
   -1   115 	vte_terminal_set_colors(term, &palette[15], NULL, palette, PALETTE_SIZE);
  114   116 	vte_terminal_set_bold_is_bright(term, TRUE);
  115   117 	vte_terminal_set_font_scale(term, font_scale);
  116   118 	vte_terminal_set_enable_bidi(term, FALSE);
@@ -214,7 +216,7 @@ int main(int argc, char **argv) {
  214   216 	url_regex = vte_regex_new_for_match(REGEX_URL, -1, PCRE2_MULTILINE, &err);
  215   217 	g_assert(err == NULL);
  216   218 
  217    -1 	for (i = 0; i < 16; i++) {
   -1   219 	for (i = 0; i < PALETTE_SIZE; i++) {
  218   220 		gdk_rgba_parse(palette + i, colors[i]);
  219   221 	}
  220   222