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">
107 .. there is a lot more settings available
112 /* Manages settings for individual applications.
113 Some notes: monitor is the screen number in a multi monitor
114 (Xinerama) setup (starting from 0) or mouse, meaning the
115 monitor the pointer is on. Default: mouse.
116 Layer can be three values, above (Always on top), below
117 (Always on bottom) and everything else (normal behaviour).
118 Positions can be an integer value or center, which will
119 center the window in the specified axis. Position is within
120 the monitor, so <position><x>center</x></position><monitor>2</monitor>
121 will center the window on the second monitor.
123 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
124 xmlNodePtr node
, gpointer d
)
126 xmlNodePtr app
= parse_find_node("application", node
->children
);
128 gboolean name_set
, class_set
;
129 gboolean x_pos_given
;
132 name_set
= class_set
= x_pos_given
= FALSE
;
134 class_set
= parse_attr_string("class", app
, &class);
135 name_set
= parse_attr_string("name", app
, &name
);
136 if (class_set
|| name_set
) {
138 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
141 settings
->name
= name
;
143 settings
->name
= NULL
;
146 settings
->class = class;
148 settings
->class = NULL
;
150 if (!parse_attr_string("role", app
, &settings
->role
))
151 settings
->role
= NULL
;
153 settings
->decor
= -1;
154 if ((n
= parse_find_node("decor", app
->children
)))
155 if (!parse_contains("default", doc
, n
))
156 settings
->decor
= parse_bool(doc
, n
);
158 settings
->shade
= -1;
159 if ((n
= parse_find_node("shade", app
->children
)))
160 if (!parse_contains("default", doc
, n
))
161 settings
->shade
= parse_bool(doc
, n
);
163 settings
->position
.x
= settings
->position
.y
= 0;
164 settings
->pos_given
= FALSE
;
165 if ((n
= parse_find_node("position", app
->children
))) {
166 if ((c
= parse_find_node("x", n
->children
)))
167 if (!parse_contains("default", doc
, c
)) {
168 gchar
*s
= parse_string(doc
, c
);
169 if (!strcmp(s
, "center")) {
170 settings
->center_x
= TRUE
;
173 settings
->position
.x
= parse_int(doc
, c
);
179 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
)))
180 if (!parse_contains("default", doc
, c
)) {
181 gchar
*s
= parse_string(doc
, c
);
182 if (!strcmp(s
, "center")) {
183 settings
->center_y
= TRUE
;
184 settings
->pos_given
= TRUE
;
186 settings
->position
.y
= parse_int(doc
, c
);
187 settings
->pos_given
= TRUE
;
192 if (settings
->pos_given
&&
193 (c
= parse_find_node("monitor", n
->children
)))
194 if (!parse_contains("default", doc
, c
)) {
195 gchar
*s
= parse_string(doc
, c
);
196 if (!strcmp(s
, "mouse"))
197 settings
->monitor
= 0;
199 settings
->monitor
= parse_int(doc
, c
) + 1;
204 settings
->focus
= -1;
205 if ((n
= parse_find_node("focus", app
->children
)))
206 if (!parse_contains("default", doc
, n
))
207 settings
->focus
= parse_bool(doc
, n
);
209 if ((n
= parse_find_node("desktop", app
->children
))) {
210 if (!parse_contains("default", doc
, n
)) {
211 gchar
*s
= parse_string(doc
, n
);
212 if (!strcmp(s
, "all"))
213 settings
->desktop
= DESKTOP_ALL
;
215 gint i
= parse_int(doc
, n
);
217 settings
->desktop
= i
;
220 settings
->desktop
= 0;
223 settings
->layer
= -2;
224 if ((n
= parse_find_node("layer", app
->children
)))
225 if (!parse_contains("default", doc
, n
)) {
226 gchar
*s
= parse_string(doc
, n
);
227 if (!strcmp(s
, "above"))
229 else if (!strcmp(s
, "below"))
230 settings
->layer
= -1;
236 settings
->iconic
= -1;
237 if ((n
= parse_find_node("iconic", app
->children
)))
238 if (!parse_contains("default", doc
, n
))
239 settings
->iconic
= parse_bool(doc
, n
);
241 settings
->skip_pager
= -1;
242 if ((n
= parse_find_node("skip_pager", app
->children
)))
243 if (!parse_contains("default", doc
, n
))
244 settings
->skip_pager
= parse_bool(doc
, n
);
246 settings
->skip_taskbar
= -1;
247 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
248 if (!parse_contains("default", doc
, n
))
249 settings
->skip_taskbar
= parse_bool(doc
, n
);
251 settings
->fullscreen
= -1;
252 if ((n
= parse_find_node("fullscreen", app
->children
)))
253 if (!parse_contains("default", doc
, n
))
254 settings
->fullscreen
= parse_bool(doc
, n
);
256 settings
->max_horz
= -1;
257 settings
->max_vert
= -1;
258 if ((n
= parse_find_node("maximized", app
->children
)))
259 if (!parse_contains("default", doc
, n
)) {
260 gchar
*s
= parse_string(doc
, n
);
261 if (!strcmp(s
, "horizontal")) {
262 settings
->max_horz
= TRUE
;
263 settings
->max_vert
= FALSE
;
264 } else if (!strcmp(s
, "vertical")) {
265 settings
->max_horz
= FALSE
;
266 settings
->max_vert
= TRUE
;
268 settings
->max_horz
= settings
->max_vert
=
273 config_per_app_settings
= g_slist_append(config_per_app_settings
,
274 (gpointer
) settings
);
277 app
= parse_find_node("application", app
->next
);
284 <action name="ChangeDesktop">
291 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
296 gboolean is_chroot
= FALSE
;
298 if (!parse_attr_string("key", node
, &key
))
301 parse_attr_bool("chroot", node
, &is_chroot
);
303 keylist
= g_list_append(keylist
, key
);
305 if ((n
= parse_find_node("keybind", node
->children
))) {
307 parse_key(i
, doc
, n
, keylist
);
308 n
= parse_find_node("keybind", n
->next
);
311 else if ((n
= parse_find_node("action", node
->children
))) {
315 action
= action_parse(i
, doc
, n
, OB_USER_ACTION_KEYBOARD_KEY
);
317 keyboard_bind(keylist
, action
);
318 n
= parse_find_node("action", n
->next
);
323 keyboard_chroot(keylist
);
326 keylist
= g_list_delete_link(keylist
, g_list_last(keylist
));
329 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
335 keyboard_unbind_all();
337 if ((n
= parse_find_node("chainQuitKey", node
->children
))) {
338 key
= parse_string(doc
, n
);
339 translate_key(key
, &config_keyboard_reset_state
,
340 &config_keyboard_reset_keycode
);
344 if ((n
= parse_find_node("keybind", node
->children
)))
346 parse_key(i
, doc
, n
, NULL
);
347 n
= parse_find_node("keybind", n
->next
);
353 <context name="Titlebar">
354 <mousebind button="Left" action="Press">
355 <action name="Raise"></action>
361 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
364 xmlNodePtr n
, nbut
, nact
;
373 node
= node
->children
;
375 if ((n
= parse_find_node("dragThreshold", node
)))
376 config_mouse_threshold
= parse_int(doc
, n
);
377 if ((n
= parse_find_node("doubleClickTime", node
)))
378 config_mouse_dclicktime
= parse_int(doc
, n
);
380 n
= parse_find_node("context", node
);
382 if (!parse_attr_string("name", n
, &contextstr
))
384 nbut
= parse_find_node("mousebind", n
->children
);
386 if (!parse_attr_string("button", nbut
, &buttonstr
))
388 if (parse_attr_contains("press", nbut
, "action")) {
389 uact
= OB_USER_ACTION_MOUSE_PRESS
;
390 mact
= OB_MOUSE_ACTION_PRESS
;
391 } else if (parse_attr_contains("release", nbut
, "action")) {
392 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
393 mact
= OB_MOUSE_ACTION_RELEASE
;
394 } else if (parse_attr_contains("click", nbut
, "action")) {
395 uact
= OB_USER_ACTION_MOUSE_CLICK
;
396 mact
= OB_MOUSE_ACTION_CLICK
;
397 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
398 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
399 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
400 } else if (parse_attr_contains("drag", nbut
, "action")) {
401 uact
= OB_USER_ACTION_MOUSE_MOTION
;
402 mact
= OB_MOUSE_ACTION_MOTION
;
405 nact
= parse_find_node("action", nbut
->children
);
407 if ((action
= action_parse(i
, doc
, nact
, uact
)))
408 mouse_bind(buttonstr
, contextstr
, mact
, action
);
409 nact
= parse_find_node("action", nact
->next
);
413 nbut
= parse_find_node("mousebind", nbut
->next
);
417 n
= parse_find_node("context", n
->next
);
421 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
426 node
= node
->children
;
428 if ((n
= parse_find_node("focusNew", node
)))
429 config_focus_new
= parse_bool(doc
, n
);
430 if ((n
= parse_find_node("followMouse", node
)))
431 config_focus_follow
= parse_bool(doc
, n
);
432 if ((n
= parse_find_node("focusDelay", node
)))
433 config_focus_delay
= parse_int(doc
, n
) * 1000;
434 if ((n
= parse_find_node("raiseOnFocus", node
)))
435 config_focus_raise
= parse_bool(doc
, n
);
436 if ((n
= parse_find_node("focusLast", node
)))
437 config_focus_last
= parse_bool(doc
, n
);
440 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
445 node
= node
->children
;
447 if ((n
= parse_find_node("policy", node
)))
448 if (parse_contains("UnderMouse", doc
, n
))
449 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
452 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
457 node
= node
->children
;
459 if ((n
= parse_find_node("name", node
))) {
462 g_free(config_theme
);
463 c
= parse_string(doc
, n
);
464 config_theme
= parse_expand_tilde(c
);
467 if ((n
= parse_find_node("titleLayout", node
))) {
468 g_free(config_title_layout
);
469 config_title_layout
= parse_string(doc
, n
);
471 if ((n
= parse_find_node("keepBorder", node
)))
472 config_theme_keepborder
= parse_bool(doc
, n
);
473 if ((n
= parse_find_node("hideDisabled", node
)))
474 config_theme_hidedisabled
= parse_bool(doc
, n
);
475 if ((n
= parse_find_node("animateIconify", node
)))
476 config_animate_iconify
= parse_bool(doc
, n
);
478 n
= parse_find_node("font", node
);
482 gchar
*name
= g_strdup(RrDefaultFontFamily
);
483 gint size
= RrDefaultFontSize
;
484 RrFontWeight weight
= RrDefaultFontWeight
;
485 RrFontSlant slant
= RrDefaultFontSlant
;
487 if (parse_attr_contains("ActiveWindow", n
, "place"))
488 font
= &config_font_activewindow
;
489 else if (parse_attr_contains("InactiveWindow", n
, "place"))
490 font
= &config_font_inactivewindow
;
491 else if (parse_attr_contains("MenuHeader", n
, "place"))
492 font
= &config_font_menutitle
;
493 else if (parse_attr_contains("MenuItem", n
, "place"))
494 font
= &config_font_menuitem
;
495 else if (parse_attr_contains("OnScreenDisplay", n
, "place"))
496 font
= &config_font_osd
;
500 if ((fnode
= parse_find_node("name", n
->children
))) {
502 name
= parse_string(doc
, fnode
);
504 if ((fnode
= parse_find_node("size", n
->children
))) {
505 int s
= parse_int(doc
, fnode
);
508 if ((fnode
= parse_find_node("weight", n
->children
))) {
509 gchar
*w
= parse_string(doc
, fnode
);
510 if (!g_ascii_strcasecmp(w
, "Bold"))
511 weight
= RR_FONTWEIGHT_BOLD
;
514 if ((fnode
= parse_find_node("slant", n
->children
))) {
515 gchar
*s
= parse_string(doc
, fnode
);
516 if (!g_ascii_strcasecmp(s
, "Italic"))
517 slant
= RR_FONTSLANT_ITALIC
;
518 if (!g_ascii_strcasecmp(s
, "Oblique"))
519 slant
= RR_FONTSLANT_OBLIQUE
;
523 *font
= RrFontOpen(ob_rr_inst
, name
, size
, weight
, slant
);
526 n
= parse_find_node("font", n
->next
);
530 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
535 node
= node
->children
;
537 if ((n
= parse_find_node("number", node
))) {
538 gint d
= parse_int(doc
, n
);
540 config_desktops_num
= d
;
542 if ((n
= parse_find_node("firstdesk", node
))) {
543 gint d
= parse_int(doc
, n
);
545 config_screen_firstdesk
= (unsigned) d
;
547 if ((n
= parse_find_node("names", node
))) {
551 for (it
= config_desktops_names
; it
; it
= it
->next
)
553 g_slist_free(config_desktops_names
);
554 config_desktops_names
= NULL
;
556 nname
= parse_find_node("name", n
->children
);
558 config_desktops_names
= g_slist_append(config_desktops_names
,
559 parse_string(doc
, nname
));
560 nname
= parse_find_node("name", nname
->next
);
565 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
570 node
= node
->children
;
572 if ((n
= parse_find_node("drawContents", node
)))
573 config_resize_redraw
= parse_bool(doc
, n
);
574 if ((n
= parse_find_node("popupShow", node
))) {
575 config_resize_popup_show
= parse_int(doc
, n
);
576 if (parse_contains("Always", doc
, n
))
577 config_resize_popup_show
= 2;
578 else if (parse_contains("Never", doc
, n
))
579 config_resize_popup_show
= 0;
580 else if (parse_contains("Nonpixel", doc
, n
))
581 config_resize_popup_show
= 1;
583 if ((n
= parse_find_node("popupPosition", node
))) {
584 config_resize_popup_pos
= parse_int(doc
, n
);
585 if (parse_contains("Top", doc
, n
))
586 config_resize_popup_pos
= 1;
587 else if (parse_contains("Center", doc
, n
))
588 config_resize_popup_pos
= 0;
592 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
597 node
= node
->children
;
599 if ((n
= parse_find_node("position", node
))) {
600 if (parse_contains("TopLeft", doc
, n
))
601 config_dock_floating
= FALSE
,
602 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
603 else if (parse_contains("Top", doc
, n
))
604 config_dock_floating
= FALSE
,
605 config_dock_pos
= OB_DIRECTION_NORTH
;
606 else if (parse_contains("TopRight", doc
, n
))
607 config_dock_floating
= FALSE
,
608 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
609 else if (parse_contains("Right", doc
, n
))
610 config_dock_floating
= FALSE
,
611 config_dock_pos
= OB_DIRECTION_EAST
;
612 else if (parse_contains("BottomRight", doc
, n
))
613 config_dock_floating
= FALSE
,
614 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
615 else if (parse_contains("Bottom", doc
, n
))
616 config_dock_floating
= FALSE
,
617 config_dock_pos
= OB_DIRECTION_SOUTH
;
618 else if (parse_contains("BottomLeft", doc
, n
))
619 config_dock_floating
= FALSE
,
620 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
621 else if (parse_contains("Left", doc
, n
))
622 config_dock_floating
= FALSE
,
623 config_dock_pos
= OB_DIRECTION_WEST
;
624 else if (parse_contains("Floating", doc
, n
))
625 config_dock_floating
= TRUE
;
627 if (config_dock_floating
) {
628 if ((n
= parse_find_node("floatingX", node
)))
629 config_dock_x
= parse_int(doc
, n
);
630 if ((n
= parse_find_node("floatingY", node
)))
631 config_dock_y
= parse_int(doc
, n
);
633 if ((n
= parse_find_node("noStrut", node
)))
634 config_dock_nostrut
= parse_bool(doc
, n
);
636 if ((n
= parse_find_node("stacking", node
))) {
637 if (parse_contains("above", doc
, n
))
638 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
639 else if (parse_contains("normal", doc
, n
))
640 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
641 else if (parse_contains("below", doc
, n
))
642 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
644 if ((n
= parse_find_node("direction", node
))) {
645 if (parse_contains("horizontal", doc
, n
))
646 config_dock_orient
= OB_ORIENTATION_HORZ
;
647 else if (parse_contains("vertical", doc
, n
))
648 config_dock_orient
= OB_ORIENTATION_VERT
;
650 if ((n
= parse_find_node("autoHide", node
)))
651 config_dock_hide
= parse_bool(doc
, n
);
652 if ((n
= parse_find_node("hideDelay", node
)))
653 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
654 if ((n
= parse_find_node("showDelay", node
)))
655 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
656 if ((n
= parse_find_node("moveButton", node
))) {
657 gchar
*str
= parse_string(doc
, n
);
659 if (translate_button(str
, &s
, &b
)) {
660 config_dock_app_move_button
= b
;
661 config_dock_app_move_modifiers
= s
;
663 g_message(_("Invalid button '%s' specified in config file"), str
);
669 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
673 for (node
= node
->children
; node
; node
= node
->next
) {
674 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
677 c
= parse_string(doc
, node
);
678 config_menu_files
= g_slist_append(config_menu_files
,
679 parse_expand_tilde(c
));
682 if ((n
= parse_find_node("hideDelay", node
)))
683 config_menu_hide_delay
= parse_int(doc
, n
);
684 if ((n
= parse_find_node("middle", node
)))
685 config_menu_middle
= parse_bool(doc
, n
);
686 if ((n
= parse_find_node("submenuShowDelay", node
)))
687 config_submenu_show_delay
= parse_int(doc
, n
);
688 if ((n
= parse_find_node("applicationIcons", node
)))
689 config_menu_client_list_icons
= parse_bool(doc
, n
);
693 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
698 node
= node
->children
;
699 if ((n
= parse_find_node("strength", node
)))
700 config_resist_win
= parse_int(doc
, n
);
701 if ((n
= parse_find_node("screen_edge_strength", node
)))
702 config_resist_edge
= parse_int(doc
, n
);
703 if ((n
= parse_find_node("edges_hit_layers_below", node
)))
704 config_resist_layers_below
= parse_bool(doc
, n
);
710 const gchar
*actname
;
713 static void bind_default_keyboard()
716 ObDefKeyBind binds
[] = {
717 { "A-Tab", "NextWindow" },
718 { "S-A-Tab", "PreviousWindow" },
723 for (it
= binds
; it
->key
; ++it
) {
724 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
725 keyboard_bind(l
, action_from_string(it
->actname
,
726 OB_USER_ACTION_KEYBOARD_KEY
));
733 const gchar
*context
;
734 const ObMouseAction mact
;
735 const gchar
*actname
;
738 static void bind_default_mouse()
741 ObDefMouseBind binds
[] = {
742 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
743 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
744 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
745 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
746 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
747 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
748 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
749 { "Left", "Handle", OB_MOUSE_ACTION_PRESS
, "Focus" },
750 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
751 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
752 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
753 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
754 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
755 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
756 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
757 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
758 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
759 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
760 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
761 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
762 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
763 { "Left", "Handle", OB_MOUSE_ACTION_CLICK
, "Raise" },
764 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
765 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
766 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
767 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
768 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Raise" },
769 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "Raise" },
770 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Raise" },
771 { "Left", "Icon", OB_MOUSE_ACTION_CLICK
, "Raise" },
772 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "Raise" },
773 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "Raise" },
774 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Close" },
775 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "ToggleMaximizeFull" },
776 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Iconify" },
777 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "ToggleOmnipresent" },
778 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "ToggleShade" },
779 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
780 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
781 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
782 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
783 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION
, "Move" },
784 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION
, "Move" },
785 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION
, "Resize" },
786 { NULL
, NULL
, 0, NULL
}
789 for (it
= binds
; it
->button
; ++it
) {
792 case OB_MOUSE_ACTION_PRESS
:
793 uact
= OB_USER_ACTION_MOUSE_PRESS
; break;
794 case OB_MOUSE_ACTION_RELEASE
:
795 uact
= OB_USER_ACTION_MOUSE_RELEASE
; break;
796 case OB_MOUSE_ACTION_CLICK
:
797 uact
= OB_USER_ACTION_MOUSE_CLICK
; break;
798 case OB_MOUSE_ACTION_DOUBLE_CLICK
:
799 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
; break;
800 case OB_MOUSE_ACTION_MOTION
:
801 uact
= OB_USER_ACTION_MOUSE_MOTION
; break;
803 g_assert_not_reached();
805 mouse_bind(it
->button
, it
->context
, it
->mact
,
806 action_from_string(it
->actname
, uact
));
810 void config_startup(ObParseInst
*i
)
812 config_focus_new
= TRUE
;
813 config_focus_follow
= FALSE
;
814 config_focus_delay
= 0;
815 config_focus_raise
= FALSE
;
816 config_focus_last
= FALSE
;
818 parse_register(i
, "focus", parse_focus
, NULL
);
820 config_place_policy
= OB_PLACE_POLICY_SMART
;
822 parse_register(i
, "placement", parse_placement
, NULL
);
826 config_animate_iconify
= TRUE
;
827 config_title_layout
= g_strdup("NLIMC");
828 config_theme_keepborder
= TRUE
;
829 config_theme_hidedisabled
= FALSE
;
831 config_font_activewindow
= NULL
;
832 config_font_inactivewindow
= NULL
;
833 config_font_menuitem
= NULL
;
834 config_font_menutitle
= NULL
;
836 parse_register(i
, "theme", parse_theme
, NULL
);
838 config_desktops_num
= 4;
839 config_screen_firstdesk
= 1;
840 config_desktops_names
= NULL
;
842 parse_register(i
, "desktops", parse_desktops
, NULL
);
844 config_resize_redraw
= TRUE
;
845 config_resize_four_corners
= FALSE
;
846 config_resize_popup_show
= 1; /* nonpixel increments */
847 config_resize_popup_pos
= 0; /* center of client */
849 parse_register(i
, "resize", parse_resize
, NULL
);
851 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
852 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
853 config_dock_floating
= FALSE
;
854 config_dock_nostrut
= FALSE
;
857 config_dock_orient
= OB_ORIENTATION_VERT
;
858 config_dock_hide
= FALSE
;
859 config_dock_hide_delay
= 300;
860 config_dock_show_delay
= 300;
861 config_dock_app_move_button
= 2; /* middle */
862 config_dock_app_move_modifiers
= 0;
864 parse_register(i
, "dock", parse_dock
, NULL
);
866 translate_key("C-g", &config_keyboard_reset_state
,
867 &config_keyboard_reset_keycode
);
869 bind_default_keyboard();
871 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
873 config_mouse_threshold
= 3;
874 config_mouse_dclicktime
= 200;
876 bind_default_mouse();
878 parse_register(i
, "mouse", parse_mouse
, NULL
);
880 config_resist_win
= 10;
881 config_resist_edge
= 20;
882 config_resist_layers_below
= FALSE
;
884 parse_register(i
, "resistance", parse_resistance
, NULL
);
886 config_menu_warppointer
= TRUE
;
887 config_menu_hide_delay
= 250;
888 config_menu_middle
= FALSE
;
889 config_submenu_show_delay
= 0;
890 config_menu_client_list_icons
= TRUE
;
891 config_menu_files
= NULL
;
893 parse_register(i
, "menu", parse_menu
, NULL
);
895 config_per_app_settings
= NULL
;
897 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
900 void config_shutdown()
904 g_free(config_theme
);
906 g_free(config_title_layout
);
908 RrFontClose(config_font_activewindow
);
909 RrFontClose(config_font_inactivewindow
);
910 RrFontClose(config_font_menuitem
);
911 RrFontClose(config_font_menutitle
);
913 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
915 g_slist_free(config_desktops_names
);
917 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
919 g_slist_free(config_menu_files
);
921 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
922 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
928 g_slist_free(config_per_app_settings
);