1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 config.c for the Openbox window manager
4 Copyright (c) 2006 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"
27 #include "parser/parse.h"
30 gboolean config_focus_new
;
31 gboolean config_focus_follow
;
32 guint config_focus_delay
;
33 gboolean config_focus_raise
;
34 gboolean config_focus_last
;
36 ObPlacePolicy config_place_policy
;
39 gboolean config_theme_keepborder
;
40 gboolean config_theme_hidedisabled
;
42 gchar
*config_title_layout
;
44 RrFont
*config_font_activewindow
;
45 RrFont
*config_font_inactivewindow
;
46 RrFont
*config_font_menuitem
;
47 RrFont
*config_font_menutitle
;
49 gint config_desktops_num
;
50 GSList
*config_desktops_names
;
51 guint config_screen_firstdesk
;
53 gboolean config_resize_redraw
;
54 gboolean config_resize_four_corners
;
55 gint config_resize_popup_show
;
56 gint config_resize_popup_pos
;
58 ObStackingLayer config_dock_layer
;
59 gboolean config_dock_floating
;
60 gboolean config_dock_nostrut
;
61 ObDirection config_dock_pos
;
64 ObOrientation config_dock_orient
;
65 gboolean config_dock_hide
;
66 guint config_dock_hide_delay
;
67 guint config_dock_show_delay
;
68 guint config_dock_app_move_button
;
69 guint config_dock_app_move_modifiers
;
71 guint config_keyboard_reset_keycode
;
72 guint config_keyboard_reset_state
;
74 gint config_mouse_threshold
;
75 gint config_mouse_dclicktime
;
77 gboolean config_menu_warppointer
;
78 guint config_menu_hide_delay
;
79 gboolean config_menu_middle
;
80 guint config_submenu_show_delay
;
81 gboolean config_menu_client_list_icons
;
83 GSList
*config_menu_files
;
85 gint config_resist_win
;
86 gint config_resist_edge
;
87 gboolean config_resist_layers_below
;
89 GSList
*config_per_app_settings
;
93 <application name="aterm">
96 <application name="Rhythmbox">
107 /* Manages settings for individual applications.
108 Some notes: head is the screen number in a multi monitor
109 (Xinerama) setup (starting from 0) or mouse, meaning the
110 head the pointer is on. Default: mouse.
111 Layer can be three values, above (Always on top), below
112 (Always on bottom) and everything else (normal behaviour).
113 Positions can be an integer value or center, which will
114 center the window in the specified axis. Position is relative
115 from head, so <position><x>center</x></position><head>1</head>
116 will center the window on the second head.
118 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
119 xmlNodePtr node
, gpointer d
)
121 xmlNodePtr app
= parse_find_node("application", node
->children
);
123 gboolean name_set
, class_set
;
124 gboolean x_pos_given
;
127 name_set
= class_set
= x_pos_given
= FALSE
;
129 class_set
= parse_attr_string("class", app
, &class);
130 name_set
= parse_attr_string("name", app
, &name
);
131 if (class_set
|| name_set
) {
133 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
136 settings
->name
= name
;
138 settings
->name
= NULL
;
141 settings
->class = class;
143 settings
->class = NULL
;
145 if (!parse_attr_string("role", app
, &settings
->role
))
146 settings
->role
= NULL
;
148 settings
->decor
= -1;
149 if ((n
= parse_find_node("decor", app
->children
)))
150 settings
->decor
= parse_bool(doc
, n
);
152 settings
->shade
= -1;
153 if ((n
= parse_find_node("shade", app
->children
)))
154 settings
->shade
= parse_bool(doc
, n
);
156 settings
->position
.x
= settings
->position
.y
= 0;
157 settings
->pos_given
= FALSE
;
158 if ((n
= parse_find_node("position", app
->children
))) {
159 if ((c
= parse_find_node("x", n
->children
))) {
160 gchar
*s
= parse_string(doc
, c
);
161 if (!strcmp(s
, "center")) {
162 settings
->center_x
= TRUE
;
165 settings
->position
.x
= parse_int(doc
, c
);
171 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
))) {
172 gchar
*s
= parse_string(doc
, c
);
173 if (!strcmp(s
, "center")) {
174 settings
->center_y
= TRUE
;
175 settings
->pos_given
= TRUE
;
177 settings
->position
.y
= parse_int(doc
, c
);
178 settings
->pos_given
= TRUE
;
184 settings
->focus
= -1;
185 if ((n
= parse_find_node("focus", app
->children
)))
186 settings
->focus
= parse_bool(doc
, n
);
188 if ((n
= parse_find_node("desktop", app
->children
))) {
189 gchar
*s
= parse_string(doc
, n
);
190 if (!strcmp(s
, "all"))
191 settings
->desktop
= DESKTOP_ALL
;
193 settings
->desktop
= parse_int(doc
, n
);
196 settings
->desktop
= DESKTOP_ALL
- 1; /* lets hope the user
200 if ((n
= parse_find_node("head", app
->children
))) {
201 gchar
*s
= parse_string(doc
, n
);
202 if (!strcmp(s
, "mouse"))
205 settings
->head
= parse_int(doc
, n
);
209 settings
->layer
= -2;
210 if ((n
= parse_find_node("layer", app
->children
))) {
211 gchar
*s
= parse_string(doc
, n
);
212 if (!strcmp(s
, "above"))
214 else if (!strcmp(s
, "below"))
215 settings
->layer
= -1;
221 settings
->iconic
= -1;
222 if ((n
= parse_find_node("iconic", app
->children
)))
223 settings
->iconic
= parse_bool(doc
, n
);
225 settings
->skip_pager
= -1;
226 if ((n
= parse_find_node("skip_pager", app
->children
)))
227 settings
->skip_pager
= parse_bool(doc
, n
);
229 settings
->skip_taskbar
= -1;
230 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
231 settings
->skip_taskbar
= parse_bool(doc
, n
);
233 settings
->fullscreen
= -1;
234 if ((n
= parse_find_node("fullscreen", app
->children
)))
235 settings
->fullscreen
= parse_bool(doc
, n
);
237 settings
->max_horz
= -1;
238 settings
->max_vert
= -1;
239 if ((n
= parse_find_node("maximized", app
->children
))) {
240 gchar
*s
= parse_string(doc
, n
);
241 if (!strcmp(s
, "horizontal")) {
242 settings
->max_horz
= TRUE
;
243 settings
->max_vert
= FALSE
;
244 } else if (!strcmp(s
, "vertical")) {
245 settings
->max_horz
= FALSE
;
246 settings
->max_vert
= TRUE
;
248 settings
->max_horz
= settings
->max_vert
=
253 config_per_app_settings
= g_slist_append(config_per_app_settings
,
254 (gpointer
) settings
);
257 app
= parse_find_node("application", app
->next
);
264 <action name="ChangeDesktop">
271 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
279 if ((n
= parse_find_node("chainQuitKey", node
))) {
280 key
= parse_string(doc
, n
);
281 translate_key(key
, &config_keyboard_reset_state
,
282 &config_keyboard_reset_keycode
);
286 n
= parse_find_node("keybind", node
);
288 if (parse_attr_string("key", n
, &key
)) {
289 keylist
= g_list_append(keylist
, key
);
291 parse_key(i
, doc
, n
->children
, keylist
);
293 it
= g_list_last(keylist
);
295 keylist
= g_list_delete_link(keylist
, it
);
297 n
= parse_find_node("keybind", n
->next
);
300 nact
= parse_find_node("action", node
);
302 if ((action
= action_parse(i
, doc
, nact
,
303 OB_USER_ACTION_KEYBOARD_KEY
)))
304 keyboard_bind(keylist
, action
);
305 nact
= parse_find_node("action", nact
->next
);
310 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
313 keyboard_unbind_all();
315 parse_key(i
, doc
, node
->children
, NULL
);
320 <context name="Titlebar">
321 <mousebind button="Left" action="Press">
322 <action name="Raise"></action>
328 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
331 xmlNodePtr n
, nbut
, nact
;
340 node
= node
->children
;
342 if ((n
= parse_find_node("dragThreshold", node
)))
343 config_mouse_threshold
= parse_int(doc
, n
);
344 if ((n
= parse_find_node("doubleClickTime", node
)))
345 config_mouse_dclicktime
= parse_int(doc
, n
);
347 n
= parse_find_node("context", node
);
349 if (!parse_attr_string("name", n
, &contextstr
))
351 nbut
= parse_find_node("mousebind", n
->children
);
353 if (!parse_attr_string("button", nbut
, &buttonstr
))
355 if (parse_attr_contains("press", nbut
, "action")) {
356 uact
= OB_USER_ACTION_MOUSE_PRESS
;
357 mact
= OB_MOUSE_ACTION_PRESS
;
358 } else if (parse_attr_contains("release", nbut
, "action")) {
359 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
360 mact
= OB_MOUSE_ACTION_RELEASE
;
361 } else if (parse_attr_contains("click", nbut
, "action")) {
362 uact
= OB_USER_ACTION_MOUSE_CLICK
;
363 mact
= OB_MOUSE_ACTION_CLICK
;
364 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
365 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
366 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
367 } else if (parse_attr_contains("drag", nbut
, "action")) {
368 uact
= OB_USER_ACTION_MOUSE_MOTION
;
369 mact
= OB_MOUSE_ACTION_MOTION
;
372 nact
= parse_find_node("action", nbut
->children
);
374 if ((action
= action_parse(i
, doc
, nact
, uact
)))
375 mouse_bind(buttonstr
, contextstr
, mact
, action
);
376 nact
= parse_find_node("action", nact
->next
);
380 nbut
= parse_find_node("mousebind", nbut
->next
);
384 n
= parse_find_node("context", n
->next
);
388 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
393 node
= node
->children
;
395 if ((n
= parse_find_node("focusNew", node
)))
396 config_focus_new
= parse_bool(doc
, n
);
397 if ((n
= parse_find_node("followMouse", node
)))
398 config_focus_follow
= parse_bool(doc
, n
);
399 if ((n
= parse_find_node("focusDelay", node
)))
400 config_focus_delay
= parse_int(doc
, n
) * 1000;
401 if ((n
= parse_find_node("raiseOnFocus", node
)))
402 config_focus_raise
= parse_bool(doc
, n
);
403 if ((n
= parse_find_node("focusLast", node
)))
404 config_focus_last
= parse_bool(doc
, n
);
407 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
412 node
= node
->children
;
414 if ((n
= parse_find_node("policy", node
)))
415 if (parse_contains("UnderMouse", doc
, n
))
416 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
419 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
424 node
= node
->children
;
426 if ((n
= parse_find_node("name", node
))) {
429 g_free(config_theme
);
430 c
= parse_string(doc
, n
);
431 config_theme
= parse_expand_tilde(c
);
434 if ((n
= parse_find_node("titleLayout", node
))) {
435 g_free(config_title_layout
);
436 config_title_layout
= parse_string(doc
, n
);
438 if ((n
= parse_find_node("keepBorder", node
)))
439 config_theme_keepborder
= parse_bool(doc
, n
);
440 if ((n
= parse_find_node("hideDisabled", node
)))
441 config_theme_hidedisabled
= parse_bool(doc
, n
);
443 n
= parse_find_node("font", node
);
447 gchar
*name
= g_strdup(RrDefaultFontFamily
);
448 gint size
= RrDefaultFontSize
;
449 RrFontWeight weight
= RrDefaultFontWeight
;
450 RrFontSlant slant
= RrDefaultFontSlant
;
452 if (parse_attr_contains("ActiveWindow", n
, "place"))
453 font
= &config_font_activewindow
;
454 else if (parse_attr_contains("InactiveWindow", n
, "place"))
455 font
= &config_font_inactivewindow
;
456 else if (parse_attr_contains("MenuTitle", n
, "place"))
457 font
= &config_font_menutitle
;
458 else if (parse_attr_contains("MenuItem", n
, "place"))
459 font
= &config_font_menuitem
;
463 if ((fnode
= parse_find_node("name", n
->children
))) {
465 name
= parse_string(doc
, fnode
);
467 if ((fnode
= parse_find_node("size", n
->children
))) {
468 int s
= parse_int(doc
, fnode
);
471 if ((fnode
= parse_find_node("weight", n
->children
))) {
472 gchar
*w
= parse_string(doc
, fnode
);
473 if (!g_ascii_strcasecmp(w
, "Bold"))
474 weight
= RR_FONTWEIGHT_BOLD
;
477 if ((fnode
= parse_find_node("slant", n
->children
))) {
478 gchar
*s
= parse_string(doc
, fnode
);
479 if (!g_ascii_strcasecmp(s
, "Italic"))
480 slant
= RR_FONTSLANT_ITALIC
;
481 if (!g_ascii_strcasecmp(s
, "Oblique"))
482 slant
= RR_FONTSLANT_OBLIQUE
;
486 *font
= RrFontOpen(ob_rr_inst
, name
, size
, weight
, slant
);
489 n
= parse_find_node("font", n
->next
);
493 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
498 node
= node
->children
;
500 if ((n
= parse_find_node("number", node
))) {
501 gint d
= parse_int(doc
, n
);
503 config_desktops_num
= d
;
505 if ((n
= parse_find_node("firstdesk", node
))) {
506 gint d
= parse_int(doc
, n
);
508 config_screen_firstdesk
= (unsigned) d
;
510 if ((n
= parse_find_node("names", node
))) {
514 for (it
= config_desktops_names
; it
; it
= it
->next
)
516 g_slist_free(config_desktops_names
);
517 config_desktops_names
= NULL
;
519 nname
= parse_find_node("name", n
->children
);
521 config_desktops_names
= g_slist_append(config_desktops_names
,
522 parse_string(doc
, nname
));
523 nname
= parse_find_node("name", nname
->next
);
528 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
533 node
= node
->children
;
535 if ((n
= parse_find_node("drawContents", node
)))
536 config_resize_redraw
= parse_bool(doc
, n
);
537 if ((n
= parse_find_node("fourCorner", node
)))
538 config_resize_four_corners
= parse_bool(doc
, n
);
539 if ((n
= parse_find_node("popupShow", node
))) {
540 config_resize_popup_show
= parse_int(doc
, n
);
541 if (parse_contains("Always", doc
, n
))
542 config_resize_popup_show
= 2;
543 else if (parse_contains("Never", doc
, n
))
544 config_resize_popup_show
= 0;
545 else if (parse_contains("Nonpixel", doc
, n
))
546 config_resize_popup_show
= 1;
548 if ((n
= parse_find_node("popupPosition", node
))) {
549 config_resize_popup_pos
= parse_int(doc
, n
);
550 if (parse_contains("Top", doc
, n
))
551 config_resize_popup_pos
= 1;
552 else if (parse_contains("Center", doc
, n
))
553 config_resize_popup_pos
= 0;
557 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
562 node
= node
->children
;
564 if ((n
= parse_find_node("position", node
))) {
565 if (parse_contains("TopLeft", doc
, n
))
566 config_dock_floating
= FALSE
,
567 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
568 else if (parse_contains("Top", doc
, n
))
569 config_dock_floating
= FALSE
,
570 config_dock_pos
= OB_DIRECTION_NORTH
;
571 else if (parse_contains("TopRight", doc
, n
))
572 config_dock_floating
= FALSE
,
573 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
574 else if (parse_contains("Right", doc
, n
))
575 config_dock_floating
= FALSE
,
576 config_dock_pos
= OB_DIRECTION_EAST
;
577 else if (parse_contains("BottomRight", doc
, n
))
578 config_dock_floating
= FALSE
,
579 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
580 else if (parse_contains("Bottom", doc
, n
))
581 config_dock_floating
= FALSE
,
582 config_dock_pos
= OB_DIRECTION_SOUTH
;
583 else if (parse_contains("BottomLeft", doc
, n
))
584 config_dock_floating
= FALSE
,
585 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
586 else if (parse_contains("Left", doc
, n
))
587 config_dock_floating
= FALSE
,
588 config_dock_pos
= OB_DIRECTION_WEST
;
589 else if (parse_contains("Floating", doc
, n
))
590 config_dock_floating
= TRUE
;
592 if (config_dock_floating
) {
593 if ((n
= parse_find_node("floatingX", node
)))
594 config_dock_x
= parse_int(doc
, n
);
595 if ((n
= parse_find_node("floatingY", node
)))
596 config_dock_y
= parse_int(doc
, n
);
598 if ((n
= parse_find_node("noStrut", node
)))
599 config_dock_nostrut
= parse_bool(doc
, n
);
601 if ((n
= parse_find_node("stacking", node
))) {
602 if (parse_contains("top", doc
, n
))
603 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
604 else if (parse_contains("normal", doc
, n
))
605 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
606 else if (parse_contains("bottom", doc
, n
))
607 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
609 if ((n
= parse_find_node("direction", node
))) {
610 if (parse_contains("horizontal", doc
, n
))
611 config_dock_orient
= OB_ORIENTATION_HORZ
;
612 else if (parse_contains("vertical", doc
, n
))
613 config_dock_orient
= OB_ORIENTATION_VERT
;
615 if ((n
= parse_find_node("autoHide", node
)))
616 config_dock_hide
= parse_bool(doc
, n
);
617 if ((n
= parse_find_node("hideDelay", node
)))
618 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
619 if ((n
= parse_find_node("showDelay", node
)))
620 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
621 if ((n
= parse_find_node("moveButton", node
))) {
622 gchar
*str
= parse_string(doc
, n
);
624 if (translate_button(str
, &s
, &b
)) {
625 config_dock_app_move_button
= b
;
626 config_dock_app_move_modifiers
= s
;
628 g_warning("invalid button '%s'", str
);
634 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
638 for (node
= node
->children
; node
; node
= node
->next
) {
639 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
642 c
= parse_string(doc
, node
);
643 config_menu_files
= g_slist_append(config_menu_files
,
644 parse_expand_tilde(c
));
647 if ((n
= parse_find_node("warpPointer", node
)))
648 config_menu_warppointer
= parse_bool(doc
, n
);
649 if ((n
= parse_find_node("hideDelay", node
)))
650 config_menu_hide_delay
= parse_int(doc
, n
);
651 if ((n
= parse_find_node("middle", node
)))
652 config_menu_middle
= parse_bool(doc
, n
);
653 if ((n
= parse_find_node("submenuShowDelay", node
)))
654 config_submenu_show_delay
= parse_int(doc
, n
);
655 if ((n
= parse_find_node("desktopMenuIcons", node
)))
656 config_menu_client_list_icons
= parse_bool(doc
, n
);
660 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
665 node
= node
->children
;
666 if ((n
= parse_find_node("strength", node
)))
667 config_resist_win
= parse_int(doc
, n
);
668 if ((n
= parse_find_node("screen_edge_strength", node
)))
669 config_resist_edge
= parse_int(doc
, n
);
670 if ((n
= parse_find_node("edges_hit_layers_below", node
)))
671 config_resist_layers_below
= parse_bool(doc
, n
);
677 const gchar
*actname
;
680 static void bind_default_keyboard()
683 ObDefKeyBind binds
[] = {
684 { "A-Tab", "NextWindow" },
685 { "S-A-Tab", "PreviousWindow" },
690 for (it
= binds
; it
->key
; ++it
) {
691 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
692 keyboard_bind(l
, action_from_string(it
->actname
,
693 OB_USER_ACTION_KEYBOARD_KEY
));
700 const gchar
*context
;
701 const ObMouseAction mact
;
702 const gchar
*actname
;
705 static void bind_default_mouse()
708 ObDefMouseBind binds
[] = {
709 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
710 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
711 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
712 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
713 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
714 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
715 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
716 { "Left", "Handle", OB_MOUSE_ACTION_PRESS
, "Focus" },
717 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
718 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
719 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
720 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
721 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
722 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
723 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
724 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
725 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
726 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
727 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
728 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
729 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
730 { "Left", "Handle", OB_MOUSE_ACTION_CLICK
, "Raise" },
731 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
732 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
733 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
734 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
735 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Raise" },
736 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "Raise" },
737 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Raise" },
738 { "Left", "Icon", OB_MOUSE_ACTION_CLICK
, "Raise" },
739 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "Raise" },
740 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "Raise" },
741 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Close" },
742 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "ToggleMaximizeFull" },
743 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Iconify" },
744 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "ToggleOmnipresent" },
745 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "ToggleShade" },
746 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
747 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
748 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
749 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
750 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION
, "Move" },
751 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION
, "Move" },
752 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION
, "Resize" },
753 { NULL
, NULL
, 0, NULL
}
756 for (it
= binds
; it
->button
; ++it
) {
759 case OB_MOUSE_ACTION_PRESS
:
760 uact
= OB_USER_ACTION_MOUSE_PRESS
; break;
761 case OB_MOUSE_ACTION_RELEASE
:
762 uact
= OB_USER_ACTION_MOUSE_RELEASE
; break;
763 case OB_MOUSE_ACTION_CLICK
:
764 uact
= OB_USER_ACTION_MOUSE_CLICK
; break;
765 case OB_MOUSE_ACTION_DOUBLE_CLICK
:
766 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
; break;
767 case OB_MOUSE_ACTION_MOTION
:
768 uact
= OB_USER_ACTION_MOUSE_MOTION
; break;
770 g_assert_not_reached();
772 mouse_bind(it
->button
, it
->context
, it
->mact
,
773 action_from_string(it
->actname
, uact
));
777 void config_startup(ObParseInst
*i
)
779 config_focus_new
= TRUE
;
780 config_focus_follow
= FALSE
;
781 config_focus_delay
= 0;
782 config_focus_raise
= FALSE
;
783 config_focus_last
= FALSE
;
785 parse_register(i
, "focus", parse_focus
, NULL
);
787 config_place_policy
= OB_PLACE_POLICY_SMART
;
789 parse_register(i
, "placement", parse_placement
, NULL
);
793 config_title_layout
= g_strdup("NLIMC");
794 config_theme_keepborder
= TRUE
;
795 config_theme_hidedisabled
= FALSE
;
797 config_font_activewindow
= NULL
;
798 config_font_inactivewindow
= NULL
;
799 config_font_menuitem
= NULL
;
800 config_font_menutitle
= NULL
;
802 parse_register(i
, "theme", parse_theme
, NULL
);
804 config_desktops_num
= 4;
805 config_screen_firstdesk
= 1;
806 config_desktops_names
= NULL
;
808 parse_register(i
, "desktops", parse_desktops
, NULL
);
810 config_resize_redraw
= TRUE
;
811 config_resize_four_corners
= FALSE
;
812 config_resize_popup_show
= 1; /* nonpixel increments */
813 config_resize_popup_pos
= 0; /* center of client */
815 parse_register(i
, "resize", parse_resize
, NULL
);
817 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
818 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
819 config_dock_floating
= FALSE
;
820 config_dock_nostrut
= FALSE
;
823 config_dock_orient
= OB_ORIENTATION_VERT
;
824 config_dock_hide
= FALSE
;
825 config_dock_hide_delay
= 300;
826 config_dock_show_delay
= 300;
827 config_dock_app_move_button
= 2; /* middle */
828 config_dock_app_move_modifiers
= 0;
830 parse_register(i
, "dock", parse_dock
, NULL
);
832 translate_key("C-g", &config_keyboard_reset_state
,
833 &config_keyboard_reset_keycode
);
835 bind_default_keyboard();
837 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
839 config_mouse_threshold
= 3;
840 config_mouse_dclicktime
= 200;
842 bind_default_mouse();
844 parse_register(i
, "mouse", parse_mouse
, NULL
);
846 config_resist_win
= 10;
847 config_resist_edge
= 20;
848 config_resist_layers_below
= FALSE
;
850 parse_register(i
, "resistance", parse_resistance
, NULL
);
852 config_menu_warppointer
= TRUE
;
853 config_menu_hide_delay
= 250;
854 config_menu_middle
= FALSE
;
855 config_submenu_show_delay
= 0;
856 config_menu_client_list_icons
= TRUE
;
857 config_menu_files
= NULL
;
859 parse_register(i
, "menu", parse_menu
, NULL
);
861 config_per_app_settings
= NULL
;
863 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
866 void config_shutdown()
870 g_free(config_theme
);
872 g_free(config_title_layout
);
874 RrFontClose(config_font_activewindow
);
875 RrFontClose(config_font_inactivewindow
);
876 RrFontClose(config_font_menuitem
);
877 RrFontClose(config_font_menutitle
);
879 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
881 g_slist_free(config_desktops_names
);
883 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
885 g_slist_free(config_menu_files
);
887 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
888 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
894 g_slist_free(config_per_app_settings
);