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
;
43 gboolean config_title_number
;
45 gint config_desktops_num
;
46 GSList
*config_desktops_names
;
47 gint config_screen_firstdesk
;
49 gboolean config_resize_redraw
;
50 gboolean config_resize_four_corners
;
51 gint config_resize_popup_show
;
52 gint config_resize_popup_pos
;
54 ObStackingLayer config_dock_layer
;
55 gboolean config_dock_floating
;
56 gboolean config_dock_nostrut
;
57 ObDirection config_dock_pos
;
60 ObOrientation config_dock_orient
;
61 gboolean config_dock_hide
;
62 guint config_dock_hide_delay
;
63 guint config_dock_show_delay
;
64 guint config_dock_app_move_button
;
65 guint config_dock_app_move_modifiers
;
67 guint config_keyboard_reset_keycode
;
68 guint config_keyboard_reset_state
;
70 gint config_mouse_threshold
;
71 gint config_mouse_dclicktime
;
73 gboolean config_menu_warppointer
;
74 gboolean config_menu_xorstyle
;
75 guint config_menu_hide_delay
;
76 gboolean config_menu_middle
;
77 guint config_submenu_show_delay
;
78 gboolean config_menu_client_list_icons
;
80 GSList
*config_menu_files
;
82 gint config_resist_win
;
83 gint config_resist_edge
;
84 gboolean config_resist_layers_below
;
86 GSList
*config_per_app_settings
;
90 <application name="aterm">
93 <application name="Rhythmbox">
104 /* Manages settings for individual applications.
105 Some notes: head is the screen number in a multi monitor
106 (Xinerama) setup (starting from 0) or mouse, meaning the
107 head the pointer is on. Default: mouse.
108 Layer can be three values, above (Always on top), below
109 (Always on bottom) and everything else (normal behaviour).
110 Positions can be an integer value or center, which will
111 center the window in the specified axis. Position is relative
112 from head, so <position><x>center</x></position><head>1</head>
113 will center the window on the second head.
115 static void parse_per_app_settings(ObParseInst
*i
, xmlDocPtr doc
,
116 xmlNodePtr node
, gpointer d
)
118 xmlNodePtr app
= parse_find_node("application", node
->children
);
120 gboolean name_set
, class_set
;
121 gboolean x_pos_given
;
124 name_set
= class_set
= x_pos_given
= FALSE
;
126 class_set
= parse_attr_string("class", app
, &class);
127 name_set
= parse_attr_string("name", app
, &name
);
128 if (class_set
|| name_set
) {
130 ObAppSettings
*settings
= g_new0(ObAppSettings
, 1);
133 settings
->name
= name
;
135 settings
->name
= NULL
;
138 settings
->class = class;
140 settings
->class = NULL
;
142 if (!parse_attr_string("role", app
, &settings
->role
))
143 settings
->role
= NULL
;
145 settings
->decor
= -1;
146 if ((n
= parse_find_node("decor", app
->children
)))
147 settings
->decor
= parse_bool(doc
, n
);
149 settings
->shade
= -1;
150 if ((n
= parse_find_node("shade", app
->children
)))
151 settings
->shade
= parse_bool(doc
, n
);
153 settings
->position
.x
= settings
->position
.y
= 0;
154 settings
->pos_given
= FALSE
;
155 if ((n
= parse_find_node("position", app
->children
))) {
156 if ((c
= parse_find_node("x", n
->children
))) {
157 gchar
*s
= parse_string(doc
, c
);
158 if (!strcmp(s
, "center")) {
159 settings
->center_x
= TRUE
;
162 settings
->position
.x
= parse_int(doc
, c
);
168 if (x_pos_given
&& (c
= parse_find_node("y", n
->children
))) {
169 gchar
*s
= parse_string(doc
, c
);
170 if (!strcmp(s
, "center")) {
171 settings
->center_y
= TRUE
;
172 settings
->pos_given
= TRUE
;
174 settings
->position
.y
= parse_int(doc
, c
);
175 settings
->pos_given
= TRUE
;
181 settings
->focus
= -1;
182 if ((n
= parse_find_node("focus", app
->children
)))
183 settings
->focus
= parse_bool(doc
, n
);
185 if ((n
= parse_find_node("desktop", app
->children
))) {
186 gchar
*s
= parse_string(doc
, n
);
187 if (!strcmp(s
, "all"))
188 settings
->desktop
= DESKTOP_ALL
;
190 settings
->desktop
= parse_int(doc
, n
);
193 settings
->desktop
= DESKTOP_ALL
- 1; /* lets hope the user
197 if ((n
= parse_find_node("head", app
->children
))) {
198 gchar
*s
= parse_string(doc
, n
);
199 if (!strcmp(s
, "mouse"))
202 settings
->head
= parse_int(doc
, n
);
206 settings
->layer
= -2;
207 if ((n
= parse_find_node("layer", app
->children
))) {
208 gchar
*s
= parse_string(doc
, n
);
209 if (!strcmp(s
, "above"))
211 else if (!strcmp(s
, "below"))
212 settings
->layer
= -1;
218 settings
->iconic
= -1;
219 if ((n
= parse_find_node("iconic", app
->children
)))
220 settings
->iconic
= parse_bool(doc
, n
);
222 settings
->skip_pager
= -1;
223 if ((n
= parse_find_node("skip_pager", app
->children
)))
224 settings
->skip_pager
= parse_bool(doc
, n
);
226 settings
->skip_taskbar
= -1;
227 if ((n
= parse_find_node("skip_taskbar", app
->children
)))
228 settings
->skip_taskbar
= parse_bool(doc
, n
);
230 settings
->fullscreen
= -1;
231 if ((n
= parse_find_node("fullscreen", app
->children
)))
232 settings
->fullscreen
= parse_bool(doc
, n
);
234 settings
->max_horz
= -1;
235 settings
->max_vert
= -1;
236 if ((n
= parse_find_node("maximized", app
->children
))) {
237 gchar
*s
= parse_string(doc
, n
);
238 if (!strcmp(s
, "horizontal")) {
239 settings
->max_horz
= TRUE
;
240 settings
->max_vert
= FALSE
;
241 } else if (!strcmp(s
, "vertical")) {
242 settings
->max_horz
= FALSE
;
243 settings
->max_vert
= TRUE
;
245 settings
->max_horz
= settings
->max_vert
=
250 config_per_app_settings
= g_slist_append(config_per_app_settings
,
251 (gpointer
) settings
);
254 app
= parse_find_node("application", app
->next
);
261 <action name="ChangeDesktop">
268 static void parse_key(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
276 if ((n
= parse_find_node("chainQuitKey", node
))) {
277 key
= parse_string(doc
, n
);
278 translate_key(key
, &config_keyboard_reset_state
,
279 &config_keyboard_reset_keycode
);
283 n
= parse_find_node("keybind", node
);
285 if (parse_attr_string("key", n
, &key
)) {
286 keylist
= g_list_append(keylist
, key
);
288 parse_key(i
, doc
, n
->children
, keylist
);
290 it
= g_list_last(keylist
);
292 keylist
= g_list_delete_link(keylist
, it
);
294 n
= parse_find_node("keybind", n
->next
);
297 nact
= parse_find_node("action", node
);
299 if ((action
= action_parse(i
, doc
, nact
,
300 OB_USER_ACTION_KEYBOARD_KEY
)))
301 keyboard_bind(keylist
, action
);
302 nact
= parse_find_node("action", nact
->next
);
307 static void parse_keyboard(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
310 keyboard_unbind_all();
312 parse_key(i
, doc
, node
->children
, NULL
);
317 <context name="Titlebar">
318 <mousebind button="Left" action="Press">
319 <action name="Raise"></action>
325 static void parse_mouse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
328 xmlNodePtr n
, nbut
, nact
;
337 node
= node
->children
;
339 if ((n
= parse_find_node("dragThreshold", node
)))
340 config_mouse_threshold
= parse_int(doc
, n
);
341 if ((n
= parse_find_node("doubleClickTime", node
)))
342 config_mouse_dclicktime
= parse_int(doc
, n
);
344 n
= parse_find_node("context", node
);
346 if (!parse_attr_string("name", n
, &contextstr
))
348 nbut
= parse_find_node("mousebind", n
->children
);
350 if (!parse_attr_string("button", nbut
, &buttonstr
))
352 if (parse_attr_contains("press", nbut
, "action")) {
353 uact
= OB_USER_ACTION_MOUSE_PRESS
;
354 mact
= OB_MOUSE_ACTION_PRESS
;
355 } else if (parse_attr_contains("release", nbut
, "action")) {
356 uact
= OB_USER_ACTION_MOUSE_RELEASE
;
357 mact
= OB_MOUSE_ACTION_RELEASE
;
358 } else if (parse_attr_contains("click", nbut
, "action")) {
359 uact
= OB_USER_ACTION_MOUSE_CLICK
;
360 mact
= OB_MOUSE_ACTION_CLICK
;
361 } else if (parse_attr_contains("doubleclick", nbut
,"action")) {
362 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
;
363 mact
= OB_MOUSE_ACTION_DOUBLE_CLICK
;
364 } else if (parse_attr_contains("drag", nbut
, "action")) {
365 uact
= OB_USER_ACTION_MOUSE_MOTION
;
366 mact
= OB_MOUSE_ACTION_MOTION
;
369 nact
= parse_find_node("action", nbut
->children
);
371 if ((action
= action_parse(i
, doc
, nact
, uact
)))
372 mouse_bind(buttonstr
, contextstr
, mact
, action
);
373 nact
= parse_find_node("action", nact
->next
);
377 nbut
= parse_find_node("mousebind", nbut
->next
);
381 n
= parse_find_node("context", n
->next
);
385 static void parse_focus(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
390 node
= node
->children
;
392 if ((n
= parse_find_node("focusNew", node
)))
393 config_focus_new
= parse_bool(doc
, n
);
394 if ((n
= parse_find_node("followMouse", node
)))
395 config_focus_follow
= parse_bool(doc
, n
);
396 if ((n
= parse_find_node("focusDelay", node
)))
397 config_focus_delay
= parse_int(doc
, n
) * 1000;
398 if ((n
= parse_find_node("raiseOnFocus", node
)))
399 config_focus_raise
= parse_bool(doc
, n
);
400 if ((n
= parse_find_node("focusLast", node
)))
401 config_focus_last
= parse_bool(doc
, n
);
404 static void parse_placement(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
409 node
= node
->children
;
411 if ((n
= parse_find_node("policy", node
)))
412 if (parse_contains("UnderMouse", doc
, n
))
413 config_place_policy
= OB_PLACE_POLICY_MOUSE
;
416 static void parse_theme(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
421 node
= node
->children
;
423 if ((n
= parse_find_node("name", node
))) {
426 g_free(config_theme
);
427 c
= parse_string(doc
, n
);
428 config_theme
= parse_expand_tilde(c
);
431 if ((n
= parse_find_node("titleLayout", node
))) {
432 g_free(config_title_layout
);
433 config_title_layout
= parse_string(doc
, n
);
435 if ((n
= parse_find_node("titleNumber", node
)))
436 config_title_number
= parse_bool(doc
, n
);
437 if ((n
= parse_find_node("keepBorder", node
)))
438 config_theme_keepborder
= parse_bool(doc
, n
);
439 if ((n
= parse_find_node("hideDisabled", node
)))
440 config_theme_hidedisabled
= parse_bool(doc
, n
);
443 static void parse_desktops(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
448 node
= node
->children
;
450 if ((n
= parse_find_node("number", node
))) {
451 gint d
= parse_int(doc
, n
);
453 config_desktops_num
= d
;
455 if ((n
= parse_find_node("firstdesk", node
))) {
456 gint d
= parse_int(doc
, n
);
458 config_screen_firstdesk
= d
;
460 if ((n
= parse_find_node("names", node
))) {
464 for (it
= config_desktops_names
; it
; it
= it
->next
)
466 g_slist_free(config_desktops_names
);
467 config_desktops_names
= NULL
;
469 nname
= parse_find_node("name", n
->children
);
471 config_desktops_names
= g_slist_append(config_desktops_names
,
472 parse_string(doc
, nname
));
473 nname
= parse_find_node("name", nname
->next
);
478 static void parse_resize(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
483 node
= node
->children
;
485 if ((n
= parse_find_node("drawContents", node
)))
486 config_resize_redraw
= parse_bool(doc
, n
);
487 if ((n
= parse_find_node("fourCorner", node
)))
488 config_resize_four_corners
= parse_bool(doc
, n
);
489 if ((n
= parse_find_node("popupShow", node
))) {
490 config_resize_popup_show
= parse_int(doc
, n
);
491 if (parse_contains("Always", doc
, n
))
492 config_resize_popup_show
= 2;
493 else if (parse_contains("Never", doc
, n
))
494 config_resize_popup_show
= 0;
495 else if (parse_contains("Nonpixel", doc
, n
))
496 config_resize_popup_show
= 1;
498 if ((n
= parse_find_node("popupPosition", node
))) {
499 config_resize_popup_pos
= parse_int(doc
, n
);
500 if (parse_contains("Top", doc
, n
))
501 config_resize_popup_pos
= 1;
502 else if (parse_contains("Center", doc
, n
))
503 config_resize_popup_pos
= 0;
507 static void parse_dock(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
512 node
= node
->children
;
514 if ((n
= parse_find_node("position", node
))) {
515 if (parse_contains("TopLeft", doc
, n
))
516 config_dock_floating
= FALSE
,
517 config_dock_pos
= OB_DIRECTION_NORTHWEST
;
518 else if (parse_contains("Top", doc
, n
))
519 config_dock_floating
= FALSE
,
520 config_dock_pos
= OB_DIRECTION_NORTH
;
521 else if (parse_contains("TopRight", doc
, n
))
522 config_dock_floating
= FALSE
,
523 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
524 else if (parse_contains("Right", doc
, n
))
525 config_dock_floating
= FALSE
,
526 config_dock_pos
= OB_DIRECTION_EAST
;
527 else if (parse_contains("BottomRight", doc
, n
))
528 config_dock_floating
= FALSE
,
529 config_dock_pos
= OB_DIRECTION_SOUTHEAST
;
530 else if (parse_contains("Bottom", doc
, n
))
531 config_dock_floating
= FALSE
,
532 config_dock_pos
= OB_DIRECTION_SOUTH
;
533 else if (parse_contains("BottomLeft", doc
, n
))
534 config_dock_floating
= FALSE
,
535 config_dock_pos
= OB_DIRECTION_SOUTHWEST
;
536 else if (parse_contains("Left", doc
, n
))
537 config_dock_floating
= FALSE
,
538 config_dock_pos
= OB_DIRECTION_WEST
;
539 else if (parse_contains("Floating", doc
, n
))
540 config_dock_floating
= TRUE
;
542 if (config_dock_floating
) {
543 if ((n
= parse_find_node("floatingX", node
)))
544 config_dock_x
= parse_int(doc
, n
);
545 if ((n
= parse_find_node("floatingY", node
)))
546 config_dock_y
= parse_int(doc
, n
);
548 if ((n
= parse_find_node("noStrut", node
)))
549 config_dock_nostrut
= parse_bool(doc
, n
);
551 if ((n
= parse_find_node("stacking", node
))) {
552 if (parse_contains("top", doc
, n
))
553 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
554 else if (parse_contains("normal", doc
, n
))
555 config_dock_layer
= OB_STACKING_LAYER_NORMAL
;
556 else if (parse_contains("bottom", doc
, n
))
557 config_dock_layer
= OB_STACKING_LAYER_BELOW
;
559 if ((n
= parse_find_node("direction", node
))) {
560 if (parse_contains("horizontal", doc
, n
))
561 config_dock_orient
= OB_ORIENTATION_HORZ
;
562 else if (parse_contains("vertical", doc
, n
))
563 config_dock_orient
= OB_ORIENTATION_VERT
;
565 if ((n
= parse_find_node("autoHide", node
)))
566 config_dock_hide
= parse_bool(doc
, n
);
567 if ((n
= parse_find_node("hideDelay", node
)))
568 config_dock_hide_delay
= parse_int(doc
, n
) * 1000;
569 if ((n
= parse_find_node("showDelay", node
)))
570 config_dock_show_delay
= parse_int(doc
, n
) * 1000;
571 if ((n
= parse_find_node("moveButton", node
))) {
572 gchar
*str
= parse_string(doc
, n
);
574 if (translate_button(str
, &s
, &b
)) {
575 config_dock_app_move_button
= b
;
576 config_dock_app_move_modifiers
= s
;
578 g_warning("invalid button '%s'", str
);
584 static void parse_menu(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
588 for (node
= node
->children
; node
; node
= node
->next
) {
589 if (!xmlStrcasecmp(node
->name
, (const xmlChar
*) "file")) {
592 c
= parse_string(doc
, node
);
593 config_menu_files
= g_slist_append(config_menu_files
,
594 parse_expand_tilde(c
));
597 if ((n
= parse_find_node("warpPointer", node
)))
598 config_menu_warppointer
= parse_bool(doc
, n
);
599 if ((n
= parse_find_node("xorStyle", node
)))
600 config_menu_xorstyle
= parse_bool(doc
, n
);
601 if ((n
= parse_find_node("hideDelay", node
)))
602 config_menu_hide_delay
= parse_int(doc
, n
);
603 if ((n
= parse_find_node("middle", node
)))
604 config_menu_middle
= parse_bool(doc
, n
);
605 if ((n
= parse_find_node("submenuShowDelay", node
)))
606 config_submenu_show_delay
= parse_int(doc
, n
);
607 if ((n
= parse_find_node("desktopMenuIcons", node
)))
608 config_menu_client_list_icons
= parse_bool(doc
, n
);
612 static void parse_resistance(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
,
617 node
= node
->children
;
618 if ((n
= parse_find_node("strength", node
)))
619 config_resist_win
= parse_int(doc
, n
);
620 if ((n
= parse_find_node("screen_edge_strength", node
)))
621 config_resist_edge
= parse_int(doc
, n
);
622 if ((n
= parse_find_node("edges_hit_layers_below", node
)))
623 config_resist_layers_below
= parse_bool(doc
, n
);
629 const gchar
*actname
;
632 static void bind_default_keyboard()
635 ObDefKeyBind binds
[] = {
636 { "A-Tab", "NextWindow" },
637 { "S-A-Tab", "PreviousWindow" },
642 for (it
= binds
; it
->key
; ++it
) {
643 GList
*l
= g_list_append(NULL
, g_strdup(it
->key
));
644 keyboard_bind(l
, action_from_string(it
->actname
,
645 OB_USER_ACTION_KEYBOARD_KEY
));
652 const gchar
*context
;
653 const ObMouseAction mact
;
654 const gchar
*actname
;
657 static void bind_default_mouse()
660 ObDefMouseBind binds
[] = {
661 { "Left", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
662 { "Middle", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
663 { "Right", "Client", OB_MOUSE_ACTION_PRESS
, "Focus" },
664 { "Left", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
665 { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
666 { "Right", "Desktop", OB_MOUSE_ACTION_PRESS
, "Focus" },
667 { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS
, "Focus" },
668 { "Left", "Handle", OB_MOUSE_ACTION_PRESS
, "Focus" },
669 { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
670 { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
671 { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
672 { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS
, "Focus" },
673 { "Left", "Close", OB_MOUSE_ACTION_PRESS
, "Focus" },
674 { "Left", "Maximize", OB_MOUSE_ACTION_PRESS
, "Focus" },
675 { "Left", "Iconify", OB_MOUSE_ACTION_PRESS
, "Focus" },
676 { "Left", "Icon", OB_MOUSE_ACTION_PRESS
, "Focus" },
677 { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS
, "Focus" },
678 { "Left", "Shade", OB_MOUSE_ACTION_PRESS
, "Focus" },
679 { "Left", "Client", OB_MOUSE_ACTION_CLICK
, "Raise" },
680 { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Raise" },
681 { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK
, "Lower" },
682 { "Left", "Handle", OB_MOUSE_ACTION_CLICK
, "Raise" },
683 { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
684 { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
685 { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
686 { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK
, "Raise" },
687 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Raise" },
688 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "Raise" },
689 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Raise" },
690 { "Left", "Icon", OB_MOUSE_ACTION_CLICK
, "Raise" },
691 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "Raise" },
692 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "Raise" },
693 { "Left", "Close", OB_MOUSE_ACTION_CLICK
, "Close" },
694 { "Left", "Maximize", OB_MOUSE_ACTION_CLICK
, "ToggleMaximizeFull" },
695 { "Left", "Iconify", OB_MOUSE_ACTION_CLICK
, "Iconify" },
696 { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK
, "ToggleOmnipresent" },
697 { "Left", "Shade", OB_MOUSE_ACTION_CLICK
, "ToggleShade" },
698 { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
699 { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
700 { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
701 { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION
, "Resize" },
702 { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION
, "Move" },
703 { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION
, "Move" },
704 { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION
, "Resize" },
705 { NULL
, NULL
, 0, NULL
}
708 for (it
= binds
; it
->button
; ++it
) {
711 case OB_MOUSE_ACTION_PRESS
:
712 uact
= OB_USER_ACTION_MOUSE_PRESS
; break;
713 case OB_MOUSE_ACTION_RELEASE
:
714 uact
= OB_USER_ACTION_MOUSE_RELEASE
; break;
715 case OB_MOUSE_ACTION_CLICK
:
716 uact
= OB_USER_ACTION_MOUSE_CLICK
; break;
717 case OB_MOUSE_ACTION_DOUBLE_CLICK
:
718 uact
= OB_USER_ACTION_MOUSE_DOUBLE_CLICK
; break;
719 case OB_MOUSE_ACTION_MOTION
:
720 uact
= OB_USER_ACTION_MOUSE_MOTION
; break;
721 case OB_NUM_MOUSE_ACTIONS
:
722 g_assert_not_reached();
724 mouse_bind(it
->button
, it
->context
, it
->mact
,
725 action_from_string(it
->actname
, uact
));
729 void config_startup(ObParseInst
*i
)
731 config_focus_new
= TRUE
;
732 config_focus_follow
= FALSE
;
733 config_focus_delay
= 0;
734 config_focus_raise
= FALSE
;
735 config_focus_last
= FALSE
;
737 parse_register(i
, "focus", parse_focus
, NULL
);
739 config_place_policy
= OB_PLACE_POLICY_SMART
;
741 parse_register(i
, "placement", parse_placement
, NULL
);
745 config_title_layout
= g_strdup("NLIMC");
746 config_title_number
= TRUE
;
747 config_theme_keepborder
= TRUE
;
748 config_theme_hidedisabled
= FALSE
;
750 parse_register(i
, "theme", parse_theme
, NULL
);
752 config_desktops_num
= 4;
753 config_screen_firstdesk
= 1;
754 config_desktops_names
= NULL
;
756 parse_register(i
, "desktops", parse_desktops
, NULL
);
758 config_resize_redraw
= TRUE
;
759 config_resize_four_corners
= FALSE
;
760 config_resize_popup_show
= 1; /* nonpixel increments */
761 config_resize_popup_pos
= 0; /* center of client */
763 parse_register(i
, "resize", parse_resize
, NULL
);
765 config_dock_layer
= OB_STACKING_LAYER_ABOVE
;
766 config_dock_pos
= OB_DIRECTION_NORTHEAST
;
767 config_dock_floating
= FALSE
;
768 config_dock_nostrut
= FALSE
;
771 config_dock_orient
= OB_ORIENTATION_VERT
;
772 config_dock_hide
= FALSE
;
773 config_dock_hide_delay
= 300;
774 config_dock_show_delay
= 300;
775 config_dock_app_move_button
= 2; /* middle */
776 config_dock_app_move_modifiers
= 0;
778 parse_register(i
, "dock", parse_dock
, NULL
);
780 translate_key("C-g", &config_keyboard_reset_state
,
781 &config_keyboard_reset_keycode
);
783 bind_default_keyboard();
785 parse_register(i
, "keyboard", parse_keyboard
, NULL
);
787 config_mouse_threshold
= 3;
788 config_mouse_dclicktime
= 200;
790 bind_default_mouse();
792 parse_register(i
, "mouse", parse_mouse
, NULL
);
794 config_resist_win
= 10;
795 config_resist_edge
= 20;
796 config_resist_layers_below
= FALSE
;
798 parse_register(i
, "resistance", parse_resistance
, NULL
);
800 config_menu_warppointer
= TRUE
;
801 config_menu_xorstyle
= TRUE
;
802 config_menu_hide_delay
= 250;
803 config_menu_middle
= FALSE
;
804 config_submenu_show_delay
= 0;
805 config_menu_client_list_icons
= TRUE
;
806 config_menu_files
= NULL
;
808 parse_register(i
, "menu", parse_menu
, NULL
);
810 config_per_app_settings
= NULL
;
812 parse_register(i
, "applications", parse_per_app_settings
, NULL
);
815 void config_shutdown()
819 g_free(config_theme
);
821 g_free(config_title_layout
);
823 for (it
= config_desktops_names
; it
; it
= g_slist_next(it
))
825 g_slist_free(config_desktops_names
);
827 for (it
= config_menu_files
; it
; it
= g_slist_next(it
))
829 g_slist_free(config_menu_files
);
831 for (it
= config_per_app_settings
; it
; it
= g_slist_next(it
)) {
832 ObAppSettings
*itd
= (ObAppSettings
*)it
->data
;
838 g_slist_free(config_per_app_settings
);