You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

187 lines
4.1 KiB

  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include <tllist.h>
  5. #include "terminal.h"
  6. #include "user-notification.h"
  7. #include "wayland.h"
  8. enum conf_size_type {CONF_SIZE_PX, CONF_SIZE_CELLS};
  9. struct config_font {
  10. char *pattern;
  11. double pt_size;
  12. int px_size;
  13. };
  14. struct config_key_modifiers {
  15. bool shift;
  16. bool alt;
  17. bool ctrl;
  18. bool meta;
  19. };
  20. struct config_key_binding_normal {
  21. enum bind_action_normal action;
  22. struct config_key_modifiers modifiers;
  23. xkb_keysym_t sym;
  24. struct {
  25. char *cmd;
  26. char **argv;
  27. bool master_copy;
  28. } pipe;
  29. };
  30. struct config_key_binding_search {
  31. enum bind_action_search action;
  32. struct config_key_modifiers modifiers;
  33. xkb_keysym_t sym;
  34. };
  35. struct config_mouse_binding {
  36. enum bind_action_normal action;
  37. struct config_key_modifiers modifiers;
  38. int button;
  39. int count;
  40. };
  41. struct config {
  42. char *term;
  43. char *shell;
  44. char *title;
  45. char *app_id;
  46. wchar_t *word_delimiters;
  47. bool login_shell;
  48. struct {
  49. enum conf_size_type type;
  50. union {
  51. struct {
  52. unsigned width;
  53. unsigned height;
  54. } px;
  55. struct {
  56. unsigned width;
  57. unsigned height;
  58. } cells;
  59. };
  60. } size;
  61. unsigned pad_x;
  62. unsigned pad_y;
  63. bool bell_is_urgent;
  64. enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
  65. tll(struct config_font) fonts;
  66. struct {
  67. int lines;
  68. struct {
  69. enum {
  70. SCROLLBACK_INDICATOR_POSITION_NONE,
  71. SCROLLBACK_INDICATOR_POSITION_FIXED,
  72. SCROLLBACK_INDICATOR_POSITION_RELATIVE
  73. } position;
  74. enum {
  75. SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE,
  76. SCROLLBACK_INDICATOR_FORMAT_LINENO,
  77. SCROLLBACK_INDICATOR_FORMAT_TEXT,
  78. } format;
  79. wchar_t *text;
  80. } indicator;
  81. double multiplier;
  82. } scrollback;
  83. struct {
  84. uint32_t fg;
  85. uint32_t bg;
  86. uint32_t regular[8];
  87. uint32_t bright[8];
  88. uint16_t alpha;
  89. uint32_t selection_fg;
  90. uint32_t selection_bg;
  91. bool selection_uses_custom_colors;
  92. } colors;
  93. struct {
  94. enum cursor_style style;
  95. bool blink;
  96. struct {
  97. uint32_t text;
  98. uint32_t cursor;
  99. } color;
  100. } cursor;
  101. struct {
  102. bool hide_when_typing;
  103. bool alternate_scroll_mode;
  104. } mouse;
  105. struct {
  106. /* Bindings for "normal" mode */
  107. tll(struct config_key_binding_normal) key;
  108. tll(struct config_mouse_binding) mouse;
  109. /*
  110. * Special modes
  111. */
  112. /* While searching (not - action to *start* a search is in the
  113. * 'key' bindings above */
  114. tll(struct config_key_binding_search) search;
  115. } bindings;
  116. struct {
  117. enum { CONF_CSD_PREFER_NONE, CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred;
  118. int title_height;
  119. int border_width;
  120. int button_width;
  121. struct {
  122. bool title_set;
  123. bool minimize_set;
  124. bool maximize_set;
  125. bool close_set;
  126. uint32_t title;
  127. uint32_t minimize;
  128. uint32_t maximize;
  129. uint32_t close;
  130. } color;
  131. } csd;
  132. size_t render_worker_count;
  133. char *server_socket_path;
  134. bool presentation_timings;
  135. bool hold_at_exit;
  136. struct {
  137. enum fcft_scaling_filter fcft_filter;
  138. bool allow_overflowing_double_width_glyphs;
  139. bool render_timer_osd;
  140. bool render_timer_log;
  141. bool damage_whole_window;
  142. uint64_t delayed_render_lower_ns;
  143. uint64_t delayed_render_upper_ns;
  144. off_t max_shm_pool_size;
  145. } tweak;
  146. user_notifications_t notifications;
  147. };
  148. bool config_load(
  149. struct config *conf, const char *path,
  150. user_notifications_t *initial_user_notifications, bool errors_are_fatal);
  151. void config_free(struct config conf);
  152. struct config_font config_font_parse(const char *pattern);
  153. void config_font_destroy(struct config_font *font);