1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 config.c for the Openbox window manager
4 Copyright (c) 2004 Mikael Magnusson
5 Copyright (c) 2003 Ben Jansens
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.
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.
17 See the COPYING file for a copy of the GNU General Public License.
24 #include "translate.h"
26 #include "parser/parse.h"
29 gboolean config_focus_new
;
30 gboolean config_focus_follow
;
31 guint config_focus_delay
;
32 gboolean config_focus_raise
;
33 gboolean config_focus_last
;
35 ObPlacePolicy config_place_policy
;
38 gboolean config_theme_keepborder
;
39 gboolean config_theme_hidedisabled
;
41 gchar
*config_title_layout
;
43 gint config_desktops_num
;
44 GSList
*config_desktops_names
;
45 gint config_screen_firstdesk
;
47 gboolean config_resize_redraw
;
48 gboolean config_resize_four_corners
;
49 gint config_resize_popup_show
;
50 gint config_resize_popup_pos
;
52 ObStackingLayer config_dock_layer
;
53 gboolean config_dock_floating
;
54 gboolean config_dock_nostrut
;
55 ObDirection config_dock_pos
;
58 ObOrientation config_dock_orient
;
59 gboolean config_dock_hide
;
60 guint config_dock_hide_delay
;
61 guint config_dock_show_delay
;
62 guint config_dock_app_move_button
;
63 guint config_dock_app_move_modifiers
;
65 guint config_keyboard_reset_keycode
;
66 guint config_keyboard_reset_state
;
68 gint config_mouse_threshold
;
69 gint config_mouse_dclicktime
;
71 gboolean config_menu_warppointer
;
72 gboolean config_menu_xorstyle
;
73 guint config_menu_hide_delay
;
74 guint config_submenu_show_delay
;
75 gboolean config_menu_client_list_icons
;
77 GSList
*config_menu_files
;
79 gint config_resist_win
;
80 gint config_resist_edge
;
82 gboolean config_resist_layers_below
;
84 GSList
*config_per_app_settings
;
88 <application name="aterm">
91 <application name="Rhythmbox">
102 /* Manages settings for individual applications.
103 Some notes: head is the screen number in a multi monitor
104 (Xinerama) setup (starting from 0) or mouse, meaning the
105 head the pointer is on. Default: mouse.
106 Layer can be three values, above (Always on top), below
107 (Always on bottom) and everything else (normal behaviour).
108 Positions can be an integer value or center, which will
109 center the window in the specified axis. Position is relative
110 from head, so <position><x>center</x></position><head>1</head>
111 will center the window on the second head.
113 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
114 xmlNodePtr node
, gpointer d
)
116 xmlNodePtr app
= parse_find_node("application", node
->children
);
120 gboolean x_pos_given
= FALSE
;
121 if (parse_attr_string("name", app
, &name
)) {
123 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
124 settings
->name
= name
;
125 if (!parse_attr_string("role", app
, &settings
->role
))
126 settings
->role
= NULL
;
128 settings
->decor
= -1;
129 if ((n
= parse_find_node("decor", app
->children
)))
130 settings
->decor
= parse_bool(doc
, n
);
132 settings
->shade
= -1;
133 if ((n
= parse_find_node("shade", app
->children
)))
134 settings
->shade
= parse_bool(doc
, n
);
136 settings
->position
.x
= settings
->position
.y
= 0;
137 settings
->pos_given
= FALSE
;
138 if ((n
= parse_find_node("position", app
->children
))) {
139 if ((c
= parse_find_node("x", n
->children
))) {
140 gchar
*s
= parse_string(doc
, c
);
141 if (!strcmp(s
, "center")) {
142 settings
->center_x
= TRUE
;
145 settings
->position
.x
= parse_int(doc
, c
);
151 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
))) {
152 gchar
*s
= parse_string(doc
, c
);
153 if (!strcmp(s
, "center")) {
154 settings
->center_y
= TRUE
;
155 settings
->pos_given
= TRUE
;
157 settings
->position
.y
= parse_int(doc
, c
);
158 settings
->pos_given
= TRUE
;
164 settings
->focus
= -1;
165 if ((n
= parse_find_node("focus", app
->children
)))
166 settings
->focus
= parse_bool(doc
, n
);
168 if ((n
= parse_find_node("desktop", app
->children
))) {
169 gchar
*s
= parse_string(doc
, n
);
170 if (!strcmp(s
, "all"))
171 settings
->desktop
= DESKTOP_ALL
;
173 settings
->desktop
= parse_int(doc
, n
);
176 settings
->desktop
= DESKTOP_ALL
- 1; /* lets hope the user
180 if ((n
= parse_find_node("head", app
->children
))) {
181 gchar
*s
= parse_string(doc
, n
);
182 if (!strcmp(s
, "mouse"))
185 settings
->head
= parse_int(doc
, n
);
189 settings
->layer
= -2;
190 if ((n
= parse_find_node("layer", app
->children
))) {
191 gchar
*s
= parse_string(doc
, n
);
192 if (!strcmp(s
, "above"))
194 else if (!strcmp(s
, "below"))
195 settings
->layer
= -1;
201 settings
->iconic
= -1;
202 if ((n
= parse_find_node("iconic", app
->children
)))
203 settings
->iconic
= parse_bool(doc
, n
);
205 settings
->skip_pager
= -1;
206 if ((n
= parse_find_node("skip_pager", app
->children
)))
207 settings
->skip_pager
= parse_bool(doc
, n
);
209 settings
->skip_taskbar
= -1;
210 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
211 settings
->skip_taskbar
= parse_bool(doc
, n
);
213 settings
->fullscreen
= -1;
214 if ((n
= parse_find_node("fullscreen", app
->children
)))
215 settings
->fullscreen
= parse_bool(doc
, n
);
217 settings
->max_horz
= -1;
218 settings
->max_vert
= -1;
219 if ((n
= parse_find_node("maximized", app
->children
))) {
220 gchar
*s
= parse_string(doc
, n
);
221 if (!strcmp(s
, "horizontal")) {
222 settings
->max_horz
= TRUE
;
223 settings
->max_vert
= FALSE
;
224 } else if (!strcmp(s
, "vertical")) {
225 settings
->max_horz
= FALSE
;
226 settings
->max_vert
= TRUE
;
228 settings
->max_horz
= settings
->max_vert
=
233 config_per_app_settings
= g_slist_append(config_per_app_settings
,
234 (gpointer
) settings
);
237 app
= parse_find_node("application", app
->next
);
244 <action name="ChangeDesktop">
251 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
259 if ((n
= parse_find_node("chainQuitKey", node
))) {
260 key
= parse_string(doc
, n
);
261 translate_key(key
, &config_keyboard_reset_state
,
262 &config_keyboard_reset_keycode
);
266 n
= parse_find_node("keybind", node
);
268 if (parse_attr_string("key", n
, &key
)) {
269 keylist
= g_list_append(keylist
, key
);
271 parse_key(i
, doc
, n
->children
, keylist
);
273 it
= g_list_last(keylist
);
275 keylist
= g_list_delete_link(keylist
, it
);
277 n
= parse_find_node("keybind", n
->next
);
280 nact
= parse_find_node("action", node
);
282 if ((action
= action_parse(i
, doc
, nact
,
283 OB_USER_ACTION_KEYBOARD_KEY
)))
284 keyboard_bind(keylist
, action
);
285 nact
= parse_find_node("action", nact
->next
);
290 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
293 keyboard_unbind_all();
295 parse_key(i
, doc
, node
->children
, NULL
);
300 <context name="Titlebar">
301 <mousebind button="Left" action="Press">
302 <action name="Raise"></action>
308 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
311 xmlNodePtr n
, nbut
, nact
;
320 node
= node
->children
;
322 if ((n
= parse_find_node("dragThreshold", node
)))
323 config_mouse_threshold
= parse_int(doc
, n
);
324 if ((n
= parse_find_node("doubleClickTime", node
)))
325 config_mouse_dclicktime
= parse_int(doc
, n
);
327 n
= parse_find_node("context", node
);
329 if (!parse_attr_string("name", n
, &contextstr
))
331 nbut
= parse_find_node("mousebind", n
->children
);
333 if (!parse_attr_string("button", nbut
, &buttonstr
))
335 if (parse_attr_contains("press", nbut
, "action")) {
336 uact
= OB_USER_ACTION_MOUSE_PRESS
;
337 mact
= OB_MOUSE_ACTION_PRESS
;
338 } else if (parse_attr_contains("release", nbut
, "action")) {
339 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
340 mact
= OB_MOUSE_ACTION_RELEASE
;
341 } else if (parse_attr_contains("click", nbut
, "action")) {
342 uact
= OB_USER_ACTION_MOUSE_CLICK
;
343 mact
= OB_MOUSE_ACTION_CLICK
;
344 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
345 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
346 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
347 } else if (parse_attr_contains("drag", nbut
, "action")) {
348 uact
= OB_USER_ACTION_MOUSE_MOTION
;
349 mact
= OB_MOUSE_ACTION_MOTION
;
352 nact
= parse_find_node("action", nbut
->children
);
354 if ((action
= action_parse(i
, doc
, nact
, uact
)))
355 mouse_bind(buttonstr
, contextstr
, mact
, action
);
356 nact
= parse_find_node("action", nact
->next
);
360 nbut
= parse_find_node("mousebind", nbut
->next
);
364 n
= parse_find_node("context", n
->next
);
368 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
373 node
= node
->children
;
375 if ((n
= parse_find_node("focusNew", node
)))
376 config_focus_new
= parse_bool(doc
, n
);
377 if ((n
= parse_find_node("followMouse", node
)))
378 config_focus_follow
= parse_bool(doc
, n
);
379 if ((n
= parse_find_node("focusDelay", node
)))
380 config_focus_delay
= parse_int(doc
, n
) * 1000;
381 if ((n
= parse_find_node("raiseOnFocus", node
)))
382 config_focus_raise
= parse_bool(doc
, n
);
383 if ((n
= parse_find_node("focusLast", node
)))
384 config_focus_last
= parse_bool(doc
, n
);
387 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
392 node
= node
->children
;
394 if ((n
= parse_find_node("policy", node
)))
395 if (parse_contains("UnderMouse", doc
, n
))
396 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
399 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
404 node
= node
->children
;
406 if ((n
= parse_find_node("name", node
))) {
409 g_free(config_theme
);
410 c
= parse_string(doc
, n
);
411 config_theme
= parse_expand_tilde(c
);
414 if ((n
= parse_find_node("titleLayout", node
))) {
415 g_free(config_title_layout
);
416 config_title_layout
= parse_string(doc
, n
);
418 if ((n
= parse_find_node("keepBorder", node
)))
419 config_theme_keepborder
= parse_bool(doc
, n
);
420 if ((n
= parse_find_node("hideDisabled", node
)))
421 config_theme_hidedisabled
= parse_bool(doc
, n
);
424 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
429 node
= node
->children
;
431 if ((n
= parse_find_node("number", node
))) {
432 gint d
= parse_int(doc
, n
);
434 config_desktops_num
= d
;
436 if ((n
= parse_find_node("firstdesk", node
))) {
437 gint d
= parse_int(doc
, n
);
439 config_screen_firstdesk
= d
;
441 if ((n
= parse_find_node("names", node
))) {
445 for (it
= config_desktops_names
; it
; it
= it
->next
)
447 g_slist_free(config_desktops_names
);
448 config_desktops_names
= NULL
;
450 nname
= parse_find_node("name", n
->children
);
452 config_desktops_names
= g_slist_append(config_desktops_names
,
453 parse_string(doc
, nname
));
454 nname
= parse_find_node("name", nname
->next
);
459 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
464 node
= node
->children
;
466 if ((n
= parse_find_node("drawContents", node
)))
467 config_resize_redraw
= parse_bool(doc
, n
);
468 if ((n
= parse_find_node("fourCorner", node
)))
469 config_resize_four_corners
= parse_bool(doc
, n
);
470 if ((n
= parse_find_node("popupShow", node
))) {
471 config_resize_popup_show
= parse_int(doc
, n
);
472 if (parse_contains("Always", doc
, n
))
473 config_resize_popup_show
= 2;
474 else if (parse_contains("Never", doc
, n
))
475 config_resize_popup_show
= 0;
476 else if (parse_contains("Nonpixel", doc
, n
))
477 config_resize_popup_show
= 1;
479 if ((n
= parse_find_node("popupPosition", node
))) {
480 config_resize_popup_pos
= parse_int(doc
, n
);
481 if (parse_contains("Top", doc
, n
))
482 config_resize_popup_pos
= 1;
483 else if (parse_contains("Center", doc
, n
))
484 config_resize_popup_pos
= 0;
488 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
493 node
= node
->children
;
495 if ((n
= parse_find_node("position", node
))) {
496 if (parse_contains("TopLeft", doc
, n
))
497 config_dock_floating
= FALSE
,
498 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
499 else if (parse_contains("Top", doc
, n
))
500 config_dock_floating
= FALSE
,
501 config_dock_pos
= OB_DIRECTION_NORTH
;
502 else if (parse_contains("TopRight", doc
, n
))
503 config_dock_floating
= FALSE
,
504 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
505 else if (parse_contains("Right", doc
, n
))
506 config_dock_floating
= FALSE
,
507 config_dock_pos
= OB_DIRECTION_EAST
;
508 else if (parse_contains("BottomRight", doc
, n
))
509 config_dock_floating
= FALSE
,
510 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
511 else if (parse_contains("Bottom", doc
, n
))
512 config_dock_floating
= FALSE
,
513 config_dock_pos
= OB_DIRECTION_SOUTH
;
514 else if (parse_contains("BottomLeft", doc
, n
))
515 config_dock_floating
= FALSE
,
516 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
517 else if (parse_contains("Left", doc
, n
))
518 config_dock_floating
= FALSE
,
519 config_dock_pos
= OB_DIRECTION_WEST
;
520 else if (parse_contains("Floating", doc
, n
))
521 config_dock_floating
= TRUE
;
523 if (config_dock_floating
) {
524 if ((n
= parse_find_node("floatingX", node
)))
525 config_dock_x
= parse_int(doc
, n
);
526 if ((n
= parse_find_node("floatingY", node
)))
527 config_dock_y
= parse_int(doc
, n
);
529 if ((n
= parse_find_node("noStrut", node
)))
530 config_dock_nostrut
= parse_bool(doc
, n
);
532 if ((n
= parse_find_node("stacking", node
))) {
533 if (parse_contains("top", doc
, n
))
534 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
535 else if (parse_contains("normal", doc
, n
))
536 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
537 else if (parse_contains("bottom", doc
, n
))
538 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
540 if ((n
= parse_find_node("direction", node
))) {
541 if (parse_contains("horizontal", doc
, n
))
542 config_dock_orient
= OB_ORIENTATION_HORZ
;
543 else if (parse_contains("vertical", doc
, n
))
544 config_dock_orient
= OB_ORIENTATION_VERT
;
546 if ((n
= parse_find_node("autoHide", node
)))
547 config_dock_hide
= parse_bool(doc
, n
);
548 if ((n
= parse_find_node("hideDelay", node
)))
549 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
550 if ((n
= parse_find_node("showDelay", node
)))
551 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
552 if ((n
= parse_find_node("moveButton", node
))) {
553 gchar
*str
= parse_string(doc
, n
);
555 if (translate_button(str
, &s
, &b
)) {
556 config_dock_app_move_button
= b
;
557 config_dock_app_move_modifiers
= s
;
559 g_warning("invalid button '%s'", str
);
565 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
569 for (node
= node
->children
; node
; node
= node
->next
) {
570 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
573 c
= parse_string(doc
, node
);
574 config_menu_files
= g_slist_append(config_menu_files
,
575 parse_expand_tilde(c
));
578 if ((n
= parse_find_node("warpPointer", node
)))
579 config_menu_warppointer
= parse_bool(doc
, n
);
580 if ((n
= parse_find_node("xorStyle", node
)))
581 config_menu_xorstyle
= parse_bool(doc
, n
);
582 if ((n
= parse_find_node("hideDelay", node
)))
583 config_menu_hide_delay
= parse_int(doc
, n
);
584 if ((n
= parse_find_node("submenuShowDelay", node
)))
585 config_submenu_show_delay
= parse_int(doc
, n
);
586 if ((n
= parse_find_node("desktopMenuIcons", node
)))
587 config_menu_client_list_icons
= parse_bool(doc
, n
);
591 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
596 node
= node
->children
;
597 if ((n
= parse_find_node("strength", node
)))
598 config_resist_win
= parse_int(doc
, n
);
599 if ((n
= parse_find_node("screen_edge_strength", node
)))
600 config_resist_edge
= parse_int(doc
, n
);
601 if ((n
= parse_find_node("edges_hit_layers_below", node
)))
602 config_resist_layers_below
= parse_bool(doc
, n
);
608 const gchar
*actname
;
611 static void bind_default_keyboard()
614 ObDefKeyBind binds
[] = {
615 { "A-Tab", "NextWindow" },
616 { "S-A-Tab", "PreviousWindow" },
621 for (it
= binds
; it
->key
; ++it
) {
622 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
623 keyboard_bind(l
, action_from_string(it
->actname
,
624 OB_USER_ACTION_KEYBOARD_KEY
));
631 const gchar
*context
;
632 const ObMouseAction mact
;
633 const gchar
*actname
;
636 static void bind_default_mouse()
639 ObDefMouseBind binds
[] = {
640 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
641 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
642 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
643 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
644 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
645 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
646 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
647 { "Left", "Handle", OB_MOUSE_ACTION_PRESS
, "Focus" },
648 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
649 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
650 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
651 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
652 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
653 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
654 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
655 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
656 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
657 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
658 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
659 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
660 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
661 { "Left", "Handle", OB_MOUSE_ACTION_CLICK
, "Raise" },
662 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
663 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
664 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
665 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
666 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Raise" },
667 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "Raise" },
668 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Raise" },
669 { "Left", "Icon", OB_MOUSE_ACTION_CLICK
, "Raise" },
670 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "Raise" },
671 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "Raise" },
672 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Close" },
673 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "ToggleMaximizeFull" },
674 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Iconify" },
675 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "ToggleOmnipresent" },
676 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "ToggleShade" },
677 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
678 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
679 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
680 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
681 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION
, "Move" },
682 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION
, "Move" },
683 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION
, "Resize" },
684 { NULL
, NULL
, 0, NULL
}
687 for (it
= binds
; it
->button
; ++it
) {
690 case OB_MOUSE_ACTION_PRESS
:
691 uact
= OB_USER_ACTION_MOUSE_PRESS
; break;
692 case OB_MOUSE_ACTION_RELEASE
:
693 uact
= OB_USER_ACTION_MOUSE_RELEASE
; break;
694 case OB_MOUSE_ACTION_CLICK
:
695 uact
= OB_USER_ACTION_MOUSE_CLICK
; break;
696 case OB_MOUSE_ACTION_DOUBLE_CLICK
:
697 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
; break;
698 case OB_MOUSE_ACTION_MOTION
:
699 uact
= OB_USER_ACTION_MOUSE_MOTION
; break;
700 case OB_NUM_MOUSE_ACTIONS
:
701 g_assert_not_reached();
703 mouse_bind(it
->button
, it
->context
, it
->mact
,
704 action_from_string(it
->actname
, uact
));
708 void config_startup(ObParseInst
*i
)
710 config_focus_new
= TRUE
;
711 config_focus_follow
= FALSE
;
712 config_focus_delay
= 0;
713 config_focus_raise
= FALSE
;
714 config_focus_last
= FALSE
;
716 parse_register(i
, "focus", parse_focus
, NULL
);
718 config_place_policy
= OB_PLACE_POLICY_SMART
;
720 parse_register(i
, "placement", parse_placement
, NULL
);
724 config_title_layout
= g_strdup("NLIMC");
725 config_theme_keepborder
= TRUE
;
726 config_theme_hidedisabled
= FALSE
;
728 parse_register(i
, "theme", parse_theme
, NULL
);
730 config_desktops_num
= 4;
731 config_screen_firstdesk
= 1;
732 config_desktops_names
= NULL
;
734 parse_register(i
, "desktops", parse_desktops
, NULL
);
736 config_resize_redraw
= TRUE
;
737 config_resize_four_corners
= FALSE
;
738 config_resize_popup_show
= 1; /* nonpixel increments */
739 config_resize_popup_pos
= 0; /* center of client */
741 parse_register(i
, "resize", parse_resize
, NULL
);
743 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
744 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
745 config_dock_floating
= FALSE
;
746 config_dock_nostrut
= FALSE
;
749 config_dock_orient
= OB_ORIENTATION_VERT
;
750 config_dock_hide
= FALSE
;
751 config_dock_hide_delay
= 300;
752 config_dock_show_delay
= 300;
753 config_dock_app_move_button
= 2; /* middle */
754 config_dock_app_move_modifiers
= 0;
756 parse_register(i
, "dock", parse_dock
, NULL
);
758 translate_key("C-g", &config_keyboard_reset_state
,
759 &config_keyboard_reset_keycode
);
761 bind_default_keyboard();
763 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
765 config_mouse_threshold
= 3;
766 config_mouse_dclicktime
= 200;
768 bind_default_mouse();
770 parse_register(i
, "mouse", parse_mouse
, NULL
);
772 config_resist_win
= 10;
773 config_resist_edge
= 20;
774 config_resist_layers_below
= FALSE
;
776 parse_register(i
, "resistance", parse_resistance
, NULL
);
778 config_menu_warppointer
= TRUE
;
779 config_menu_xorstyle
= TRUE
;
780 config_menu_hide_delay
= 250;
781 config_submenu_show_delay
= 0;
782 config_menu_client_list_icons
= TRUE
;
783 config_menu_files
= NULL
;
785 parse_register(i
, "menu", parse_menu
, NULL
);
787 config_per_app_settings
= NULL
;
789 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
792 void config_shutdown()
796 g_free(config_theme
);
798 g_free(config_title_layout
);
800 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
802 g_slist_free(config_desktops_names
);
804 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
806 g_slist_free(config_menu_files
);
808 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
809 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
814 g_slist_free(config_per_app_settings
);