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