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
;
42 gchar
*config_title_layout
;
44 gboolean config_animate_iconify
;
46 RrFont
*config_font_activewindow
;
47 RrFont
*config_font_inactivewindow
;
48 RrFont
*config_font_menuitem
;
49 RrFont
*config_font_menutitle
;
50 RrFont
*config_font_osd
;
52 gint config_desktops_num
;
53 GSList
*config_desktops_names
;
54 guint config_screen_firstdesk
;
56 gboolean config_resize_redraw
;
57 gboolean config_resize_four_corners
;
58 gint config_resize_popup_show
;
59 gint config_resize_popup_pos
;
61 ObStackingLayer config_dock_layer
;
62 gboolean config_dock_floating
;
63 gboolean config_dock_nostrut
;
64 ObDirection config_dock_pos
;
67 ObOrientation config_dock_orient
;
68 gboolean config_dock_hide
;
69 guint config_dock_hide_delay
;
70 guint config_dock_show_delay
;
71 guint config_dock_app_move_button
;
72 guint config_dock_app_move_modifiers
;
74 guint config_keyboard_reset_keycode
;
75 guint config_keyboard_reset_state
;
77 gint config_mouse_threshold
;
78 gint config_mouse_dclicktime
;
80 guint config_menu_hide_delay
;
81 gboolean config_menu_middle
;
82 guint config_submenu_show_delay
;
83 gboolean config_menu_client_list_icons
;
85 GSList
*config_menu_files
;
87 gint config_resist_win
;
88 gint config_resist_edge
;
90 GSList
*config_per_app_settings
;
94 <application name="aterm">
97 <application name="Rhythmbox">
104 .. there is a lot more settings available
109 /* Manages settings for individual applications.
110 Some notes: monitor is the screen number in a multi monitor
111 (Xinerama) setup (starting from 0) or mouse, meaning the
112 monitor the pointer is on. Default: mouse.
113 Layer can be three values, above (Always on top), below
114 (Always on bottom) and everything else (normal behaviour).
115 Positions can be an integer value or center, which will
116 center the window in the specified axis. Position is within
117 the monitor, so <position><x>center</x></position><monitor>2</monitor>
118 will center the window on the second monitor.
120 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
121 xmlNodePtr node
, gpointer d
)
123 xmlNodePtr app
= parse_find_node("application", node
->children
);
125 gboolean name_set
, class_set
;
126 gboolean x_pos_given
;
129 name_set
= class_set
= x_pos_given
= FALSE
;
131 class_set
= parse_attr_string("class", app
, &class);
132 name_set
= parse_attr_string("name", app
, &name
);
133 if (class_set
|| name_set
) {
135 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
138 settings
->name
= name
;
140 settings
->name
= NULL
;
143 settings
->class = class;
145 settings
->class = NULL
;
147 if (!parse_attr_string("role", app
, &settings
->role
))
148 settings
->role
= NULL
;
150 settings
->decor
= -1;
151 if ((n
= parse_find_node("decor", app
->children
)))
152 if (!parse_contains("default", doc
, n
))
153 settings
->decor
= parse_bool(doc
, n
);
155 settings
->shade
= -1;
156 if ((n
= parse_find_node("shade", app
->children
)))
157 if (!parse_contains("default", doc
, n
))
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 if (!parse_contains("default", doc
, c
)) {
165 gchar
*s
= parse_string(doc
, c
);
166 if (!strcmp(s
, "center")) {
167 settings
->center_x
= TRUE
;
170 settings
->position
.x
= parse_int(doc
, c
);
176 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
)))
177 if (!parse_contains("default", doc
, c
)) {
178 gchar
*s
= parse_string(doc
, c
);
179 if (!strcmp(s
, "center")) {
180 settings
->center_y
= TRUE
;
181 settings
->pos_given
= TRUE
;
183 settings
->position
.y
= parse_int(doc
, c
);
184 settings
->pos_given
= TRUE
;
189 if (settings
->pos_given
&&
190 (c
= parse_find_node("monitor", n
->children
)))
191 if (!parse_contains("default", doc
, c
)) {
192 gchar
*s
= parse_string(doc
, c
);
193 if (!strcmp(s
, "mouse"))
194 settings
->monitor
= 0;
196 settings
->monitor
= parse_int(doc
, c
) + 1;
201 settings
->focus
= -1;
202 if ((n
= parse_find_node("focus", app
->children
)))
203 if (!parse_contains("default", doc
, n
))
204 settings
->focus
= parse_bool(doc
, n
);
206 if ((n
= parse_find_node("desktop", app
->children
))) {
207 if (!parse_contains("default", doc
, n
)) {
208 gchar
*s
= parse_string(doc
, n
);
209 if (!strcmp(s
, "all"))
210 settings
->desktop
= DESKTOP_ALL
;
212 gint i
= parse_int(doc
, n
);
214 settings
->desktop
= i
;
218 settings
->desktop
= 0;
221 settings
->layer
= -2;
222 if ((n
= parse_find_node("layer", app
->children
)))
223 if (!parse_contains("default", doc
, n
)) {
224 gchar
*s
= parse_string(doc
, n
);
225 if (!strcmp(s
, "above"))
227 else if (!strcmp(s
, "below"))
228 settings
->layer
= -1;
234 settings
->iconic
= -1;
235 if ((n
= parse_find_node("iconic", app
->children
)))
236 if (!parse_contains("default", doc
, n
))
237 settings
->iconic
= parse_bool(doc
, n
);
239 settings
->skip_pager
= -1;
240 if ((n
= parse_find_node("skip_pager", app
->children
)))
241 if (!parse_contains("default", doc
, n
))
242 settings
->skip_pager
= parse_bool(doc
, n
);
244 settings
->skip_taskbar
= -1;
245 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
246 if (!parse_contains("default", doc
, n
))
247 settings
->skip_taskbar
= parse_bool(doc
, n
);
249 settings
->fullscreen
= -1;
250 if ((n
= parse_find_node("fullscreen", app
->children
)))
251 if (!parse_contains("default", doc
, n
))
252 settings
->fullscreen
= parse_bool(doc
, n
);
254 settings
->max_horz
= -1;
255 settings
->max_vert
= -1;
256 if ((n
= parse_find_node("maximized", app
->children
)))
257 if (!parse_contains("default", doc
, n
)) {
258 gchar
*s
= parse_string(doc
, n
);
259 if (!strcmp(s
, "horizontal")) {
260 settings
->max_horz
= TRUE
;
261 settings
->max_vert
= FALSE
;
262 } else if (!strcmp(s
, "vertical")) {
263 settings
->max_horz
= FALSE
;
264 settings
->max_vert
= TRUE
;
266 settings
->max_horz
= settings
->max_vert
=
271 config_per_app_settings
= g_slist_append(config_per_app_settings
,
272 (gpointer
) settings
);
275 app
= parse_find_node("application", app
->next
);
282 <action name="ChangeDesktop">
289 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
294 gboolean is_chroot
= FALSE
;
296 if (!parse_attr_string("key", node
, &key
))
299 parse_attr_bool("chroot", node
, &is_chroot
);
301 keylist
= g_list_append(keylist
, key
);
303 if ((n
= parse_find_node("keybind", node
->children
))) {
305 parse_key(i
, doc
, n
, keylist
);
306 n
= parse_find_node("keybind", n
->next
);
309 else if ((n
= parse_find_node("action", node
->children
))) {
313 action
= action_parse(i
, doc
, n
, OB_USER_ACTION_KEYBOARD_KEY
);
315 keyboard_bind(keylist
, action
);
316 n
= parse_find_node("action", n
->next
);
321 keyboard_chroot(keylist
);
324 keylist
= g_list_delete_link(keylist
, g_list_last(keylist
));
327 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
333 keyboard_unbind_all();
335 if ((n
= parse_find_node("chainQuitKey", node
->children
))) {
336 key
= parse_string(doc
, n
);
337 translate_key(key
, &config_keyboard_reset_state
,
338 &config_keyboard_reset_keycode
);
342 if ((n
= parse_find_node("keybind", node
->children
)))
344 parse_key(i
, doc
, n
, NULL
);
345 n
= parse_find_node("keybind", n
->next
);
351 <context name="Titlebar">
352 <mousebind button="Left" action="Press">
353 <action name="Raise"></action>
359 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
362 xmlNodePtr n
, nbut
, nact
;
371 node
= node
->children
;
373 if ((n
= parse_find_node("dragThreshold", node
)))
374 config_mouse_threshold
= parse_int(doc
, n
);
375 if ((n
= parse_find_node("doubleClickTime", node
)))
376 config_mouse_dclicktime
= parse_int(doc
, n
);
378 n
= parse_find_node("context", node
);
380 if (!parse_attr_string("name", n
, &contextstr
))
382 nbut
= parse_find_node("mousebind", n
->children
);
384 if (!parse_attr_string("button", nbut
, &buttonstr
))
386 if (parse_attr_contains("press", nbut
, "action")) {
387 uact
= OB_USER_ACTION_MOUSE_PRESS
;
388 mact
= OB_MOUSE_ACTION_PRESS
;
389 } else if (parse_attr_contains("release", nbut
, "action")) {
390 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
391 mact
= OB_MOUSE_ACTION_RELEASE
;
392 } else if (parse_attr_contains("click", nbut
, "action")) {
393 uact
= OB_USER_ACTION_MOUSE_CLICK
;
394 mact
= OB_MOUSE_ACTION_CLICK
;
395 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
396 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
397 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
398 } else if (parse_attr_contains("drag", nbut
, "action")) {
399 uact
= OB_USER_ACTION_MOUSE_MOTION
;
400 mact
= OB_MOUSE_ACTION_MOTION
;
403 nact
= parse_find_node("action", nbut
->children
);
405 if ((action
= action_parse(i
, doc
, nact
, uact
)))
406 mouse_bind(buttonstr
, contextstr
, mact
, action
);
407 nact
= parse_find_node("action", nact
->next
);
411 nbut
= parse_find_node("mousebind", nbut
->next
);
415 n
= parse_find_node("context", n
->next
);
419 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
424 node
= node
->children
;
426 if ((n
= parse_find_node("focusNew", node
)))
427 config_focus_new
= parse_bool(doc
, n
);
428 if ((n
= parse_find_node("followMouse", node
)))
429 config_focus_follow
= parse_bool(doc
, n
);
430 if ((n
= parse_find_node("focusDelay", node
)))
431 config_focus_delay
= parse_int(doc
, n
) * 1000;
432 if ((n
= parse_find_node("raiseOnFocus", node
)))
433 config_focus_raise
= parse_bool(doc
, n
);
434 if ((n
= parse_find_node("focusLast", node
)))
435 config_focus_last
= parse_bool(doc
, n
);
438 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
443 node
= node
->children
;
445 if ((n
= parse_find_node("policy", node
)))
446 if (parse_contains("UnderMouse", doc
, n
))
447 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
450 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
455 node
= node
->children
;
457 if ((n
= parse_find_node("name", node
))) {
460 g_free(config_theme
);
461 c
= parse_string(doc
, n
);
462 config_theme
= parse_expand_tilde(c
);
465 if ((n
= parse_find_node("titleLayout", node
))) {
468 g_free(config_title_layout
);
469 config_title_layout
= parse_string(doc
, n
);
471 /* replace duplicates with spaces */
472 for (c
= config_title_layout
; *c
!= '\0'; ++c
)
473 for (d
= c
+1; *d
!= '\0'; ++d
)
474 if (*c
== *d
) *d
= ' ';
476 if ((n
= parse_find_node("keepBorder", node
)))
477 config_theme_keepborder
= parse_bool(doc
, n
);
478 if ((n
= parse_find_node("animateIconify", node
)))
479 config_animate_iconify
= parse_bool(doc
, n
);
481 n
= parse_find_node("font", node
);
485 gchar
*name
= g_strdup(RrDefaultFontFamily
);
486 gint size
= RrDefaultFontSize
;
487 RrFontWeight weight
= RrDefaultFontWeight
;
488 RrFontSlant slant
= RrDefaultFontSlant
;
490 if (parse_attr_contains("ActiveWindow", n
, "place"))
491 font
= &config_font_activewindow
;
492 else if (parse_attr_contains("InactiveWindow", n
, "place"))
493 font
= &config_font_inactivewindow
;
494 else if (parse_attr_contains("MenuHeader", n
, "place"))
495 font
= &config_font_menutitle
;
496 else if (parse_attr_contains("MenuItem", n
, "place"))
497 font
= &config_font_menuitem
;
498 else if (parse_attr_contains("OnScreenDisplay", n
, "place"))
499 font
= &config_font_osd
;
503 if ((fnode
= parse_find_node("name", n
->children
))) {
505 name
= parse_string(doc
, fnode
);
507 if ((fnode
= parse_find_node("size", n
->children
))) {
508 int s
= parse_int(doc
, fnode
);
511 if ((fnode
= parse_find_node("weight", n
->children
))) {
512 gchar
*w
= parse_string(doc
, fnode
);
513 if (!g_ascii_strcasecmp(w
, "Bold"))
514 weight
= RR_FONTWEIGHT_BOLD
;
517 if ((fnode
= parse_find_node("slant", n
->children
))) {
518 gchar
*s
= parse_string(doc
, fnode
);
519 if (!g_ascii_strcasecmp(s
, "Italic"))
520 slant
= RR_FONTSLANT_ITALIC
;
521 if (!g_ascii_strcasecmp(s
, "Oblique"))
522 slant
= RR_FONTSLANT_OBLIQUE
;
526 *font
= RrFontOpen(ob_rr_inst
, name
, size
, weight
, slant
);
529 n
= parse_find_node("font", n
->next
);
533 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
538 node
= node
->children
;
540 if ((n
= parse_find_node("number", node
))) {
541 gint d
= parse_int(doc
, n
);
543 config_desktops_num
= d
;
545 if ((n
= parse_find_node("firstdesk", node
))) {
546 gint d
= parse_int(doc
, n
);
548 config_screen_firstdesk
= (unsigned) d
;
550 if ((n
= parse_find_node("names", node
))) {
554 for (it
= config_desktops_names
; it
; it
= it
->next
)
556 g_slist_free(config_desktops_names
);
557 config_desktops_names
= NULL
;
559 nname
= parse_find_node("name", n
->children
);
561 config_desktops_names
= g_slist_append(config_desktops_names
,
562 parse_string(doc
, nname
));
563 nname
= parse_find_node("name", nname
->next
);
568 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
573 node
= node
->children
;
575 if ((n
= parse_find_node("drawContents", node
)))
576 config_resize_redraw
= parse_bool(doc
, n
);
577 if ((n
= parse_find_node("popupShow", node
))) {
578 config_resize_popup_show
= parse_int(doc
, n
);
579 if (parse_contains("Always", doc
, n
))
580 config_resize_popup_show
= 2;
581 else if (parse_contains("Never", doc
, n
))
582 config_resize_popup_show
= 0;
583 else if (parse_contains("Nonpixel", doc
, n
))
584 config_resize_popup_show
= 1;
586 if ((n
= parse_find_node("popupPosition", node
))) {
587 config_resize_popup_pos
= parse_int(doc
, n
);
588 if (parse_contains("Top", doc
, n
))
589 config_resize_popup_pos
= 1;
590 else if (parse_contains("Center", doc
, n
))
591 config_resize_popup_pos
= 0;
595 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
600 node
= node
->children
;
602 if ((n
= parse_find_node("position", node
))) {
603 if (parse_contains("TopLeft", doc
, n
))
604 config_dock_floating
= FALSE
,
605 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
606 else if (parse_contains("Top", doc
, n
))
607 config_dock_floating
= FALSE
,
608 config_dock_pos
= OB_DIRECTION_NORTH
;
609 else if (parse_contains("TopRight", doc
, n
))
610 config_dock_floating
= FALSE
,
611 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
612 else if (parse_contains("Right", doc
, n
))
613 config_dock_floating
= FALSE
,
614 config_dock_pos
= OB_DIRECTION_EAST
;
615 else if (parse_contains("BottomRight", doc
, n
))
616 config_dock_floating
= FALSE
,
617 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
618 else if (parse_contains("Bottom", doc
, n
))
619 config_dock_floating
= FALSE
,
620 config_dock_pos
= OB_DIRECTION_SOUTH
;
621 else if (parse_contains("BottomLeft", doc
, n
))
622 config_dock_floating
= FALSE
,
623 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
624 else if (parse_contains("Left", doc
, n
))
625 config_dock_floating
= FALSE
,
626 config_dock_pos
= OB_DIRECTION_WEST
;
627 else if (parse_contains("Floating", doc
, n
))
628 config_dock_floating
= TRUE
;
630 if (config_dock_floating
) {
631 if ((n
= parse_find_node("floatingX", node
)))
632 config_dock_x
= parse_int(doc
, n
);
633 if ((n
= parse_find_node("floatingY", node
)))
634 config_dock_y
= parse_int(doc
, n
);
636 if ((n
= parse_find_node("noStrut", node
)))
637 config_dock_nostrut
= parse_bool(doc
, n
);
639 if ((n
= parse_find_node("stacking", node
))) {
640 if (parse_contains("above", doc
, n
))
641 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
642 else if (parse_contains("normal", doc
, n
))
643 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
644 else if (parse_contains("below", doc
, n
))
645 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
647 if ((n
= parse_find_node("direction", node
))) {
648 if (parse_contains("horizontal", doc
, n
))
649 config_dock_orient
= OB_ORIENTATION_HORZ
;
650 else if (parse_contains("vertical", doc
, n
))
651 config_dock_orient
= OB_ORIENTATION_VERT
;
653 if ((n
= parse_find_node("autoHide", node
)))
654 config_dock_hide
= parse_bool(doc
, n
);
655 if ((n
= parse_find_node("hideDelay", node
)))
656 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
657 if ((n
= parse_find_node("showDelay", node
)))
658 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
659 if ((n
= parse_find_node("moveButton", node
))) {
660 gchar
*str
= parse_string(doc
, n
);
662 if (translate_button(str
, &s
, &b
)) {
663 config_dock_app_move_button
= b
;
664 config_dock_app_move_modifiers
= s
;
666 g_message(_("Invalid button '%s' specified in config file"), str
);
672 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
676 for (node
= node
->children
; node
; node
= node
->next
) {
677 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
680 c
= parse_string(doc
, node
);
681 config_menu_files
= g_slist_append(config_menu_files
,
682 parse_expand_tilde(c
));
685 if ((n
= parse_find_node("hideDelay", node
)))
686 config_menu_hide_delay
= parse_int(doc
, n
);
687 if ((n
= parse_find_node("middle", node
)))
688 config_menu_middle
= parse_bool(doc
, n
);
689 if ((n
= parse_find_node("submenuShowDelay", node
)))
690 config_submenu_show_delay
= parse_int(doc
, n
);
691 if ((n
= parse_find_node("applicationIcons", node
)))
692 config_menu_client_list_icons
= parse_bool(doc
, n
);
696 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
701 node
= node
->children
;
702 if ((n
= parse_find_node("strength", node
)))
703 config_resist_win
= parse_int(doc
, n
);
704 if ((n
= parse_find_node("screen_edge_strength", node
)))
705 config_resist_edge
= parse_int(doc
, n
);
711 const gchar
*actname
;
714 static void bind_default_keyboard()
717 ObDefKeyBind binds
[] = {
718 { "A-Tab", "NextWindow" },
719 { "S-A-Tab", "PreviousWindow" },
724 for (it
= binds
; it
->key
; ++it
) {
725 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
726 keyboard_bind(l
, action_from_string(it
->actname
,
727 OB_USER_ACTION_KEYBOARD_KEY
));
734 const gchar
*context
;
735 const ObMouseAction mact
;
736 const gchar
*actname
;
739 static void bind_default_mouse()
742 ObDefMouseBind binds
[] = {
743 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
744 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
745 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
746 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
747 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
748 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
749 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
750 { "Left", "Bottom", OB_MOUSE_ACTION_PRESS
, "Focus" },
751 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
752 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
753 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
754 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
755 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
756 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
757 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
758 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
759 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
760 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
761 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
762 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
763 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
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
;
830 config_font_activewindow
= NULL
;
831 config_font_inactivewindow
= NULL
;
832 config_font_menuitem
= NULL
;
833 config_font_menutitle
= NULL
;
835 parse_register(i
, "theme", parse_theme
, NULL
);
837 config_desktops_num
= 4;
838 config_screen_firstdesk
= 1;
839 config_desktops_names
= NULL
;
841 parse_register(i
, "desktops", parse_desktops
, NULL
);
843 config_resize_redraw
= TRUE
;
844 config_resize_four_corners
= FALSE
;
845 config_resize_popup_show
= 1; /* nonpixel increments */
846 config_resize_popup_pos
= 0; /* center of client */
848 parse_register(i
, "resize", parse_resize
, NULL
);
850 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
851 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
852 config_dock_floating
= FALSE
;
853 config_dock_nostrut
= FALSE
;
856 config_dock_orient
= OB_ORIENTATION_VERT
;
857 config_dock_hide
= FALSE
;
858 config_dock_hide_delay
= 300;
859 config_dock_show_delay
= 300;
860 config_dock_app_move_button
= 2; /* middle */
861 config_dock_app_move_modifiers
= 0;
863 parse_register(i
, "dock", parse_dock
, NULL
);
865 translate_key("C-g", &config_keyboard_reset_state
,
866 &config_keyboard_reset_keycode
);
868 bind_default_keyboard();
870 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
872 config_mouse_threshold
= 3;
873 config_mouse_dclicktime
= 200;
875 bind_default_mouse();
877 parse_register(i
, "mouse", parse_mouse
, NULL
);
879 config_resist_win
= 10;
880 config_resist_edge
= 20;
882 parse_register(i
, "resistance", parse_resistance
, NULL
);
884 config_menu_hide_delay
= 250;
885 config_menu_middle
= FALSE
;
886 config_submenu_show_delay
= 0;
887 config_menu_client_list_icons
= TRUE
;
888 config_menu_files
= NULL
;
890 parse_register(i
, "menu", parse_menu
, NULL
);
892 config_per_app_settings
= NULL
;
894 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
897 void config_shutdown()
901 g_free(config_theme
);
903 g_free(config_title_layout
);
905 RrFontClose(config_font_activewindow
);
906 RrFontClose(config_font_inactivewindow
);
907 RrFontClose(config_font_menuitem
);
908 RrFontClose(config_font_menutitle
);
910 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
912 g_slist_free(config_desktops_names
);
914 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
916 g_slist_free(config_menu_files
);
918 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
919 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
925 g_slist_free(config_per_app_settings
);