]> Dogcows Code - chaz/openbox/blob - openbox/config.c
option to make dragging and findedge ignore windows on lower layers
[chaz/openbox] / openbox / config.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 config.c for the Openbox window manager
4 Copyright (c) 2004 Mikael Magnusson
5 Copyright (c) 2003 Ben Jansens
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #include "config.h"
21 #include "keyboard.h"
22 #include "mouse.h"
23 #include "prop.h"
24 #include "translate.h"
25 #include "parser/parse.h"
26 #include "openbox.h"
27
28 gboolean config_focus_new;
29 gboolean config_focus_follow;
30 guint config_focus_delay;
31 gboolean config_focus_raise;
32 gboolean config_focus_last;
33
34 ObPlacePolicy config_place_policy;
35
36 gchar *config_theme;
37 gboolean config_theme_keepborder;
38
39 gchar *config_title_layout;
40
41 gint config_desktops_num;
42 GSList *config_desktops_names;
43 gint config_screen_firstdesk;
44
45 gboolean config_resize_redraw;
46 gint config_resize_popup_show;
47 gint config_resize_popup_pos;
48
49 ObStackingLayer config_dock_layer;
50 gboolean config_dock_floating;
51 ObDirection config_dock_pos;
52 gint config_dock_x;
53 gint config_dock_y;
54 ObOrientation config_dock_orient;
55 gboolean config_dock_hide;
56 guint config_dock_hide_delay;
57 guint config_dock_app_move_button;
58 guint config_dock_app_move_modifiers;
59
60 guint config_keyboard_reset_keycode;
61 guint config_keyboard_reset_state;
62
63 gint config_mouse_threshold;
64 gint config_mouse_dclicktime;
65
66 gboolean config_menu_warppointer;
67 gboolean config_menu_xorstyle;
68 gboolean config_menu_hilightfirst;
69 guint config_menu_hide_delay;
70
71 GSList *config_menu_files;
72
73 gint config_resist_win;
74 gint config_resist_edge;
75
76 gboolean config_resist_layers_below;
77
78 /*
79
80 <keybind key="C-x">
81 <action name="ChangeDesktop">
82 <desktop>3</desktop>
83 </action>
84 </keybind>
85
86 */
87
88 static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
89 GList *keylist)
90 {
91 gchar *key;
92 ObAction *action;
93 xmlNodePtr n, nact;
94 GList *it;
95
96 if ((n = parse_find_node("chainQuitKey", node))) {
97 key = parse_string(doc, n);
98 translate_key(key, &config_keyboard_reset_state,
99 &config_keyboard_reset_keycode);
100 g_free(key);
101 }
102
103 n = parse_find_node("keybind", node);
104 while (n) {
105 if (parse_attr_string("key", n, &key)) {
106 keylist = g_list_append(keylist, key);
107
108 parse_key(i, doc, n->children, keylist);
109
110 it = g_list_last(keylist);
111 g_free(it->data);
112 keylist = g_list_delete_link(keylist, it);
113 }
114 n = parse_find_node("keybind", n->next);
115 }
116 if (keylist) {
117 nact = parse_find_node("action", node);
118 while (nact) {
119 if ((action = action_parse(i, doc, nact,
120 OB_USER_ACTION_KEYBOARD_KEY)))
121 keyboard_bind(keylist, action);
122 nact = parse_find_node("action", nact->next);
123 }
124 }
125 }
126
127 static void parse_keyboard(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
128 gpointer d)
129 {
130 keyboard_unbind_all();
131
132 parse_key(i, doc, node->children, NULL);
133 }
134
135 /*
136
137 <context name="Titlebar">
138 <mousebind button="Left" action="Press">
139 <action name="Raise"></action>
140 </mousebind>
141 </context>
142
143 */
144
145 static void parse_mouse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
146 gpointer d)
147 {
148 xmlNodePtr n, nbut, nact;
149 gchar *buttonstr;
150 gchar *contextstr;
151 ObUserAction uact;
152 ObMouseAction mact;
153 ObAction *action;
154
155 mouse_unbind_all();
156
157 node = node->children;
158
159 if ((n = parse_find_node("dragThreshold", node)))
160 config_mouse_threshold = parse_int(doc, n);
161 if ((n = parse_find_node("doubleClickTime", node)))
162 config_mouse_dclicktime = parse_int(doc, n);
163
164 n = parse_find_node("context", node);
165 while (n) {
166 if (!parse_attr_string("name", n, &contextstr))
167 goto next_n;
168 nbut = parse_find_node("mousebind", n->children);
169 while (nbut) {
170 if (!parse_attr_string("button", nbut, &buttonstr))
171 goto next_nbut;
172 if (parse_attr_contains("press", nbut, "action")) {
173 uact = OB_USER_ACTION_MOUSE_PRESS;
174 mact = OB_MOUSE_ACTION_PRESS;
175 } else if (parse_attr_contains("release", nbut, "action")) {
176 uact = OB_USER_ACTION_MOUSE_RELEASE;
177 mact = OB_MOUSE_ACTION_RELEASE;
178 } else if (parse_attr_contains("click", nbut, "action")) {
179 uact = OB_USER_ACTION_MOUSE_CLICK;
180 mact = OB_MOUSE_ACTION_CLICK;
181 } else if (parse_attr_contains("doubleclick", nbut,"action")) {
182 uact = OB_USER_ACTION_MOUSE_DOUBLE_CLICK;
183 mact = OB_MOUSE_ACTION_DOUBLE_CLICK;
184 } else if (parse_attr_contains("drag", nbut, "action")) {
185 uact = OB_USER_ACTION_MOUSE_MOTION;
186 mact = OB_MOUSE_ACTION_MOTION;
187 } else
188 goto next_nbut;
189 nact = parse_find_node("action", nbut->children);
190 while (nact) {
191 if ((action = action_parse(i, doc, nact, uact)))
192 mouse_bind(buttonstr, contextstr, mact, action);
193 nact = parse_find_node("action", nact->next);
194 }
195 g_free(buttonstr);
196 next_nbut:
197 nbut = parse_find_node("mousebind", nbut->next);
198 }
199 g_free(contextstr);
200 next_n:
201 n = parse_find_node("context", n->next);
202 }
203 }
204
205 static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
206 gpointer d)
207 {
208 xmlNodePtr n;
209
210 node = node->children;
211
212 if ((n = parse_find_node("focusNew", node)))
213 config_focus_new = parse_bool(doc, n);
214 if ((n = parse_find_node("followMouse", node)))
215 config_focus_follow = parse_bool(doc, n);
216 if ((n = parse_find_node("focusDelay", node)))
217 config_focus_delay = parse_int(doc, n) * 1000;
218 if ((n = parse_find_node("raiseOnFocus", node)))
219 config_focus_raise = parse_bool(doc, n);
220 if ((n = parse_find_node("focusLast", node)))
221 config_focus_last = parse_bool(doc, n);
222 }
223
224 static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
225 gpointer d)
226 {
227 xmlNodePtr n;
228
229 node = node->children;
230
231 if ((n = parse_find_node("policy", node)))
232 if (parse_contains("UnderMouse", doc, n))
233 config_place_policy = OB_PLACE_POLICY_MOUSE;
234 }
235
236 static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
237 gpointer d)
238 {
239 xmlNodePtr n;
240
241 node = node->children;
242
243 if ((n = parse_find_node("name", node))) {
244 gchar *c;
245
246 g_free(config_theme);
247 c = parse_string(doc, n);
248 config_theme = parse_expand_tilde(c);
249 g_free(c);
250 }
251 if ((n = parse_find_node("titleLayout", node))) {
252 g_free(config_title_layout);
253 config_title_layout = parse_string(doc, n);
254 }
255 if ((n = parse_find_node("keepBorder", node)))
256 config_theme_keepborder = parse_bool(doc, n);
257 }
258
259 static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
260 gpointer d)
261 {
262 xmlNodePtr n;
263
264 node = node->children;
265
266 if ((n = parse_find_node("number", node))) {
267 gint d = parse_int(doc, n);
268 if (d > 0)
269 config_desktops_num = d;
270 }
271 if ((n = parse_find_node("firstdesk", node))) {
272 gint d = parse_int(doc, n);
273 if (d > 0)
274 config_screen_firstdesk = d;
275 }
276 if ((n = parse_find_node("names", node))) {
277 GSList *it;
278 xmlNodePtr nname;
279
280 for (it = config_desktops_names; it; it = it->next)
281 g_free(it->data);
282 g_slist_free(config_desktops_names);
283 config_desktops_names = NULL;
284
285 nname = parse_find_node("name", n->children);
286 while (nname) {
287 config_desktops_names = g_slist_append(config_desktops_names,
288 parse_string(doc, nname));
289 nname = parse_find_node("name", nname->next);
290 }
291 }
292 }
293
294 static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
295 gpointer d)
296 {
297 xmlNodePtr n;
298
299 node = node->children;
300
301 if ((n = parse_find_node("drawContents", node)))
302 config_resize_redraw = parse_bool(doc, n);
303 if ((n = parse_find_node("popupShow", node))) {
304 config_resize_popup_show = parse_int(doc, n);
305 if (parse_contains("Always", doc, n))
306 config_resize_popup_show = 2;
307 else if (parse_contains("Never", doc, n))
308 config_resize_popup_show = 0;
309 else if (parse_contains("Nonpixel", doc, n))
310 config_resize_popup_show = 1;
311 }
312 if ((n = parse_find_node("popupPosition", node))) {
313 config_resize_popup_pos = parse_int(doc, n);
314 if (parse_contains("Top", doc, n))
315 config_resize_popup_pos = 1;
316 else if (parse_contains("Center", doc, n))
317 config_resize_popup_pos = 0;
318 }
319 }
320
321 static void parse_dock(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
322 gpointer d)
323 {
324 xmlNodePtr n;
325
326 node = node->children;
327
328 if ((n = parse_find_node("position", node))) {
329 if (parse_contains("TopLeft", doc, n))
330 config_dock_floating = FALSE,
331 config_dock_pos = OB_DIRECTION_NORTHWEST;
332 else if (parse_contains("Top", doc, n))
333 config_dock_floating = FALSE,
334 config_dock_pos = OB_DIRECTION_NORTH;
335 else if (parse_contains("TopRight", doc, n))
336 config_dock_floating = FALSE,
337 config_dock_pos = OB_DIRECTION_NORTHEAST;
338 else if (parse_contains("Right", doc, n))
339 config_dock_floating = FALSE,
340 config_dock_pos = OB_DIRECTION_EAST;
341 else if (parse_contains("BottomRight", doc, n))
342 config_dock_floating = FALSE,
343 config_dock_pos = OB_DIRECTION_SOUTHEAST;
344 else if (parse_contains("Bottom", doc, n))
345 config_dock_floating = FALSE,
346 config_dock_pos = OB_DIRECTION_SOUTH;
347 else if (parse_contains("BottomLeft", doc, n))
348 config_dock_floating = FALSE,
349 config_dock_pos = OB_DIRECTION_SOUTHWEST;
350 else if (parse_contains("Left", doc, n))
351 config_dock_floating = FALSE,
352 config_dock_pos = OB_DIRECTION_WEST;
353 else if (parse_contains("Floating", doc, n))
354 config_dock_floating = TRUE;
355 }
356 if (config_dock_floating) {
357 if ((n = parse_find_node("floatingX", node)))
358 config_dock_x = parse_int(doc, n);
359 if ((n = parse_find_node("floatingY", node)))
360 config_dock_y = parse_int(doc, n);
361 }
362 if ((n = parse_find_node("stacking", node))) {
363 if (parse_contains("top", doc, n))
364 config_dock_layer = OB_STACKING_LAYER_DOCK_ABOVE;
365 else if (parse_contains("normal", doc, n))
366 config_dock_layer = OB_STACKING_LAYER_DOCK_NORMAL;
367 else if (parse_contains("bottom", doc, n))
368 config_dock_layer = OB_STACKING_LAYER_DOCK_BELOW;
369 }
370 if ((n = parse_find_node("direction", node))) {
371 if (parse_contains("horizontal", doc, n))
372 config_dock_orient = OB_ORIENTATION_HORZ;
373 else if (parse_contains("vertical", doc, n))
374 config_dock_orient = OB_ORIENTATION_VERT;
375 }
376 if ((n = parse_find_node("autoHide", node)))
377 config_dock_hide = parse_bool(doc, n);
378 if ((n = parse_find_node("hideDelay", node)))
379 config_dock_hide_delay = parse_int(doc, n) * 1000;
380 if ((n = parse_find_node("moveButton", node))) {
381 gchar *str = parse_string(doc, n);
382 guint b, s;
383 if (translate_button(str, &s, &b)) {
384 config_dock_app_move_button = b;
385 config_dock_app_move_modifiers = s;
386 } else {
387 g_warning("invalid button '%s'", str);
388 }
389 g_free(str);
390 }
391 }
392
393 static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
394 gpointer d)
395 {
396 xmlNodePtr n;
397 for (node = node->children; node; node = node->next) {
398 if (!xmlStrcasecmp(node->name, (const xmlChar*) "file")) {
399 gchar *c;
400
401 c = parse_string(doc, node);
402 config_menu_files = g_slist_append(config_menu_files,
403 parse_expand_tilde(c));
404 g_free(c);
405 }
406 if ((n = parse_find_node("warpPointer", node)))
407 config_menu_warppointer = parse_bool(doc, n);
408 if ((n = parse_find_node("xorStyle", node)))
409 config_menu_xorstyle = parse_bool(doc, n);
410 if ((n = parse_find_node("hilightFirst", node)))
411 config_menu_hilightfirst = parse_bool(doc, n);
412 if ((n = parse_find_node("hideDelay", node)))
413 config_menu_hide_delay = parse_int(doc, n);
414 }
415 }
416
417 static void parse_resistance(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
418 gpointer d)
419 {
420 xmlNodePtr n;
421
422 node = node->children;
423 if ((n = parse_find_node("strength", node)))
424 config_resist_win = parse_int(doc, n);
425 if ((n = parse_find_node("screen_edge_strength", node)))
426 config_resist_edge = parse_int(doc, n);
427 if ((n = parse_find_node("edges_hit_layers_below", node)))
428 config_resist_layers_below = parse_bool(doc, n);
429 }
430
431 typedef struct
432 {
433 const gchar *key;
434 const gchar *actname;
435 } ObDefKeyBind;
436
437 static void bind_default_keyboard()
438 {
439 ObDefKeyBind *it;
440 ObDefKeyBind binds[] = {
441 { "A-Tab", "NextWindow" },
442 { "S-A-Tab", "PreviousWindow" },
443 { "A-F4", "Close" },
444 { NULL, NULL }
445 };
446
447 for (it = binds; it->key; ++it) {
448 GList *l = g_list_append(NULL, g_strdup(it->key));
449 keyboard_bind(l, action_from_string(it->actname,
450 OB_USER_ACTION_KEYBOARD_KEY));
451 }
452 }
453
454 typedef struct
455 {
456 const gchar *button;
457 const gchar *context;
458 const ObMouseAction mact;
459 const gchar *actname;
460 } ObDefMouseBind;
461
462 static void bind_default_mouse()
463 {
464 ObDefMouseBind *it;
465 ObDefMouseBind binds[] = {
466 { "Left", "Client", OB_MOUSE_ACTION_PRESS, "Focus" },
467 { "Middle", "Client", OB_MOUSE_ACTION_PRESS, "Focus" },
468 { "Right", "Client", OB_MOUSE_ACTION_PRESS, "Focus" },
469 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" },
470 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" },
471 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" },
472 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS, "Focus" },
473 { "Left", "Handle", OB_MOUSE_ACTION_PRESS, "Focus" },
474 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
475 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
476 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
477 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
478 { "Left", "Close", OB_MOUSE_ACTION_PRESS, "Focus" },
479 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS, "Focus" },
480 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS, "Focus" },
481 { "Left", "Icon", OB_MOUSE_ACTION_PRESS, "Focus" },
482 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS, "Focus" },
483 { "Left", "Shade", OB_MOUSE_ACTION_PRESS, "Focus" },
484 { "Left", "Client", OB_MOUSE_ACTION_CLICK, "Raise" },
485 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK, "Raise" },
486 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK, "Lower" },
487 { "Left", "Handle", OB_MOUSE_ACTION_CLICK, "Raise" },
488 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
489 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
490 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
491 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
492 { "Left", "Close", OB_MOUSE_ACTION_CLICK, "Raise" },
493 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK, "Raise" },
494 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK, "Raise" },
495 { "Left", "Icon", OB_MOUSE_ACTION_CLICK, "Raise" },
496 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK, "Raise" },
497 { "Left", "Shade", OB_MOUSE_ACTION_CLICK, "Raise" },
498 { "Left", "Close", OB_MOUSE_ACTION_CLICK, "Close" },
499 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK, "ToggleMaximizeFull" },
500 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK, "Iconify" },
501 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK, "ToggleOmnipresent" },
502 { "Left", "Shade", OB_MOUSE_ACTION_CLICK, "ToggleShade" },
503 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
504 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
505 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
506 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
507 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION, "Move" },
508 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION, "Move" },
509 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION, "Resize" },
510 { NULL, NULL, 0, NULL }
511 };
512
513 for (it = binds; it->button; ++it) {
514 ObUserAction uact;
515 switch (it->mact) {
516 case OB_MOUSE_ACTION_PRESS:
517 uact = OB_USER_ACTION_MOUSE_PRESS; break;
518 case OB_MOUSE_ACTION_RELEASE:
519 uact = OB_USER_ACTION_MOUSE_RELEASE; break;
520 case OB_MOUSE_ACTION_CLICK:
521 uact = OB_USER_ACTION_MOUSE_CLICK; break;
522 case OB_MOUSE_ACTION_DOUBLE_CLICK:
523 uact = OB_USER_ACTION_MOUSE_DOUBLE_CLICK; break;
524 case OB_MOUSE_ACTION_MOTION:
525 uact = OB_USER_ACTION_MOUSE_MOTION; break;
526 case OB_NUM_MOUSE_ACTIONS:
527 g_assert_not_reached();
528 }
529 mouse_bind(it->button, it->context, it->mact,
530 action_from_string(it->actname, uact));
531 }
532 }
533
534 void config_startup(ObParseInst *i)
535 {
536 config_focus_new = TRUE;
537 config_focus_follow = FALSE;
538 config_focus_delay = 0;
539 config_focus_raise = FALSE;
540 config_focus_last = FALSE;
541
542 parse_register(i, "focus", parse_focus, NULL);
543
544 config_place_policy = OB_PLACE_POLICY_SMART;
545
546 parse_register(i, "placement", parse_placement, NULL);
547
548 config_theme = NULL;
549
550 config_title_layout = g_strdup("NLIMC");
551 config_theme_keepborder = TRUE;
552
553 parse_register(i, "theme", parse_theme, NULL);
554
555 config_desktops_num = 4;
556 config_screen_firstdesk = 1;
557 config_desktops_names = NULL;
558
559 parse_register(i, "desktops", parse_desktops, NULL);
560
561 config_resize_redraw = TRUE;
562 config_resize_popup_show = 1; /* nonpixel increments */
563 config_resize_popup_pos = 0; /* center of client */
564
565 parse_register(i, "resize", parse_resize, NULL);
566
567 config_dock_layer = OB_STACKING_LAYER_DOCK_ABOVE;
568 config_dock_pos = OB_DIRECTION_NORTHEAST;
569 config_dock_floating = FALSE;
570 config_dock_x = 0;
571 config_dock_y = 0;
572 config_dock_orient = OB_ORIENTATION_VERT;
573 config_dock_hide = FALSE;
574 config_dock_hide_delay = 300;
575 config_dock_app_move_button = 2; /* middle */
576 config_dock_app_move_modifiers = 0;
577
578 parse_register(i, "dock", parse_dock, NULL);
579
580 translate_key("C-g", &config_keyboard_reset_state,
581 &config_keyboard_reset_keycode);
582
583 bind_default_keyboard();
584
585 parse_register(i, "keyboard", parse_keyboard, NULL);
586
587 config_mouse_threshold = 3;
588 config_mouse_dclicktime = 200;
589
590 bind_default_mouse();
591
592 parse_register(i, "mouse", parse_mouse, NULL);
593
594 config_resist_win = 10;
595 config_resist_edge = 20;
596 config_resist_layers_below = FALSE;
597
598 parse_register(i, "resistance", parse_resistance, NULL);
599
600 config_menu_warppointer = TRUE;
601 config_menu_xorstyle = TRUE;
602 config_menu_hilightfirst = TRUE;
603 config_menu_hide_delay = 250;
604 config_menu_files = NULL;
605
606 parse_register(i, "menu", parse_menu, NULL);
607 }
608
609 void config_shutdown()
610 {
611 GSList *it;
612
613 g_free(config_theme);
614
615 g_free(config_title_layout);
616
617 for (it = config_desktops_names; it; it = g_slist_next(it))
618 g_free(it->data);
619 g_slist_free(config_desktops_names);
620
621 for (it = config_menu_files; it; it = g_slist_next(it))
622 g_free(it->data);
623 g_slist_free(config_menu_files);
624 }
This page took 0.062046 seconds and 5 git commands to generate.