vtgl

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

config.def.h (3282B)


      1 /* See LICENSE for copyright details */
      2 static FontDesc g_fonts[][FS_COUNT] = {
      3 	{
      4 		[FS_NORMAL]      = "/usr/share/fonts/gofont/Go-Mono.ttf",
      5 		[FS_BOLD]        = "/usr/share/fonts/gofont/Go-Mono-Bold.ttf",
      6 		[FS_ITALIC]      = "/usr/share/fonts/gofont/Go-Mono-Italic.ttf",
      7 		[FS_BOLD_ITALIC] = "/usr/share/fonts/gofont/Go-Mono-Bold-Italic.ttf",
      8 	},
      9 	{
     10 		[FS_NORMAL] = "/usr/share/fonts/dejavu/DejaVuSans.ttf",
     11 	},
     12 	{
     13 		[FS_NORMAL] = "/usr/share/fonts/dejavu/DejaVuSans.ttf",
     14 	},
     15 	{
     16 		[FS_NORMAL] = "/usr/share/fonts/liberation-fonts/LiberationMono-Regular.ttf",
     17 	},
     18 };
     19 
     20 static i32 g_font_size    = 28;
     21 static i32 g_ui_font_size = 20;
     22 
     23 /* NOTE: indices into the array above */
     24 static u32 g_ui_small_font_id = 2;
     25 static u32 g_ui_large_font_id = 3;
     26 static u32 g_ui_debug_font_id = 4;
     27 
     28 /* NOTE: terminal margin in pixels */
     29 static iv2 g_term_margin = {.w =  8, .h =  8};
     30 
     31 static u8 g_tabstop = 8;
     32 
     33 /* NOTE: number of blinks per second */
     34 static f32 g_blink_speed = 1.0f;
     35 
     36 static s8 g_shader_path_prefix = s8("");
     37 
     38 static Colour base16_colours[16] = {
     39 	[0]   = { .rgba = 0x000000ff }, /* black */
     40 	[1]   = { .rgba = 0xaa0000ff }, /* red */
     41 	[2]   = { .rgba = 0x00aa00ff }, /* green */
     42 	[3]   = { .rgba = 0xaa5500ff }, /* yellow */
     43 	[4]   = { .rgba = 0x0000aaff }, /* blue */
     44 	[5]   = { .rgba = 0xaa00aaff }, /* magenta */
     45 	[6]   = { .rgba = 0x00aaaaff }, /* cyan */
     46 	[7]   = { .rgba = 0xaaaaaaff }, /* white */
     47 
     48 	/* bright colours */
     49 	[8]   = { .rgba = 0x555555ff }, /* black */
     50 	[9]   = { .rgba = 0xff5555ff }, /* red */
     51 	[10]  = { .rgba = 0x55ff55ff }, /* green */
     52 	[11]  = { .rgba = 0xffff55ff }, /* yellow */
     53 	[12]  = { .rgba = 0x5555ffff }, /* blue */
     54 	[13]  = { .rgba = 0xff55ffff }, /* magenta */
     55 	[14]  = { .rgba = 0x55ffffff }, /* cyan */
     56 	[15]  = { .rgba = 0xffffffff }, /* white */
     57 };
     58 
     59 struct {
     60 	Colour *data;
     61 	u8      fgidx;
     62 	u8      bgidx;
     63 } g_colours = {base16_colours, 7, 0};
     64 
     65 #define KEYBIND_FN(name) b32 name(Term *t, PlatformAPI *platform, Arg a)
     66 typedef KEYBIND_FN(KeyBind_Fn);
     67 
     68 /* NOTE: Bindable Functions */
     69 KEYBIND_FN(copy);              /* arg: .i = CLIPBOARD_0 or CLIPBOARD_1 (on supported platforms) */
     70 KEYBIND_FN(paste);             /* arg: .i = CLIPBOARD_0 or CLIPBOARD_1 (on supported platforms) */
     71 KEYBIND_FN(scroll);            /* arg: .i = line count increment */
     72 KEYBIND_FN(zoom);              /* arg: .i = font size increment  */
     73 
     74 #define MODKEY  (MOD_ALT)
     75 #define TERMMOD (MOD_CONTROL|MOD_SHIFT)
     76 #define ALTMOD  (MOD_ALT|MOD_SHIFT)
     77 //#define XXX (MOD_SUPER)
     78 
     79 struct hotkey {
     80 	u32 key;
     81 	KeyBind_Fn *fn;
     82 	Arg arg;
     83 } g_hotkeys[] = {
     84 	{ENCODE_KEY(ACT_PRESS,  MODKEY,  KEY_C),         copy,   {.i = CLIPBOARD_0}},
     85 	{ENCODE_KEY(ACT_PRESS,  MODKEY,  KEY_V),         paste,  {.i = CLIPBOARD_0}},
     86 	{ENCODE_KEY(ACT_PRESS,  0,       KEY_PAGE_UP),   scroll, {.i = +3}},
     87 	{ENCODE_KEY(ACT_REPEAT, 0,       KEY_PAGE_UP),   scroll, {.i = +3}},
     88 	{ENCODE_KEY(ACT_PRESS,  0,       KEY_PAGE_DOWN), scroll, {.i = -3}},
     89 	{ENCODE_KEY(ACT_REPEAT, 0,       KEY_PAGE_DOWN), scroll, {.i = -3}},
     90 	{ENCODE_KEY(ACT_PRESS,  TERMMOD, KEY_MINUS),     zoom,   {.i = -1}},
     91 	{ENCODE_KEY(ACT_REPEAT, TERMMOD, KEY_MINUS),     zoom,   {.i = -1}},
     92 	{ENCODE_KEY(ACT_PRESS,  TERMMOD, KEY_EQUAL),     zoom,   {.i = +1}},
     93 	{ENCODE_KEY(ACT_REPEAT, TERMMOD, KEY_EQUAL),     zoom,   {.i = +1}},
     94 };