config.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /* valid curses attributes are listed below they can be ORed
  2. *
  3. * A_NORMAL Normal display (no highlight)
  4. * A_STANDOUT Best highlighting mode of the terminal.
  5. * A_UNDERLINE Underlining
  6. * A_REVERSE Reverse video
  7. * A_BLINK Blinking
  8. * A_DIM Half bright
  9. * A_BOLD Extra bright or bold
  10. * A_PROTECT Protected mode
  11. * A_INVIS Invisible or blank mode
  12. */
  13. enum {
  14. DEFAULT,
  15. BLUE,
  16. };
  17. static Color colors[] = {
  18. [DEFAULT] = { .fg = -1, .bg = -1, .fg256 = -1, .bg256 = -1, },
  19. [BLUE] = { .fg = COLOR_BLUE, .bg = -1, .fg256 = 68, .bg256 = -1, },
  20. };
  21. #define COLOR(c) COLOR_PAIR(colors[c].pair)
  22. /* curses attributes for the currently focused window */
  23. #define SELECTED_ATTR (COLOR(BLUE) | A_NORMAL)
  24. /* curses attributes for normal (not selected) windows */
  25. #define NORMAL_ATTR (COLOR(DEFAULT) | A_NORMAL)
  26. /* curses attributes for a window with pending urgent flag */
  27. #define URGENT_ATTR NORMAL_ATTR
  28. /* curses attributes for the status bar */
  29. #define BAR_ATTR (COLOR(BLUE) | A_NORMAL)
  30. /* characters for beginning and end of status bar message */
  31. #define BAR_BEGIN '['
  32. #define BAR_END ']'
  33. /* status bar (command line option -s) position */
  34. #define BAR_POS BAR_TOP /* BAR_BOTTOM, BAR_OFF */
  35. /* whether status bar should be hidden if only one client exists */
  36. #define BAR_AUTOHIDE true
  37. /* master width factor [0.1 .. 0.9] */
  38. #define MFACT 0.5
  39. /* number of clients in master area */
  40. #define NMASTER 1
  41. /* scroll back buffer size in lines */
  42. #define SCROLL_HISTORY 500
  43. /* printf format string for the tag in the status bar */
  44. #define TAG_SYMBOL "[%s]"
  45. /* curses attributes for the currently selected tags */
  46. #define TAG_SEL (COLOR(BLUE) | A_BOLD)
  47. /* curses attributes for not selected tags which contain no windows */
  48. #define TAG_NORMAL (COLOR(DEFAULT) | A_NORMAL)
  49. /* curses attributes for not selected tags which contain windows */
  50. #define TAG_OCCUPIED (COLOR(BLUE) | A_NORMAL)
  51. /* curses attributes for not selected tags which with urgent windows */
  52. #define TAG_URGENT (COLOR(BLUE) | A_NORMAL | A_BLINK)
  53. const char tags[][8] = { "1", "2", "3", "4", "5" };
  54. #include "tile.c"
  55. #include "grid.c"
  56. #include "bstack.c"
  57. #include "fullscreen.c"
  58. /* by default the first layout entry is used */
  59. static Layout layouts[] = {
  60. { "[]=", tile },
  61. { "+++", grid },
  62. { "TTT", bstack },
  63. { "[ ]", fullscreen },
  64. };
  65. #define MOD CTRL('g')
  66. #define TAGKEYS(KEY,TAG) \
  67. { { MOD, 'v', KEY, }, { view, { tags[TAG] } } }, \
  68. { { MOD, 't', KEY, }, { tag, { tags[TAG] } } }, \
  69. { { MOD, 'V', KEY, }, { toggleview, { tags[TAG] } } }, \
  70. { { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } },
  71. /* you can at most specifiy MAX_ARGS (3) number of arguments */
  72. static KeyBinding bindings[] = {
  73. { { MOD, 'c', }, { create, { NULL } } },
  74. { { MOD, 'C', }, { create, { NULL, NULL, "$CWD" } } },
  75. { { MOD, 'x', 'x', }, { killclient, { NULL } } },
  76. { { MOD, 'j', }, { focusnext, { NULL } } },
  77. { { MOD, 'J', }, { focusnextnm, { NULL } } },
  78. { { MOD, 'K', }, { focusprevnm, { NULL } } },
  79. { { MOD, 'k', }, { focusprev, { NULL } } },
  80. { { MOD, 'f', }, { setlayout, { "[]=" } } },
  81. { { MOD, 'g', }, { setlayout, { "+++" } } },
  82. { { MOD, 'b', }, { setlayout, { "TTT" } } },
  83. { { MOD, 'm', }, { setlayout, { "[ ]" } } },
  84. { { MOD, ' ', }, { setlayout, { NULL } } },
  85. { { MOD, 'i', }, { incnmaster, { "+1" } } },
  86. { { MOD, 'd', }, { incnmaster, { "-1" } } },
  87. { { MOD, 'h', }, { setmfact, { "-0.05" } } },
  88. { { MOD, 'l', }, { setmfact, { "+0.05" } } },
  89. { { MOD, '.', }, { toggleminimize, { NULL } } },
  90. { { MOD, 's', }, { togglebar, { NULL } } },
  91. { { MOD, 'S', }, { togglebarpos, { NULL } } },
  92. { { MOD, 'M', }, { togglemouse, { NULL } } },
  93. { { MOD, '\n', }, { zoom , { NULL } } },
  94. { { MOD, '\r', }, { zoom , { NULL } } },
  95. { { MOD, '1', }, { focusn, { "1" } } },
  96. { { MOD, '2', }, { focusn, { "2" } } },
  97. { { MOD, '3', }, { focusn, { "3" } } },
  98. { { MOD, '4', }, { focusn, { "4" } } },
  99. { { MOD, '5', }, { focusn, { "5" } } },
  100. { { MOD, '6', }, { focusn, { "6" } } },
  101. { { MOD, '7', }, { focusn, { "7" } } },
  102. { { MOD, '8', }, { focusn, { "8" } } },
  103. { { MOD, '9', }, { focusn, { "9" } } },
  104. { { MOD, '\t', }, { focuslast, { NULL } } },
  105. { { MOD, 'q', 'q', }, { quit, { NULL } } },
  106. { { MOD, 'a', }, { togglerunall, { NULL } } },
  107. { { MOD, CTRL('L'), }, { redraw, { NULL } } },
  108. { { MOD, 'r', }, { redraw, { NULL } } },
  109. { { MOD, 'e', }, { copymode, { NULL } } },
  110. { { MOD, '/', }, { copymode, { "/" } } },
  111. { { MOD, 'p', }, { paste, { NULL } } },
  112. { { MOD, KEY_PPAGE, }, { scrollback, { "-1" } } },
  113. { { MOD, KEY_NPAGE, }, { scrollback, { "1" } } },
  114. { { MOD, '?', }, { create, { "man dvtm", "dvtm help" } } },
  115. { { MOD, MOD, }, { send, { (const char []){MOD, 0} } } },
  116. { { KEY_SPREVIOUS, }, { scrollback, { "-1" } } },
  117. { { KEY_SNEXT, }, { scrollback, { "1" } } },
  118. { { MOD, '0', }, { view, { NULL } } },
  119. { { MOD, KEY_F(1), }, { view, { tags[0] } } },
  120. { { MOD, KEY_F(2), }, { view, { tags[1] } } },
  121. { { MOD, KEY_F(3), }, { view, { tags[2] } } },
  122. { { MOD, KEY_F(4), }, { view, { tags[3] } } },
  123. { { MOD, KEY_F(5), }, { view, { tags[4] } } },
  124. { { MOD, 'v', '0' }, { view, { NULL } } },
  125. { { MOD, 'v', '\t', }, { viewprevtag, { NULL } } },
  126. { { MOD, 't', '0' }, { tag, { NULL } } },
  127. TAGKEYS( '1', 0)
  128. TAGKEYS( '2', 1)
  129. TAGKEYS( '3', 2)
  130. TAGKEYS( '4', 3)
  131. TAGKEYS( '5', 4)
  132. };
  133. static const ColorRule colorrules[] = {
  134. { "", A_NORMAL, &colors[DEFAULT] }, /* default */
  135. };
  136. /* possible values for the mouse buttons are listed below:
  137. *
  138. * BUTTON1_PRESSED mouse button 1 down
  139. * BUTTON1_RELEASED mouse button 1 up
  140. * BUTTON1_CLICKED mouse button 1 clicked
  141. * BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked
  142. * BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked
  143. * BUTTON2_PRESSED mouse button 2 down
  144. * BUTTON2_RELEASED mouse button 2 up
  145. * BUTTON2_CLICKED mouse button 2 clicked
  146. * BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked
  147. * BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked
  148. * BUTTON3_PRESSED mouse button 3 down
  149. * BUTTON3_RELEASED mouse button 3 up
  150. * BUTTON3_CLICKED mouse button 3 clicked
  151. * BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked
  152. * BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked
  153. * BUTTON4_PRESSED mouse button 4 down
  154. * BUTTON4_RELEASED mouse button 4 up
  155. * BUTTON4_CLICKED mouse button 4 clicked
  156. * BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked
  157. * BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked
  158. * BUTTON_SHIFT shift was down during button state change
  159. * BUTTON_CTRL control was down during button state change
  160. * BUTTON_ALT alt was down during button state change
  161. * ALL_MOUSE_EVENTS report all button state changes
  162. * REPORT_MOUSE_POSITION report mouse movement
  163. */
  164. #ifdef NCURSES_MOUSE_VERSION
  165. # define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
  166. #endif
  167. #define ENABLE_MOUSE true /* whether to enable mouse events by default */
  168. #ifdef CONFIG_MOUSE
  169. static Button buttons[] = {
  170. { BUTTON1_CLICKED, { mouse_focus, { NULL } } },
  171. { BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
  172. { BUTTON2_CLICKED, { mouse_zoom, { NULL } } },
  173. { BUTTON3_CLICKED, { mouse_minimize, { NULL } } },
  174. };
  175. #endif /* CONFIG_MOUSE */
  176. static Cmd commands[] = {
  177. { "create", { create, { NULL } } },
  178. };
  179. /* gets executed when dvtm is started */
  180. static Action actions[] = {
  181. { create, { NULL } },
  182. };
  183. static char const * const keytable[] = {
  184. /* add your custom key escape sequences */
  185. };
  186. /* editor to use for copy mode. If neither of DVTM_EDITOR, EDITOR and PAGER is
  187. * set the first entry is chosen. Otherwise the array is consulted for supported
  188. * options. A %d in argv is replaced by the line number at which the file should
  189. * be opened. If filter is true the editor is expected to work even if stdout is
  190. * redirected (i.e. not a terminal). If color is true then color escape sequences
  191. * are generated in the output.
  192. */
  193. static Editor editors[] = {
  194. { .name = "vis", .argv = { "vis", "+%d", "-", NULL }, .filter = true, .color = false },
  195. { .name = "sandy", .argv = { "sandy", "-d", "-", NULL }, .filter = true, .color = false },
  196. { .name = "dvtm-editor", .argv = { "dvtm-editor", "-", NULL }, .filter = true, .color = false },
  197. { .name = "vim", .argv = { "vim", "+%d", "-", NULL }, .filter = false, .color = false },
  198. { .name = "less", .argv = { "less", "-R", "+%d", NULL }, .filter = false, .color = true },
  199. { .name = "more", .argv = { "more", "+%d", NULL }, .filter = false, .color = false },
  200. };