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-2007 Dana 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"
31 gboolean config_focus_new
;
32 gboolean config_focus_follow
;
33 guint config_focus_delay
;
34 gboolean config_focus_raise
;
35 gboolean config_focus_last
;
37 ObPlacePolicy config_place_policy
;
40 gboolean config_theme_keepborder
;
41 gboolean config_theme_hidedisabled
;
43 gchar
*config_title_layout
;
45 gboolean config_animate_iconify
;
47 RrFont
*config_font_activewindow
;
48 RrFont
*config_font_inactivewindow
;
49 RrFont
*config_font_menuitem
;
50 RrFont
*config_font_menutitle
;
51 RrFont
*config_font_osd
;
53 gint config_desktops_num
;
54 GSList
*config_desktops_names
;
55 guint config_screen_firstdesk
;
57 gboolean config_resize_redraw
;
58 gboolean config_resize_four_corners
;
59 gint config_resize_popup_show
;
60 gint config_resize_popup_pos
;
62 ObStackingLayer config_dock_layer
;
63 gboolean config_dock_floating
;
64 gboolean config_dock_nostrut
;
65 ObDirection config_dock_pos
;
68 ObOrientation config_dock_orient
;
69 gboolean config_dock_hide
;
70 guint config_dock_hide_delay
;
71 guint config_dock_show_delay
;
72 guint config_dock_app_move_button
;
73 guint config_dock_app_move_modifiers
;
75 guint config_keyboard_reset_keycode
;
76 guint config_keyboard_reset_state
;
78 gint config_mouse_threshold
;
79 gint config_mouse_dclicktime
;
81 gboolean config_menu_warppointer
;
82 guint config_menu_hide_delay
;
83 gboolean config_menu_middle
;
84 guint config_submenu_show_delay
;
85 gboolean config_menu_client_list_icons
;
87 GSList
*config_menu_files
;
89 gint config_resist_win
;
90 gint config_resist_edge
;
91 gboolean config_resist_layers_below
;
93 GSList
*config_per_app_settings
;
97 <application name="aterm">
100 <application name="Rhythmbox">
111 /* Manages settings for individual applications.
112 Some notes: head is the screen number in a multi monitor
113 (Xinerama) setup (starting from 0) or mouse, meaning the
114 head the pointer is on. Default: mouse.
115 Layer can be three values, above (Always on top), below
116 (Always on bottom) and everything else (normal behaviour).
117 Positions can be an integer value or center, which will
118 center the window in the specified axis. Position is relative
119 from head, so <position><x>center</x></position><head>1</head>
120 will center the window on the second head.
122 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
123 xmlNodePtr node
, gpointer d
)
125 xmlNodePtr app
= parse_find_node("application", node
->children
);
127 gboolean name_set
, class_set
;
128 gboolean x_pos_given
;
131 name_set
= class_set
= x_pos_given
= FALSE
;
133 class_set
= parse_attr_string("class", app
, &class);
134 name_set
= parse_attr_string("name", app
, &name
);
135 if (class_set
|| name_set
) {
137 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
140 settings
->name
= name
;
142 settings
->name
= NULL
;
145 settings
->class = class;
147 settings
->class = NULL
;
149 if (!parse_attr_string("role", app
, &settings
->role
))
150 settings
->role
= NULL
;
152 settings
->decor
= -1;
153 if ((n
= parse_find_node("decor", app
->children
)))
154 settings
->decor
= parse_bool(doc
, n
);
156 settings
->shade
= -1;
157 if ((n
= parse_find_node("shade", app
->children
)))
158 settings
->shade
= parse_bool(doc
, n
);
160 settings
->position
.x
= settings
->position
.y
= 0;
161 settings
->pos_given
= FALSE
;
162 if ((n
= parse_find_node("position", app
->children
))) {
163 if ((c
= parse_find_node("x", n
->children
))) {
164 gchar
*s
= parse_string(doc
, c
);
165 if (!strcmp(s
, "center")) {
166 settings
->center_x
= TRUE
;
169 settings
->position
.x
= parse_int(doc
, c
);
175 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
))) {
176 gchar
*s
= parse_string(doc
, c
);
177 if (!strcmp(s
, "center")) {
178 settings
->center_y
= TRUE
;
179 settings
->pos_given
= TRUE
;
181 settings
->position
.y
= parse_int(doc
, c
);
182 settings
->pos_given
= TRUE
;
188 settings
->focus
= -1;
189 if ((n
= parse_find_node("focus", app
->children
)))
190 settings
->focus
= parse_bool(doc
, n
);
192 if ((n
= parse_find_node("desktop", app
->children
))) {
193 gchar
*s
= parse_string(doc
, n
);
194 if (!strcmp(s
, "all"))
195 settings
->desktop
= DESKTOP_ALL
;
197 settings
->desktop
= parse_int(doc
, n
);
200 settings
->desktop
= DESKTOP_ALL
- 1; /* lets hope the user
204 if ((n
= parse_find_node("head", app
->children
))) {
205 gchar
*s
= parse_string(doc
, n
);
206 if (!strcmp(s
, "mouse"))
209 settings
->head
= parse_int(doc
, n
);
213 settings
->layer
= -2;
214 if ((n
= parse_find_node("layer", app
->children
))) {
215 gchar
*s
= parse_string(doc
, n
);
216 if (!strcmp(s
, "above"))
218 else if (!strcmp(s
, "below"))
219 settings
->layer
= -1;
225 settings
->iconic
= -1;
226 if ((n
= parse_find_node("iconic", app
->children
)))
227 settings
->iconic
= parse_bool(doc
, n
);
229 settings
->skip_pager
= -1;
230 if ((n
= parse_find_node("skip_pager", app
->children
)))
231 settings
->skip_pager
= parse_bool(doc
, n
);
233 settings
->skip_taskbar
= -1;
234 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
235 settings
->skip_taskbar
= parse_bool(doc
, n
);
237 settings
->fullscreen
= -1;
238 if ((n
= parse_find_node("fullscreen", app
->children
)))
239 settings
->fullscreen
= parse_bool(doc
, n
);
241 settings
->max_horz
= -1;
242 settings
->max_vert
= -1;
243 if ((n
= parse_find_node("maximized", app
->children
))) {
244 gchar
*s
= parse_string(doc
, n
);
245 if (!strcmp(s
, "horizontal")) {
246 settings
->max_horz
= TRUE
;
247 settings
->max_vert
= FALSE
;
248 } else if (!strcmp(s
, "vertical")) {
249 settings
->max_horz
= FALSE
;
250 settings
->max_vert
= TRUE
;
252 settings
->max_horz
= settings
->max_vert
=
257 config_per_app_settings
= g_slist_append(config_per_app_settings
,
258 (gpointer
) settings
);
261 app
= parse_find_node("application", app
->next
);
268 <action name="ChangeDesktop">
275 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
280 gboolean is_chroot
= FALSE
;
282 if (!parse_attr_string("key", node
, &key
))
285 parse_attr_bool("chroot", node
, &is_chroot
);
287 keylist
= g_list_append(keylist
, key
);
289 if ((n
= parse_find_node("keybind", node
->children
))) {
291 parse_key(i
, doc
, n
, keylist
);
292 n
= parse_find_node("keybind", n
->next
);
295 else if ((n
= parse_find_node("action", node
->children
))) {
299 action
= action_parse(i
, doc
, n
, OB_USER_ACTION_KEYBOARD_KEY
);
301 keyboard_bind(keylist
, action
);
302 n
= parse_find_node("action", n
->next
);
307 keyboard_chroot(keylist
);
310 keylist
= g_list_delete_link(keylist
, g_list_last(keylist
));
313 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
319 keyboard_unbind_all();
321 if ((n
= parse_find_node("chainQuitKey", node
->children
))) {
322 key
= parse_string(doc
, n
);
323 translate_key(key
, &config_keyboard_reset_state
,
324 &config_keyboard_reset_keycode
);
328 if ((n
= parse_find_node("keybind", node
->children
)))
330 parse_key(i
, doc
, n
, NULL
);
331 n
= parse_find_node("keybind", n
->next
);
337 <context name="Titlebar">
338 <mousebind button="Left" action="Press">
339 <action name="Raise"></action>
345 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
348 xmlNodePtr n
, nbut
, nact
;
357 node
= node
->children
;
359 if ((n
= parse_find_node("dragThreshold", node
)))
360 config_mouse_threshold
= parse_int(doc
, n
);
361 if ((n
= parse_find_node("doubleClickTime", node
)))
362 config_mouse_dclicktime
= parse_int(doc
, n
);
364 n
= parse_find_node("context", node
);
366 if (!parse_attr_string("name", n
, &contextstr
))
368 nbut
= parse_find_node("mousebind", n
->children
);
370 if (!parse_attr_string("button", nbut
, &buttonstr
))
372 if (parse_attr_contains("press", nbut
, "action")) {
373 uact
= OB_USER_ACTION_MOUSE_PRESS
;
374 mact
= OB_MOUSE_ACTION_PRESS
;
375 } else if (parse_attr_contains("release", nbut
, "action")) {
376 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
377 mact
= OB_MOUSE_ACTION_RELEASE
;
378 } else if (parse_attr_contains("click", nbut
, "action")) {
379 uact
= OB_USER_ACTION_MOUSE_CLICK
;
380 mact
= OB_MOUSE_ACTION_CLICK
;
381 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
382 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
383 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
384 } else if (parse_attr_contains("drag", nbut
, "action")) {
385 uact
= OB_USER_ACTION_MOUSE_MOTION
;
386 mact
= OB_MOUSE_ACTION_MOTION
;
389 nact
= parse_find_node("action", nbut
->children
);
391 if ((action
= action_parse(i
, doc
, nact
, uact
)))
392 mouse_bind(buttonstr
, contextstr
, mact
, action
);
393 nact
= parse_find_node("action", nact
->next
);
397 nbut
= parse_find_node("mousebind", nbut
->next
);
401 n
= parse_find_node("context", n
->next
);
405 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
410 node
= node
->children
;
412 if ((n
= parse_find_node("focusNew", node
)))
413 config_focus_new
= parse_bool(doc
, n
);
414 if ((n
= parse_find_node("followMouse", node
)))
415 config_focus_follow
= parse_bool(doc
, n
);
416 if ((n
= parse_find_node("focusDelay", node
)))
417 config_focus_delay
= parse_int(doc
, n
) * 1000;
418 if ((n
= parse_find_node("raiseOnFocus", node
)))
419 config_focus_raise
= parse_bool(doc
, n
);
420 if ((n
= parse_find_node("focusLast", node
)))
421 config_focus_last
= parse_bool(doc
, n
);
424 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
429 node
= node
->children
;
431 if ((n
= parse_find_node("policy", node
)))
432 if (parse_contains("UnderMouse", doc
, n
))
433 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
436 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
441 node
= node
->children
;
443 if ((n
= parse_find_node("name", node
))) {
446 g_free(config_theme
);
447 c
= parse_string(doc
, n
);
448 config_theme
= parse_expand_tilde(c
);
451 if ((n
= parse_find_node("titleLayout", node
))) {
452 g_free(config_title_layout
);
453 config_title_layout
= parse_string(doc
, n
);
455 if ((n
= parse_find_node("keepBorder", node
)))
456 config_theme_keepborder
= parse_bool(doc
, n
);
457 if ((n
= parse_find_node("hideDisabled", node
)))
458 config_theme_hidedisabled
= parse_bool(doc
, n
);
459 if ((n
= parse_find_node("animateIconify", node
)))
460 config_animate_iconify
= parse_bool(doc
, n
);
462 n
= parse_find_node("font", node
);
466 gchar
*name
= g_strdup(RrDefaultFontFamily
);
467 gint size
= RrDefaultFontSize
;
468 RrFontWeight weight
= RrDefaultFontWeight
;
469 RrFontSlant slant
= RrDefaultFontSlant
;
471 if (parse_attr_contains("ActiveWindow", n
, "place"))
472 font
= &config_font_activewindow
;
473 else if (parse_attr_contains("InactiveWindow", n
, "place"))
474 font
= &config_font_inactivewindow
;
475 else if (parse_attr_contains("MenuHeader", n
, "place"))
476 font
= &config_font_menutitle
;
477 else if (parse_attr_contains("MenuItem", n
, "place"))
478 font
= &config_font_menuitem
;
479 else if (parse_attr_contains("OnScreenDisplay", n
, "place"))
480 font
= &config_font_osd
;
484 if ((fnode
= parse_find_node("name", n
->children
))) {
486 name
= parse_string(doc
, fnode
);
488 if ((fnode
= parse_find_node("size", n
->children
))) {
489 int s
= parse_int(doc
, fnode
);
492 if ((fnode
= parse_find_node("weight", n
->children
))) {
493 gchar
*w
= parse_string(doc
, fnode
);
494 if (!g_ascii_strcasecmp(w
, "Bold"))
495 weight
= RR_FONTWEIGHT_BOLD
;
498 if ((fnode
= parse_find_node("slant", n
->children
))) {
499 gchar
*s
= parse_string(doc
, fnode
);
500 if (!g_ascii_strcasecmp(s
, "Italic"))
501 slant
= RR_FONTSLANT_ITALIC
;
502 if (!g_ascii_strcasecmp(s
, "Oblique"))
503 slant
= RR_FONTSLANT_OBLIQUE
;
507 *font
= RrFontOpen(ob_rr_inst
, name
, size
, weight
, slant
);
510 n
= parse_find_node("font", n
->next
);
514 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
519 node
= node
->children
;
521 if ((n
= parse_find_node("number", node
))) {
522 gint d
= parse_int(doc
, n
);
524 config_desktops_num
= d
;
526 if ((n
= parse_find_node("firstdesk", node
))) {
527 gint d
= parse_int(doc
, n
);
529 config_screen_firstdesk
= (unsigned) d
;
531 if ((n
= parse_find_node("names", node
))) {
535 for (it
= config_desktops_names
; it
; it
= it
->next
)
537 g_slist_free(config_desktops_names
);
538 config_desktops_names
= NULL
;
540 nname
= parse_find_node("name", n
->children
);
542 config_desktops_names
= g_slist_append(config_desktops_names
,
543 parse_string(doc
, nname
));
544 nname
= parse_find_node("name", nname
->next
);
549 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
554 node
= node
->children
;
556 if ((n
= parse_find_node("drawContents", node
)))
557 config_resize_redraw
= parse_bool(doc
, n
);
558 if ((n
= parse_find_node("popupShow", node
))) {
559 config_resize_popup_show
= parse_int(doc
, n
);
560 if (parse_contains("Always", doc
, n
))
561 config_resize_popup_show
= 2;
562 else if (parse_contains("Never", doc
, n
))
563 config_resize_popup_show
= 0;
564 else if (parse_contains("Nonpixel", doc
, n
))
565 config_resize_popup_show
= 1;
567 if ((n
= parse_find_node("popupPosition", node
))) {
568 config_resize_popup_pos
= parse_int(doc
, n
);
569 if (parse_contains("Top", doc
, n
))
570 config_resize_popup_pos
= 1;
571 else if (parse_contains("Center", doc
, n
))
572 config_resize_popup_pos
= 0;
576 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
581 node
= node
->children
;
583 if ((n
= parse_find_node("position", node
))) {
584 if (parse_contains("TopLeft", doc
, n
))
585 config_dock_floating
= FALSE
,
586 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
587 else if (parse_contains("Top", doc
, n
))
588 config_dock_floating
= FALSE
,
589 config_dock_pos
= OB_DIRECTION_NORTH
;
590 else if (parse_contains("TopRight", doc
, n
))
591 config_dock_floating
= FALSE
,
592 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
593 else if (parse_contains("Right", doc
, n
))
594 config_dock_floating
= FALSE
,
595 config_dock_pos
= OB_DIRECTION_EAST
;
596 else if (parse_contains("BottomRight", doc
, n
))
597 config_dock_floating
= FALSE
,
598 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
599 else if (parse_contains("Bottom", doc
, n
))
600 config_dock_floating
= FALSE
,
601 config_dock_pos
= OB_DIRECTION_SOUTH
;
602 else if (parse_contains("BottomLeft", doc
, n
))
603 config_dock_floating
= FALSE
,
604 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
605 else if (parse_contains("Left", doc
, n
))
606 config_dock_floating
= FALSE
,
607 config_dock_pos
= OB_DIRECTION_WEST
;
608 else if (parse_contains("Floating", doc
, n
))
609 config_dock_floating
= TRUE
;
611 if (config_dock_floating
) {
612 if ((n
= parse_find_node("floatingX", node
)))
613 config_dock_x
= parse_int(doc
, n
);
614 if ((n
= parse_find_node("floatingY", node
)))
615 config_dock_y
= parse_int(doc
, n
);
617 if ((n
= parse_find_node("noStrut", node
)))
618 config_dock_nostrut
= parse_bool(doc
, n
);
620 if ((n
= parse_find_node("stacking", node
))) {
621 if (parse_contains("above", doc
, n
))
622 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
623 else if (parse_contains("normal", doc
, n
))
624 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
625 else if (parse_contains("below", doc
, n
))
626 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
628 if ((n
= parse_find_node("direction", node
))) {
629 if (parse_contains("horizontal", doc
, n
))
630 config_dock_orient
= OB_ORIENTATION_HORZ
;
631 else if (parse_contains("vertical", doc
, n
))
632 config_dock_orient
= OB_ORIENTATION_VERT
;
634 if ((n
= parse_find_node("autoHide", node
)))
635 config_dock_hide
= parse_bool(doc
, n
);
636 if ((n
= parse_find_node("hideDelay", node
)))
637 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
638 if ((n
= parse_find_node("showDelay", node
)))
639 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
640 if ((n
= parse_find_node("moveButton", node
))) {
641 gchar
*str
= parse_string(doc
, n
);
643 if (translate_button(str
, &s
, &b
)) {
644 config_dock_app_move_button
= b
;
645 config_dock_app_move_modifiers
= s
;
647 g_message(_("Invalid button '%s' specified in config file"), str
);
653 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
657 for (node
= node
->children
; node
; node
= node
->next
) {
658 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
661 c
= parse_string(doc
, node
);
662 config_menu_files
= g_slist_append(config_menu_files
,
663 parse_expand_tilde(c
));
666 if ((n
= parse_find_node("warpPointer", node
)))
667 config_menu_warppointer
= parse_bool(doc
, n
);
668 if ((n
= parse_find_node("hideDelay", node
)))
669 config_menu_hide_delay
= parse_int(doc
, n
);
670 if ((n
= parse_find_node("middle", node
)))
671 config_menu_middle
= parse_bool(doc
, n
);
672 if ((n
= parse_find_node("submenuShowDelay", node
)))
673 config_submenu_show_delay
= parse_int(doc
, n
);
674 if ((n
= parse_find_node("desktopMenuIcons", node
)))
675 config_menu_client_list_icons
= parse_bool(doc
, n
);
679 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
684 node
= node
->children
;
685 if ((n
= parse_find_node("strength", node
)))
686 config_resist_win
= parse_int(doc
, n
);
687 if ((n
= parse_find_node("screen_edge_strength", node
)))
688 config_resist_edge
= parse_int(doc
, n
);
689 if ((n
= parse_find_node("edges_hit_layers_below", node
)))
690 config_resist_layers_below
= parse_bool(doc
, n
);
696 const gchar
*actname
;
699 static void bind_default_keyboard()
702 ObDefKeyBind binds
[] = {
703 { "A-Tab", "NextWindow" },
704 { "S-A-Tab", "PreviousWindow" },
709 for (it
= binds
; it
->key
; ++it
) {
710 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
711 keyboard_bind(l
, action_from_string(it
->actname
,
712 OB_USER_ACTION_KEYBOARD_KEY
));
719 const gchar
*context
;
720 const ObMouseAction mact
;
721 const gchar
*actname
;
724 static void bind_default_mouse()
727 ObDefMouseBind binds
[] = {
728 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
729 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
730 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
731 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
732 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
733 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
734 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
735 { "Left", "Handle", OB_MOUSE_ACTION_PRESS
, "Focus" },
736 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
737 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
738 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
739 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
740 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
741 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
742 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
743 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
744 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
745 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
746 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
747 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
748 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
749 { "Left", "Handle", OB_MOUSE_ACTION_CLICK
, "Raise" },
750 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
751 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
752 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
753 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
754 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Raise" },
755 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "Raise" },
756 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Raise" },
757 { "Left", "Icon", OB_MOUSE_ACTION_CLICK
, "Raise" },
758 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "Raise" },
759 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "Raise" },
760 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Close" },
761 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "ToggleMaximizeFull" },
762 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Iconify" },
763 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "ToggleOmnipresent" },
764 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "ToggleShade" },
765 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
766 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
767 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
768 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
769 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION
, "Move" },
770 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION
, "Move" },
771 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION
, "Resize" },
772 { NULL
, NULL
, 0, NULL
}
775 for (it
= binds
; it
->button
; ++it
) {
778 case OB_MOUSE_ACTION_PRESS
:
779 uact
= OB_USER_ACTION_MOUSE_PRESS
; break;
780 case OB_MOUSE_ACTION_RELEASE
:
781 uact
= OB_USER_ACTION_MOUSE_RELEASE
; break;
782 case OB_MOUSE_ACTION_CLICK
:
783 uact
= OB_USER_ACTION_MOUSE_CLICK
; break;
784 case OB_MOUSE_ACTION_DOUBLE_CLICK
:
785 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
; break;
786 case OB_MOUSE_ACTION_MOTION
:
787 uact
= OB_USER_ACTION_MOUSE_MOTION
; break;
789 g_assert_not_reached();
791 mouse_bind(it
->button
, it
->context
, it
->mact
,
792 action_from_string(it
->actname
, uact
));
796 void config_startup(ObParseInst
*i
)
798 config_focus_new
= TRUE
;
799 config_focus_follow
= FALSE
;
800 config_focus_delay
= 0;
801 config_focus_raise
= FALSE
;
802 config_focus_last
= FALSE
;
804 parse_register(i
, "focus", parse_focus
, NULL
);
806 config_place_policy
= OB_PLACE_POLICY_SMART
;
808 parse_register(i
, "placement", parse_placement
, NULL
);
812 config_animate_iconify
= FALSE
;
813 config_title_layout
= g_strdup("NLIMC");
814 config_theme_keepborder
= TRUE
;
815 config_theme_hidedisabled
= FALSE
;
817 config_font_activewindow
= NULL
;
818 config_font_inactivewindow
= NULL
;
819 config_font_menuitem
= NULL
;
820 config_font_menutitle
= NULL
;
822 parse_register(i
, "theme", parse_theme
, NULL
);
824 config_desktops_num
= 4;
825 config_screen_firstdesk
= 1;
826 config_desktops_names
= NULL
;
828 parse_register(i
, "desktops", parse_desktops
, NULL
);
830 config_resize_redraw
= TRUE
;
831 config_resize_four_corners
= FALSE
;
832 config_resize_popup_show
= 1; /* nonpixel increments */
833 config_resize_popup_pos
= 0; /* center of client */
835 parse_register(i
, "resize", parse_resize
, NULL
);
837 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
838 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
839 config_dock_floating
= FALSE
;
840 config_dock_nostrut
= FALSE
;
843 config_dock_orient
= OB_ORIENTATION_VERT
;
844 config_dock_hide
= FALSE
;
845 config_dock_hide_delay
= 300;
846 config_dock_show_delay
= 300;
847 config_dock_app_move_button
= 2; /* middle */
848 config_dock_app_move_modifiers
= 0;
850 parse_register(i
, "dock", parse_dock
, NULL
);
852 translate_key("C-g", &config_keyboard_reset_state
,
853 &config_keyboard_reset_keycode
);
855 bind_default_keyboard();
857 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
859 config_mouse_threshold
= 3;
860 config_mouse_dclicktime
= 200;
862 bind_default_mouse();
864 parse_register(i
, "mouse", parse_mouse
, NULL
);
866 config_resist_win
= 10;
867 config_resist_edge
= 20;
868 config_resist_layers_below
= FALSE
;
870 parse_register(i
, "resistance", parse_resistance
, NULL
);
872 config_menu_warppointer
= TRUE
;
873 config_menu_hide_delay
= 250;
874 config_menu_middle
= FALSE
;
875 config_submenu_show_delay
= 0;
876 config_menu_client_list_icons
= TRUE
;
877 config_menu_files
= NULL
;
879 parse_register(i
, "menu", parse_menu
, NULL
);
881 config_per_app_settings
= NULL
;
883 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
886 void config_shutdown()
890 g_free(config_theme
);
892 g_free(config_title_layout
);
894 RrFontClose(config_font_activewindow
);
895 RrFontClose(config_font_inactivewindow
);
896 RrFontClose(config_font_menuitem
);
897 RrFontClose(config_font_menutitle
);
899 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
901 g_slist_free(config_desktops_names
);
903 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
905 g_slist_free(config_menu_files
);
907 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
908 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
914 g_slist_free(config_per_app_settings
);