4 gboolean config_focus_new
;
5 gboolean config_focus_follow
;
6 gboolean config_focus_last
;
7 gboolean config_focus_last_on_desktop
;
8 gboolean config_focus_popup
;
12 int config_desktops_num
;
13 GSList
*config_desktops_names
;
15 gboolean config_opaque_move
;
16 gboolean config_opaque_resize
;
18 StackLayer config_dock_layer
;
19 DockPosition config_dock_pos
;
22 gboolean config_dock_horz
;
23 gboolean config_dock_hide
;
24 guint config_dock_hide_timeout
;
26 static void parse_focus(char *name
, ParseToken
*value
)
28 if (!g_ascii_strcasecmp(name
, "focusnew")) {
29 if (value
->type
!= TOKEN_BOOL
)
30 yyerror("invalid value");
32 config_focus_new
= value
->data
.bool;
34 } else if (!g_ascii_strcasecmp(name
, "followmouse")) {
35 if (value
->type
!= TOKEN_BOOL
)
36 yyerror("invalid value");
38 config_focus_follow
= value
->data
.bool;
40 } else if (!g_ascii_strcasecmp(name
, "focuslast")) {
41 if (value
->type
!= TOKEN_BOOL
)
42 yyerror("invalid value");
44 config_focus_last
= value
->data
.bool;
46 } else if (!g_ascii_strcasecmp(name
, "focuslastondesktop")) {
47 if (value
->type
!= TOKEN_BOOL
)
48 yyerror("invalid value");
50 config_focus_last_on_desktop
= value
->data
.bool;
52 } else if (!g_ascii_strcasecmp(name
, "cyclingdialog")) {
53 if (value
->type
!= TOKEN_BOOL
)
54 yyerror("invalid value");
56 config_focus_popup
= value
->data
.bool;
59 yyerror("invalid option");
60 parse_free_token(value
);
63 static void parse_theme(char *name
, ParseToken
*value
)
65 if (!g_ascii_strcasecmp(name
, "theme")) {
66 if (value
->type
!= TOKEN_STRING
)
67 yyerror("invalid value");
70 config_theme
= g_strdup(value
->data
.string
);
73 yyerror("invalid option");
74 parse_free_token(value
);
77 static void parse_desktops(char *name
, ParseToken
*value
)
81 if (!g_ascii_strcasecmp(name
, "number")) {
82 if (value
->type
!= TOKEN_INTEGER
)
83 yyerror("invalid value");
85 config_desktops_num
= value
->data
.integer
;
87 } else if (!g_ascii_strcasecmp(name
, "names")) {
88 if (value
->type
== TOKEN_LIST
) {
89 for (it
= value
->data
.list
; it
; it
= it
->next
)
90 if (((ParseToken
*)it
->data
)->type
!= TOKEN_STRING
) break;
92 /* build a string list */
93 g_free(config_desktops_names
);
94 for (it
= value
->data
.list
; it
; it
= it
->next
)
95 config_desktops_names
=
96 g_slist_append(config_desktops_names
,
98 (((ParseToken
*)it
->data
)->data
.string
));
100 yyerror("invalid string in names list");
103 yyerror("syntax error (expected list of strings)");
106 yyerror("invalid option");
107 parse_free_token(value
);
110 static void parse_moveresize(char *name
, ParseToken
*value
)
112 if (!g_ascii_strcasecmp(name
, "opaque_move")) {
113 if (value
->type
!= TOKEN_BOOL
)
114 yyerror("invalid value");
116 config_opaque_move
= value
->data
.integer
;
118 } else if (!g_ascii_strcasecmp(name
, "opaque_resize")) {
119 if (value
->type
!= TOKEN_BOOL
)
120 yyerror("invalid value");
122 config_opaque_resize
= value
->data
.integer
;
125 yyerror("invalid option");
126 parse_free_token(value
);
129 static void parse_dock(char *name
, ParseToken
*value
)
131 if (!g_ascii_strcasecmp(name
, "stacking")) {
132 if (value
->type
!= TOKEN_STRING
)
133 yyerror("invalid value");
135 if (!g_ascii_strcasecmp(value
->data
.string
, "bottom"))
136 config_dock_layer
= Layer_Below
;
137 else if (!g_ascii_strcasecmp(value
->data
.string
, "normal"))
138 config_dock_layer
= Layer_Normal
;
139 else if (!g_ascii_strcasecmp(value
->data
.string
, "top"))
140 config_dock_layer
= Layer_Top
;
142 yyerror("invalid layer");
144 } else if (!g_ascii_strcasecmp(name
, "position")) {
145 if (value
->type
!= TOKEN_STRING
)
146 yyerror("invalid value");
148 if (!g_ascii_strcasecmp(value
->data
.string
, "topleft"))
149 config_dock_pos
= DockPos_TopLeft
;
150 else if (!g_ascii_strcasecmp(value
->data
.string
, "top"))
151 config_dock_pos
= DockPos_Top
;
152 else if (!g_ascii_strcasecmp(value
->data
.string
, "topright"))
153 config_dock_pos
= DockPos_TopRight
;
154 else if (!g_ascii_strcasecmp(value
->data
.string
, "right"))
155 config_dock_pos
= DockPos_Right
;
156 else if (!g_ascii_strcasecmp(value
->data
.string
, "bottomright"))
157 config_dock_pos
= DockPos_BottomRight
;
158 else if (!g_ascii_strcasecmp(value
->data
.string
, "bottom"))
159 config_dock_pos
= DockPos_Bottom
;
160 else if (!g_ascii_strcasecmp(value
->data
.string
, "bottomleft"))
161 config_dock_pos
= DockPos_BottomLeft
;
162 else if (!g_ascii_strcasecmp(value
->data
.string
, "left"))
163 config_dock_pos
= DockPos_Left
;
164 else if (!g_ascii_strcasecmp(value
->data
.string
, "floating"))
165 config_dock_pos
= DockPos_Floating
;
167 yyerror("invalid position");
169 } else if (!g_ascii_strcasecmp(name
, "floatingx")) {
170 if (value
->type
!= TOKEN_INTEGER
)
171 yyerror("invalid value");
173 config_dock_x
= value
->data
.integer
;
175 } else if (!g_ascii_strcasecmp(name
, "floatingy")) {
176 if (value
->type
!= TOKEN_INTEGER
)
177 yyerror("invalid value");
179 config_dock_y
= value
->data
.integer
;
181 } else if (!g_ascii_strcasecmp(name
, "horizontal")) {
182 if (value
->type
!= TOKEN_BOOL
)
183 yyerror("invalid value");
185 config_dock_horz
= value
->data
.bool;
187 } else if (!g_ascii_strcasecmp(name
, "autohide")) {
188 if (value
->type
!= TOKEN_BOOL
)
189 yyerror("invalid value");
191 config_dock_hide
= value
->data
.bool;
193 } else if (!g_ascii_strcasecmp(name
, "hidetimeout")) {
194 if (value
->type
!= TOKEN_INTEGER
)
195 yyerror("invalid value");
197 config_dock_hide_timeout
= value
->data
.integer
;
200 yyerror("invalid option");
201 parse_free_token(value
);
204 void config_startup()
206 config_focus_new
= TRUE
;
207 config_focus_follow
= FALSE
;
208 config_focus_last
= TRUE
;
209 config_focus_last_on_desktop
= TRUE
;
210 config_focus_popup
= TRUE
;
212 parse_reg_section("focus", NULL
, parse_focus
);
216 parse_reg_section("theme", NULL
, parse_theme
);
218 config_desktops_num
= 4;
219 config_desktops_names
= NULL
;
221 parse_reg_section("desktops", NULL
, parse_desktops
);
223 config_opaque_move
= TRUE
;
224 config_opaque_resize
= TRUE
;
226 parse_reg_section("moveresize", NULL
, parse_moveresize
);
228 config_dock_layer
= Layer_Top
;
229 config_dock_pos
= DockPos_TopRight
;
232 config_dock_horz
= FALSE
;
233 config_dock_hide
= FALSE
;
234 config_dock_hide_timeout
= 3000;
236 parse_reg_section("dock", NULL
, parse_dock
);
239 void config_shutdown()
243 g_free(config_theme
);
245 for (it
= config_desktops_names
; it
; it
= it
->next
)
247 g_slist_free(config_desktops_names
);