1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 config.c for the Openbox window manager
4 Copyright (c) 2004 Mikael Magnusson
5 Copyright (c) 2003 Ben Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
24 #include "translate.h"
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 gint config_desktops_num
;
45 GSList
*config_desktops_names
;
46 gint config_screen_firstdesk
;
48 gboolean config_resize_redraw
;
49 gboolean config_resize_four_corners
;
50 gint config_resize_popup_show
;
51 gint config_resize_popup_pos
;
53 ObStackingLayer config_dock_layer
;
54 gboolean config_dock_floating
;
55 gboolean config_dock_nostrut
;
56 ObDirection config_dock_pos
;
59 ObOrientation config_dock_orient
;
60 gboolean config_dock_hide
;
61 guint config_dock_hide_delay
;
62 guint config_dock_show_delay
;
63 guint config_dock_app_move_button
;
64 guint config_dock_app_move_modifiers
;
66 guint config_keyboard_reset_keycode
;
67 guint config_keyboard_reset_state
;
69 gint config_mouse_threshold
;
70 gint config_mouse_dclicktime
;
72 gboolean config_menu_warppointer
;
73 gboolean config_menu_xorstyle
;
74 guint config_menu_hide_delay
;
75 gboolean config_menu_middle
;
76 guint config_submenu_show_delay
;
77 gboolean config_menu_client_list_icons
;
79 GSList
*config_menu_files
;
81 gint config_resist_win
;
82 gint config_resist_edge
;
83 gboolean config_resist_layers_below
;
85 GSList
*config_per_app_settings
;
89 <application name="aterm">
92 <application name="Rhythmbox">
103 /* Manages settings for individual applications.
104 Some notes: head is the screen number in a multi monitor
105 (Xinerama) setup (starting from 0) or mouse, meaning the
106 head the pointer is on. Default: mouse.
107 Layer can be three values, above (Always on top), below
108 (Always on bottom) and everything else (normal behaviour).
109 Positions can be an integer value or center, which will
110 center the window in the specified axis. Position is relative
111 from head, so <position><x>center</x></position><head>1</head>
112 will center the window on the second head.
114 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
115 xmlNodePtr node
, gpointer d
)
117 xmlNodePtr app
= parse_find_node("application", node
->children
);
119 gboolean name_set
, class_set
;
120 gboolean x_pos_given
;
123 name_set
= class_set
= x_pos_given
= FALSE
;
125 class_set
= parse_attr_string("class", app
, &class);
126 name_set
= parse_attr_string("name", app
, &name
);
127 if (class_set
|| name_set
) {
129 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
132 settings
->name
= name
;
134 settings
->name
= NULL
;
136 settings
->class = class;
138 settings
->class = NULL
;
140 if (!parse_attr_string("role", app
, &settings
->role
))
141 settings
->role
= NULL
;
143 settings
->decor
= -1;
144 if ((n
= parse_find_node("decor", app
->children
)))
145 settings
->decor
= parse_bool(doc
, n
);
147 settings
->shade
= -1;
148 if ((n
= parse_find_node("shade", app
->children
)))
149 settings
->shade
= parse_bool(doc
, n
);
151 settings
->position
.x
= settings
->position
.y
= 0;
152 settings
->pos_given
= FALSE
;
153 if ((n
= parse_find_node("position", app
->children
))) {
154 if ((c
= parse_find_node("x", n
->children
))) {
155 gchar
*s
= parse_string(doc
, c
);
156 if (!strcmp(s
, "center")) {
157 settings
->center_x
= TRUE
;
160 settings
->position
.x
= parse_int(doc
, c
);
166 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
))) {
167 gchar
*s
= parse_string(doc
, c
);
168 if (!strcmp(s
, "center")) {
169 settings
->center_y
= TRUE
;
170 settings
->pos_given
= TRUE
;
172 settings
->position
.y
= parse_int(doc
, c
);
173 settings
->pos_given
= TRUE
;
179 settings
->focus
= -1;
180 if ((n
= parse_find_node("focus", app
->children
)))
181 settings
->focus
= parse_bool(doc
, n
);
183 if ((n
= parse_find_node("desktop", app
->children
))) {
184 gchar
*s
= parse_string(doc
, n
);
185 if (!strcmp(s
, "all"))
186 settings
->desktop
= DESKTOP_ALL
;
188 settings
->desktop
= parse_int(doc
, n
);
191 settings
->desktop
= DESKTOP_ALL
- 1; /* lets hope the user
195 if ((n
= parse_find_node("head", app
->children
))) {
196 gchar
*s
= parse_string(doc
, n
);
197 if (!strcmp(s
, "mouse"))
200 settings
->head
= parse_int(doc
, n
);
204 settings
->layer
= -2;
205 if ((n
= parse_find_node("layer", app
->children
))) {
206 gchar
*s
= parse_string(doc
, n
);
207 if (!strcmp(s
, "above"))
209 else if (!strcmp(s
, "below"))
210 settings
->layer
= -1;
216 settings
->iconic
= -1;
217 if ((n
= parse_find_node("iconic", app
->children
)))
218 settings
->iconic
= parse_bool(doc
, n
);
220 settings
->skip_pager
= -1;
221 if ((n
= parse_find_node("skip_pager", app
->children
)))
222 settings
->skip_pager
= parse_bool(doc
, n
);
224 settings
->skip_taskbar
= -1;
225 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
226 settings
->skip_taskbar
= parse_bool(doc
, n
);
228 settings
->fullscreen
= -1;
229 if ((n
= parse_find_node("fullscreen", app
->children
)))
230 settings
->fullscreen
= parse_bool(doc
, n
);
232 settings
->max_horz
= -1;
233 settings
->max_vert
= -1;
234 if ((n
= parse_find_node("maximized", app
->children
))) {
235 gchar
*s
= parse_string(doc
, n
);
236 if (!strcmp(s
, "horizontal")) {
237 settings
->max_horz
= TRUE
;
238 settings
->max_vert
= FALSE
;
239 } else if (!strcmp(s
, "vertical")) {
240 settings
->max_horz
= FALSE
;
241 settings
->max_vert
= TRUE
;
243 settings
->max_horz
= settings
->max_vert
=
248 config_per_app_settings
= g_slist_append(config_per_app_settings
,
249 (gpointer
) settings
);
252 app
= parse_find_node("application", app
->next
);
259 <action name="ChangeDesktop">
266 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
274 if ((n
= parse_find_node("chainQuitKey", node
))) {
275 key
= parse_string(doc
, n
);
276 translate_key(key
, &config_keyboard_reset_state
,
277 &config_keyboard_reset_keycode
);
281 n
= parse_find_node("keybind", node
);
283 if (parse_attr_string("key", n
, &key
)) {
284 keylist
= g_list_append(keylist
, key
);
286 parse_key(i
, doc
, n
->children
, keylist
);
288 it
= g_list_last(keylist
);
290 keylist
= g_list_delete_link(keylist
, it
);
292 n
= parse_find_node("keybind", n
->next
);
295 nact
= parse_find_node("action", node
);
297 if ((action
= action_parse(i
, doc
, nact
,
298 OB_USER_ACTION_KEYBOARD_KEY
)))
299 keyboard_bind(keylist
, action
);
300 nact
= parse_find_node("action", nact
->next
);
305 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
308 keyboard_unbind_all();
310 parse_key(i
, doc
, node
->children
, NULL
);
315 <context name="Titlebar">
316 <mousebind button="Left" action="Press">
317 <action name="Raise"></action>
323 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
326 xmlNodePtr n
, nbut
, nact
;
335 node
= node
->children
;
337 if ((n
= parse_find_node("dragThreshold", node
)))
338 config_mouse_threshold
= parse_int(doc
, n
);
339 if ((n
= parse_find_node("doubleClickTime", node
)))
340 config_mouse_dclicktime
= parse_int(doc
, n
);
342 n
= parse_find_node("context", node
);
344 if (!parse_attr_string("name", n
, &contextstr
))
346 nbut
= parse_find_node("mousebind", n
->children
);
348 if (!parse_attr_string("button", nbut
, &buttonstr
))
350 if (parse_attr_contains("press", nbut
, "action")) {
351 uact
= OB_USER_ACTION_MOUSE_PRESS
;
352 mact
= OB_MOUSE_ACTION_PRESS
;
353 } else if (parse_attr_contains("release", nbut
, "action")) {
354 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
355 mact
= OB_MOUSE_ACTION_RELEASE
;
356 } else if (parse_attr_contains("click", nbut
, "action")) {
357 uact
= OB_USER_ACTION_MOUSE_CLICK
;
358 mact
= OB_MOUSE_ACTION_CLICK
;
359 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
360 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
361 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
362 } else if (parse_attr_contains("drag", nbut
, "action")) {
363 uact
= OB_USER_ACTION_MOUSE_MOTION
;
364 mact
= OB_MOUSE_ACTION_MOTION
;
367 nact
= parse_find_node("action", nbut
->children
);
369 if ((action
= action_parse(i
, doc
, nact
, uact
)))
370 mouse_bind(buttonstr
, contextstr
, mact
, action
);
371 nact
= parse_find_node("action", nact
->next
);
375 nbut
= parse_find_node("mousebind", nbut
->next
);
379 n
= parse_find_node("context", n
->next
);
383 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
388 node
= node
->children
;
390 if ((n
= parse_find_node("focusNew", node
)))
391 config_focus_new
= parse_bool(doc
, n
);
392 if ((n
= parse_find_node("followMouse", node
)))
393 config_focus_follow
= parse_bool(doc
, n
);
394 if ((n
= parse_find_node("focusDelay", node
)))
395 config_focus_delay
= parse_int(doc
, n
) * 1000;
396 if ((n
= parse_find_node("raiseOnFocus", node
)))
397 config_focus_raise
= parse_bool(doc
, n
);
398 if ((n
= parse_find_node("focusLast", node
)))
399 config_focus_last
= parse_bool(doc
, n
);
402 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
407 node
= node
->children
;
409 if ((n
= parse_find_node("policy", node
)))
410 if (parse_contains("UnderMouse", doc
, n
))
411 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
414 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
419 node
= node
->children
;
421 if ((n
= parse_find_node("name", node
))) {
424 g_free(config_theme
);
425 c
= parse_string(doc
, n
);
426 config_theme
= parse_expand_tilde(c
);
429 if ((n
= parse_find_node("titleLayout", node
))) {
430 g_free(config_title_layout
);
431 config_title_layout
= parse_string(doc
, n
);
433 if ((n
= parse_find_node("keepBorder", node
)))
434 config_theme_keepborder
= parse_bool(doc
, n
);
435 if ((n
= parse_find_node("hideDisabled", node
)))
436 config_theme_hidedisabled
= parse_bool(doc
, n
);
439 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
444 node
= node
->children
;
446 if ((n
= parse_find_node("number", node
))) {
447 gint d
= parse_int(doc
, n
);
449 config_desktops_num
= d
;
451 if ((n
= parse_find_node("firstdesk", node
))) {
452 gint d
= parse_int(doc
, n
);
454 config_screen_firstdesk
= d
;
456 if ((n
= parse_find_node("names", node
))) {
460 for (it
= config_desktops_names
; it
; it
= it
->next
)
462 g_slist_free(config_desktops_names
);
463 config_desktops_names
= NULL
;
465 nname
= parse_find_node("name", n
->children
);
467 config_desktops_names
= g_slist_append(config_desktops_names
,
468 parse_string(doc
, nname
));
469 nname
= parse_find_node("name", nname
->next
);
474 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
479 node
= node
->children
;
481 if ((n
= parse_find_node("drawContents", node
)))
482 config_resize_redraw
= parse_bool(doc
, n
);
483 if ((n
= parse_find_node("fourCorner", node
)))
484 config_resize_four_corners
= parse_bool(doc
, n
);
485 if ((n
= parse_find_node("popupShow", node
))) {
486 config_resize_popup_show
= parse_int(doc
, n
);
487 if (parse_contains("Always", doc
, n
))
488 config_resize_popup_show
= 2;
489 else if (parse_contains("Never", doc
, n
))
490 config_resize_popup_show
= 0;
491 else if (parse_contains("Nonpixel", doc
, n
))
492 config_resize_popup_show
= 1;
494 if ((n
= parse_find_node("popupPosition", node
))) {
495 config_resize_popup_pos
= parse_int(doc
, n
);
496 if (parse_contains("Top", doc
, n
))
497 config_resize_popup_pos
= 1;
498 else if (parse_contains("Center", doc
, n
))
499 config_resize_popup_pos
= 0;
503 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
508 node
= node
->children
;
510 if ((n
= parse_find_node("position", node
))) {
511 if (parse_contains("TopLeft", doc
, n
))
512 config_dock_floating
= FALSE
,
513 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
514 else if (parse_contains("Top", doc
, n
))
515 config_dock_floating
= FALSE
,
516 config_dock_pos
= OB_DIRECTION_NORTH
;
517 else if (parse_contains("TopRight", doc
, n
))
518 config_dock_floating
= FALSE
,
519 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
520 else if (parse_contains("Right", doc
, n
))
521 config_dock_floating
= FALSE
,
522 config_dock_pos
= OB_DIRECTION_EAST
;
523 else if (parse_contains("BottomRight", doc
, n
))
524 config_dock_floating
= FALSE
,
525 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
526 else if (parse_contains("Bottom", doc
, n
))
527 config_dock_floating
= FALSE
,
528 config_dock_pos
= OB_DIRECTION_SOUTH
;
529 else if (parse_contains("BottomLeft", doc
, n
))
530 config_dock_floating
= FALSE
,
531 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
532 else if (parse_contains("Left", doc
, n
))
533 config_dock_floating
= FALSE
,
534 config_dock_pos
= OB_DIRECTION_WEST
;
535 else if (parse_contains("Floating", doc
, n
))
536 config_dock_floating
= TRUE
;
538 if (config_dock_floating
) {
539 if ((n
= parse_find_node("floatingX", node
)))
540 config_dock_x
= parse_int(doc
, n
);
541 if ((n
= parse_find_node("floatingY", node
)))
542 config_dock_y
= parse_int(doc
, n
);
544 if ((n
= parse_find_node("noStrut", node
)))
545 config_dock_nostrut
= parse_bool(doc
, n
);
547 if ((n
= parse_find_node("stacking", node
))) {
548 if (parse_contains("top", doc
, n
))
549 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
550 else if (parse_contains("normal", doc
, n
))
551 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
552 else if (parse_contains("bottom", doc
, n
))
553 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
555 if ((n
= parse_find_node("direction", node
))) {
556 if (parse_contains("horizontal", doc
, n
))
557 config_dock_orient
= OB_ORIENTATION_HORZ
;
558 else if (parse_contains("vertical", doc
, n
))
559 config_dock_orient
= OB_ORIENTATION_VERT
;
561 if ((n
= parse_find_node("autoHide", node
)))
562 config_dock_hide
= parse_bool(doc
, n
);
563 if ((n
= parse_find_node("hideDelay", node
)))
564 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
565 if ((n
= parse_find_node("showDelay", node
)))
566 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
567 if ((n
= parse_find_node("moveButton", node
))) {
568 gchar
*str
= parse_string(doc
, n
);
570 if (translate_button(str
, &s
, &b
)) {
571 config_dock_app_move_button
= b
;
572 config_dock_app_move_modifiers
= s
;
574 g_warning("invalid button '%s'", str
);
580 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
584 for (node
= node
->children
; node
; node
= node
->next
) {
585 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
588 c
= parse_string(doc
, node
);
589 config_menu_files
= g_slist_append(config_menu_files
,
590 parse_expand_tilde(c
));
593 if ((n
= parse_find_node("warpPointer", node
)))
594 config_menu_warppointer
= parse_bool(doc
, n
);
595 if ((n
= parse_find_node("xorStyle", node
)))
596 config_menu_xorstyle
= parse_bool(doc
, n
);
597 if ((n
= parse_find_node("hideDelay", node
)))
598 config_menu_hide_delay
= parse_int(doc
, n
);
599 if ((n
= parse_find_node("middle", node
)))
600 config_menu_middle
= parse_bool(doc
, n
);
601 if ((n
= parse_find_node("submenuShowDelay", node
)))
602 config_submenu_show_delay
= parse_int(doc
, n
);
603 if ((n
= parse_find_node("desktopMenuIcons", node
)))
604 config_menu_client_list_icons
= parse_bool(doc
, n
);
608 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
613 node
= node
->children
;
614 if ((n
= parse_find_node("strength", node
)))
615 config_resist_win
= parse_int(doc
, n
);
616 if ((n
= parse_find_node("screen_edge_strength", node
)))
617 config_resist_edge
= parse_int(doc
, n
);
618 if ((n
= parse_find_node("edges_hit_layers_below", node
)))
619 config_resist_layers_below
= parse_bool(doc
, n
);
625 const gchar
*actname
;
628 static void bind_default_keyboard()
631 ObDefKeyBind binds
[] = {
632 { "A-Tab", "NextWindow" },
633 { "S-A-Tab", "PreviousWindow" },
638 for (it
= binds
; it
->key
; ++it
) {
639 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
640 keyboard_bind(l
, action_from_string(it
->actname
,
641 OB_USER_ACTION_KEYBOARD_KEY
));
648 const gchar
*context
;
649 const ObMouseAction mact
;
650 const gchar
*actname
;
653 static void bind_default_mouse()
656 ObDefMouseBind binds
[] = {
657 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
658 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
659 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
660 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
661 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
662 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
663 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
664 { "Left", "Handle", OB_MOUSE_ACTION_PRESS
, "Focus" },
665 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
666 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
667 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
668 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
669 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
670 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
671 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
672 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
673 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
674 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
675 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
676 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
677 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
678 { "Left", "Handle", OB_MOUSE_ACTION_CLICK
, "Raise" },
679 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
680 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
681 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
682 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
683 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Raise" },
684 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "Raise" },
685 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Raise" },
686 { "Left", "Icon", OB_MOUSE_ACTION_CLICK
, "Raise" },
687 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "Raise" },
688 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "Raise" },
689 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Close" },
690 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "ToggleMaximizeFull" },
691 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Iconify" },
692 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "ToggleOmnipresent" },
693 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "ToggleShade" },
694 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
695 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
696 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
697 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
698 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION
, "Move" },
699 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION
, "Move" },
700 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION
, "Resize" },
701 { NULL
, NULL
, 0, NULL
}
704 for (it
= binds
; it
->button
; ++it
) {
707 case OB_MOUSE_ACTION_PRESS
:
708 uact
= OB_USER_ACTION_MOUSE_PRESS
; break;
709 case OB_MOUSE_ACTION_RELEASE
:
710 uact
= OB_USER_ACTION_MOUSE_RELEASE
; break;
711 case OB_MOUSE_ACTION_CLICK
:
712 uact
= OB_USER_ACTION_MOUSE_CLICK
; break;
713 case OB_MOUSE_ACTION_DOUBLE_CLICK
:
714 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
; break;
715 case OB_MOUSE_ACTION_MOTION
:
716 uact
= OB_USER_ACTION_MOUSE_MOTION
; break;
717 case OB_NUM_MOUSE_ACTIONS
:
718 g_assert_not_reached();
720 mouse_bind(it
->button
, it
->context
, it
->mact
,
721 action_from_string(it
->actname
, uact
));
725 void config_startup(ObParseInst
*i
)
727 config_focus_new
= TRUE
;
728 config_focus_follow
= FALSE
;
729 config_focus_delay
= 0;
730 config_focus_raise
= FALSE
;
731 config_focus_last
= FALSE
;
733 parse_register(i
, "focus", parse_focus
, NULL
);
735 config_place_policy
= OB_PLACE_POLICY_SMART
;
737 parse_register(i
, "placement", parse_placement
, NULL
);
741 config_title_layout
= g_strdup("NLIMC");
742 config_theme_keepborder
= TRUE
;
743 config_theme_hidedisabled
= FALSE
;
745 parse_register(i
, "theme", parse_theme
, NULL
);
747 config_desktops_num
= 4;
748 config_screen_firstdesk
= 1;
749 config_desktops_names
= NULL
;
751 parse_register(i
, "desktops", parse_desktops
, NULL
);
753 config_resize_redraw
= TRUE
;
754 config_resize_four_corners
= FALSE
;
755 config_resize_popup_show
= 1; /* nonpixel increments */
756 config_resize_popup_pos
= 0; /* center of client */
758 parse_register(i
, "resize", parse_resize
, NULL
);
760 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
761 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
762 config_dock_floating
= FALSE
;
763 config_dock_nostrut
= FALSE
;
766 config_dock_orient
= OB_ORIENTATION_VERT
;
767 config_dock_hide
= FALSE
;
768 config_dock_hide_delay
= 300;
769 config_dock_show_delay
= 300;
770 config_dock_app_move_button
= 2; /* middle */
771 config_dock_app_move_modifiers
= 0;
773 parse_register(i
, "dock", parse_dock
, NULL
);
775 translate_key("C-g", &config_keyboard_reset_state
,
776 &config_keyboard_reset_keycode
);
778 bind_default_keyboard();
780 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
782 config_mouse_threshold
= 3;
783 config_mouse_dclicktime
= 200;
785 bind_default_mouse();
787 parse_register(i
, "mouse", parse_mouse
, NULL
);
789 config_resist_win
= 10;
790 config_resist_edge
= 20;
791 config_resist_layers_below
= FALSE
;
793 parse_register(i
, "resistance", parse_resistance
, NULL
);
795 config_menu_warppointer
= TRUE
;
796 config_menu_xorstyle
= TRUE
;
797 config_menu_hide_delay
= 250;
798 config_menu_middle
= TRUE
;
799 config_submenu_show_delay
= 0;
800 config_menu_client_list_icons
= TRUE
;
801 config_menu_files
= NULL
;
803 parse_register(i
, "menu", parse_menu
, NULL
);
805 config_per_app_settings
= NULL
;
807 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
810 void config_shutdown()
814 g_free(config_theme
);
816 g_free(config_title_layout
);
818 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
820 g_slist_free(config_desktops_names
);
822 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
824 g_slist_free(config_menu_files
);
826 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
827 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
833 g_slist_free(config_per_app_settings
);