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
9 * A_BOLD Extra bright or bold
10 * A_PROTECT Protected mode
11 * A_INVIS Invisible or blank mode
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 */
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] */
42 /* number of clients in master area */
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" };
62 #include "fullscreen.c"
64 /* by default the first layout entry is used */
65 static Layout layouts
[] = {
69 { "[ ]", fullscreen
},
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', }, { focusdown
, { NULL
} } },
86 { { MOD
, 'K', }, { focusup
, { NULL
} } },
87 { { MOD
, 'H', }, { focusleft
, { NULL
} } },
88 { { MOD
, 'L', }, { focusright
, { NULL
} } },
89 { { MOD
, 'k', }, { focusprev
, { NULL
} } },
90 { { MOD
, 'f', }, { setlayout
, { "[]=" } } },
91 { { MOD
, 'g', }, { setlayout
, { "+++" } } },
92 { { MOD
, 'b', }, { setlayout
, { "TTT" } } },
93 { { MOD
, 'm', }, { setlayout
, { "[ ]" } } },
94 { { MOD
, ' ', }, { setlayout
, { NULL
} } },
95 { { MOD
, 'i', }, { incnmaster
, { "+1" } } },
96 { { MOD
, 'd', }, { incnmaster
, { "-1" } } },
97 { { MOD
, 'h', }, { setmfact
, { "-0.05" } } },
98 { { MOD
, 'l', }, { setmfact
, { "+0.05" } } },
99 { { MOD
, '.', }, { toggleminimize
, { NULL
} } },
100 { { MOD
, 's', }, { togglebar
, { NULL
} } },
101 { { MOD
, 'S', }, { togglebarpos
, { NULL
} } },
102 { { MOD
, 'M', }, { togglemouse
, { NULL
} } },
103 { { MOD
, '\n', }, { zoom
, { NULL
} } },
104 { { MOD
, '\r', }, { zoom
, { NULL
} } },
105 { { MOD
, '1', }, { focusn
, { "1" } } },
106 { { MOD
, '2', }, { focusn
, { "2" } } },
107 { { MOD
, '3', }, { focusn
, { "3" } } },
108 { { MOD
, '4', }, { focusn
, { "4" } } },
109 { { MOD
, '5', }, { focusn
, { "5" } } },
110 { { MOD
, '6', }, { focusn
, { "6" } } },
111 { { MOD
, '7', }, { focusn
, { "7" } } },
112 { { MOD
, '8', }, { focusn
, { "8" } } },
113 { { MOD
, '9', }, { focusn
, { "9" } } },
114 { { MOD
, '\t', }, { focuslast
, { NULL
} } },
115 { { MOD
, 'q', 'q', }, { quit
, { NULL
} } },
116 { { MOD
, 'a', }, { togglerunall
, { NULL
} } },
117 { { MOD
, CTRL('L'), }, { redraw
, { NULL
} } },
118 { { MOD
, 'r', }, { redraw
, { NULL
} } },
119 { { MOD
, 'e', }, { copymode
, { "dvtm-editor" } } },
120 { { MOD
, 'E', }, { copymode
, { "dvtm-pager" } } },
121 { { MOD
, '/', }, { copymode
, { "dvtm-pager", "/" } } },
122 { { MOD
, 'p', }, { paste
, { NULL
} } },
123 { { MOD
, KEY_PPAGE
, }, { scrollback
, { "-1" } } },
124 { { MOD
, KEY_NPAGE
, }, { scrollback
, { "1" } } },
125 { { MOD
, '?', }, { create
, { "man dvtm", "dvtm help" } } },
126 { { MOD
, MOD
, }, { send
, { (const char []){MOD
, 0} } } },
127 { { KEY_SPREVIOUS
, }, { scrollback
, { "-1" } } },
128 { { KEY_SNEXT
, }, { scrollback
, { "1" } } },
129 { { MOD
, '0', }, { view
, { NULL
} } },
130 { { MOD
, KEY_F(1), }, { view
, { tags
[0] } } },
131 { { MOD
, KEY_F(2), }, { view
, { tags
[1] } } },
132 { { MOD
, KEY_F(3), }, { view
, { tags
[2] } } },
133 { { MOD
, KEY_F(4), }, { view
, { tags
[3] } } },
134 { { MOD
, KEY_F(5), }, { view
, { tags
[4] } } },
135 { { MOD
, 'v', '0' }, { view
, { NULL
} } },
136 { { MOD
, 'v', '\t', }, { viewprevtag
, { NULL
} } },
137 { { MOD
, 't', '0' }, { tag
, { NULL
} } },
145 static const ColorRule colorrules
[] = {
146 { "", A_NORMAL
, &colors
[DEFAULT
] }, /* default */
149 /* possible values for the mouse buttons are listed below:
151 * BUTTON1_PRESSED mouse button 1 down
152 * BUTTON1_RELEASED mouse button 1 up
153 * BUTTON1_CLICKED mouse button 1 clicked
154 * BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked
155 * BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked
156 * BUTTON2_PRESSED mouse button 2 down
157 * BUTTON2_RELEASED mouse button 2 up
158 * BUTTON2_CLICKED mouse button 2 clicked
159 * BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked
160 * BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked
161 * BUTTON3_PRESSED mouse button 3 down
162 * BUTTON3_RELEASED mouse button 3 up
163 * BUTTON3_CLICKED mouse button 3 clicked
164 * BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked
165 * BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked
166 * BUTTON4_PRESSED mouse button 4 down
167 * BUTTON4_RELEASED mouse button 4 up
168 * BUTTON4_CLICKED mouse button 4 clicked
169 * BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked
170 * BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked
171 * BUTTON_SHIFT shift was down during button state change
172 * BUTTON_CTRL control was down during button state change
173 * BUTTON_ALT alt was down during button state change
174 * ALL_MOUSE_EVENTS report all button state changes
175 * REPORT_MOUSE_POSITION report mouse movement
178 #ifdef NCURSES_MOUSE_VERSION
179 # define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
182 #define ENABLE_MOUSE true /* whether to enable mouse events by default */
185 static Button buttons
[] = {
186 { BUTTON1_CLICKED
, { mouse_focus
, { NULL
} } },
187 { BUTTON1_DOUBLE_CLICKED
, { mouse_fullscreen
, { "[ ]" } } },
188 { BUTTON2_CLICKED
, { mouse_zoom
, { NULL
} } },
189 { BUTTON3_CLICKED
, { mouse_minimize
, { NULL
} } },
191 #endif /* CONFIG_MOUSE */
193 static Cmd commands
[] = {
194 /* create [cmd]: create a new window, run `cmd` in the shell if specified */
195 { "create", { create
, { NULL
} } },
196 /* focus <win_id>: focus the window whose `DVTM_WINDOW_ID` is `win_id` */
197 { "focus", { focusid
, { NULL
} } },
198 /* tag <win_id> <tag> [tag ...]: add +tag, remove -tag or set tag of the window with the given identifier */
199 { "tag", { tagid
, { NULL
} } },
202 /* gets executed when dvtm is started */
203 static Action actions
[] = {
204 { create
, { NULL
} },
207 static char const * const keytable
[] = {
208 /* add your custom key escape sequences */