vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

config.def.h (2928B)


      1 /* See LICENSE for copyright details */
      2 static FontDesc g_fonts[][FS_LAST] = {
      3 	{
      4 	[FS_NORMAL]      = {.path = "/usr/share/fonts/gofont/Go-Mono.ttf",             .height = 24},
      5 	[FS_BOLD]        = {.path = "/usr/share/fonts/gofont/Go-Mono-Bold.ttf",        .height = 24},
      6 	[FS_ITALIC]      = {.path = "/usr/share/fonts/gofont/Go-Mono-Italic.ttf",      .height = 24},
      7 	[FS_BOLD_ITALIC] = {.path = "/usr/share/fonts/gofont/Go-Mono-Bold-Italic.ttf", .height = 24},
      8 	},
      9 };
     10 
     11 /* NOTE: terminal padding in pixels */
     12 static v2 g_term_pad = {.w =  8, .h =  8};
     13 /* NOTE: cell padding in pixels (glyphs will be centered) */
     14 static v2 g_cell_pad = {.w =  0, .h =  0};
     15 
     16 static u8 g_tabstop = 8;
     17 
     18 static Colour base16_colours[16] = {
     19 	[0]   = { .rgba = 0x000000ff }, /* black */
     20 	[1]   = { .rgba = 0xaa0000ff }, /* red */
     21 	[2]   = { .rgba = 0x00aa00ff }, /* green */
     22 	[3]   = { .rgba = 0xaa5500ff }, /* yellow */
     23 	[4]   = { .rgba = 0x0000aaff }, /* blue */
     24 	[5]   = { .rgba = 0xaa00aaff }, /* magenta */
     25 	[6]   = { .rgba = 0x00aaaaff }, /* cyan */
     26 	[7]   = { .rgba = 0xaaaaaaff }, /* white */
     27 
     28 	/* bright colours */
     29 	[8]   = { .rgba = 0x555555ff }, /* black */
     30 	[9]   = { .rgba = 0xff5555ff }, /* red */
     31 	[10]  = { .rgba = 0x55ff55ff }, /* green */
     32 	[11]  = { .rgba = 0xffff55ff }, /* yellow */
     33 	[12]  = { .rgba = 0x5555ffff }, /* blue */
     34 	[13]  = { .rgba = 0xff55ffff }, /* magenta */
     35 	[14]  = { .rgba = 0x55ffffff }, /* cyan */
     36 	[15]  = { .rgba = 0xffffffff }, /* white */
     37 };
     38 
     39 struct {
     40 	Colour *data;
     41 	u8      fgidx;
     42 	u8      bgidx;
     43 } g_colours = {base16_colours, 7, 0};
     44 
     45 #define KEYBIND_FN(name) b32 name(Term *t, Arg a)
     46 typedef KEYBIND_FN(KeyBind_Fn);
     47 
     48 /* NOTE: Bindable Functions */
     49 KEYBIND_FN(copy);              /* arg: none                      */
     50 KEYBIND_FN(paste);             /* arg: none                      */
     51 KEYBIND_FN(scroll);            /* arg: .i = line count increment */
     52 KEYBIND_FN(zoom);              /* arg: .i = font size increment  */
     53 
     54 #define MODKEY  (GLFW_MOD_ALT)
     55 #define TERMMOD (GLFW_MOD_CONTROL|GLFW_MOD_SHIFT)
     56 #define ALTMOD  (GLFW_MOD_ALT|GLFW_MOD_SHIFT)
     57 //#define XXX (GLFW_MOD_SUPER)
     58 
     59 struct hotkey {
     60 	u32 key;
     61 	KeyBind_Fn *fn;
     62 	Arg arg;
     63 } g_hotkeys[] = {
     64 	{ENCODE_KEY(GLFW_PRESS,  MODKEY,  GLFW_KEY_C),         copy,   {0}},
     65 	{ENCODE_KEY(GLFW_PRESS,  MODKEY,  GLFW_KEY_V),         paste,  {0}},
     66 	{ENCODE_KEY(GLFW_PRESS,  0,       GLFW_KEY_PAGE_UP),   scroll, {.i = +3}},
     67 	{ENCODE_KEY(GLFW_REPEAT, 0,       GLFW_KEY_PAGE_UP),   scroll, {.i = +3}},
     68 	{ENCODE_KEY(GLFW_PRESS,  0,       GLFW_KEY_PAGE_DOWN), scroll, {.i = -3}},
     69 	{ENCODE_KEY(GLFW_REPEAT, 0,       GLFW_KEY_PAGE_DOWN), scroll, {.i = -3}},
     70 	{ENCODE_KEY(GLFW_PRESS,  TERMMOD, GLFW_KEY_MINUS),     zoom,   {.i = -1}},
     71 	{ENCODE_KEY(GLFW_REPEAT, TERMMOD, GLFW_KEY_MINUS),     zoom,   {.i = -1}},
     72 	{ENCODE_KEY(GLFW_PRESS,  TERMMOD, GLFW_KEY_EQUAL),     zoom,   {.i = +1}},
     73 	{ENCODE_KEY(GLFW_REPEAT, TERMMOD, GLFW_KEY_EQUAL),     zoom,   {.i = +1}},
     74 };