]>
Dogcows Code - chaz/tint2/blob - src/config.c
1 /**************************************************************************
3 * Tint2 : read/write config file
5 * Copyright (C) 2007 Pål Staurland (staura@gmail.com)
6 * Modified (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 **************************************************************************/
25 #include <cairo-xlib.h>
27 #include <X11/Xutil.h>
28 #include <X11/Xatom.h>
33 #include <glib/gstdio.h>
34 #include <pango/pangocairo.h>
41 #include "systraybar.h"
47 // --------------------------------------------------
48 // backward compatibility
49 static int save_file_config
;
50 static int old_task_icon_size
;
51 static char *old_task_font
;
52 static char *old_time1_font
;
53 static char *old_time2_font
;
54 static Area
*area_task
, *area_task_active
;
58 static Panel
*panel_config
= 0;
60 // temporary list of background
61 static GSList
*list_back
;
68 // get monitor and desktop config
69 get_monitors_and_desktops();
71 // append full transparency background
72 list_back
= g_slist_append(0, calloc(1, sizeof(Area
)));
74 panel_config
= calloc(1, sizeof(Panel
));
83 // cleanup background list
85 for (l0
= list_back
; l0
; l0
= l0
->next
) {
88 g_slist_free(list_back
);
93 void copy_file(const char *pathSrc
, const char *pathDest
)
95 FILE *fileSrc
, *fileDest
;
99 fileSrc
= fopen(pathSrc
, "rb");
100 if (fileSrc
== NULL
) return;
102 fileDest
= fopen(pathDest
, "wb");
103 if (fileDest
== NULL
) return;
105 while ((nb
= fread(line
, 1, 100, fileSrc
)) > 0) fwrite(line
, 1, nb
, fileDest
);
112 void extract_values (const char *value
, char **value1
, char **value2
, char **value3
)
116 if (*value1
) free (*value1
);
117 if (*value2
) free (*value2
);
118 if (*value3
) free (*value3
);
120 if ((b
= strchr (value
, ' '))) {
128 *value1
= strdup (value
);
132 if ((c
= strchr (b
, ' '))) {
140 *value2
= strdup (b
);
145 *value3
= strdup (c
);
151 int hex_char_to_int (char c
)
155 if (c
>= '0' && c
<= '9') r
= c
- '0';
156 else if (c
>= 'a' && c
<= 'f') r
= c
- 'a' + 10;
157 else if (c
>= 'A' && c
<= 'F') r
= c
- 'A' + 10;
164 int hex_to_rgb (char *hex
, int *r
, int *g
, int *b
)
168 if (hex
== NULL
|| hex
[0] != '#') return (0);
172 *r
= hex_char_to_int (hex
[1]);
173 *g
= hex_char_to_int (hex
[2]);
174 *b
= hex_char_to_int (hex
[3]);
176 else if (len
== 6 + 1) {
177 *r
= hex_char_to_int (hex
[1]) * 16 + hex_char_to_int (hex
[2]);
178 *g
= hex_char_to_int (hex
[3]) * 16 + hex_char_to_int (hex
[4]);
179 *b
= hex_char_to_int (hex
[5]) * 16 + hex_char_to_int (hex
[6]);
181 else if (len
== 12 + 1) {
182 *r
= hex_char_to_int (hex
[1]) * 16 + hex_char_to_int (hex
[2]);
183 *g
= hex_char_to_int (hex
[5]) * 16 + hex_char_to_int (hex
[6]);
184 *b
= hex_char_to_int (hex
[9]) * 16 + hex_char_to_int (hex
[10]);
192 void get_color (char *hex
, double *rgb
)
195 hex_to_rgb (hex
, &r
, &g
, &b
);
197 rgb
[0] = (r
/ 255.0);
198 rgb
[1] = (g
/ 255.0);
199 rgb
[2] = (b
/ 255.0);
203 void get_action (char *event
, int *action
)
205 if (strcmp (event
, "none") == 0)
207 else if (strcmp (event
, "close") == 0)
209 else if (strcmp (event
, "toggle") == 0)
211 else if (strcmp (event
, "iconify") == 0)
213 else if (strcmp (event
, "shade") == 0)
215 else if (strcmp (event
, "toggle_iconify") == 0)
216 *action
= TOGGLE_ICONIFY
;
220 void add_entry (char *key
, char *value
)
222 char *value1
=0, *value2
=0, *value3
=0;
224 /* Background and border */
225 if (strcmp (key
, "rounded") == 0) {
226 // 'rounded' is the first parameter => alloc a new background
227 Area
*a
= calloc(1, sizeof(Area
));
228 a
->pix
.border
.rounded
= atoi (value
);
229 list_back
= g_slist_append(list_back
, a
);
231 else if (strcmp (key
, "border_width") == 0) {
232 Area
*a
= g_slist_last(list_back
)->data
;
233 a
->pix
.border
.width
= atoi (value
);
235 else if (strcmp (key
, "background_color") == 0) {
236 Area
*a
= g_slist_last(list_back
)->data
;
237 extract_values(value
, &value1
, &value2
, &value3
);
238 get_color (value1
, a
->pix
.back
.color
);
239 if (value2
) a
->pix
.back
.alpha
= (atoi (value2
) / 100.0);
240 else a
->pix
.back
.alpha
= 0.5;
242 else if (strcmp (key
, "border_color") == 0) {
243 Area
*a
= g_slist_last(list_back
)->data
;
244 extract_values(value
, &value1
, &value2
, &value3
);
245 get_color (value1
, a
->pix
.border
.color
);
246 if (value2
) a
->pix
.border
.alpha
= (atoi (value2
) / 100.0);
247 else a
->pix
.border
.alpha
= 0.5;
251 else if (strcmp (key
, "panel_monitor") == 0) {
252 if (strcmp (value
, "all") == 0) panel_config
->monitor
= -1;
254 panel_config
->monitor
= atoi (value
);
255 if (panel_config
->monitor
> 0) panel_config
->monitor
-= 1;
258 else if (strcmp (key
, "panel_size") == 0) {
259 extract_values(value
, &value1
, &value2
, &value3
);
262 if ((b
= strchr (value1
, '%'))) {
264 panel_config
->pourcentx
= 1;
266 panel_config
->initial_width
= atof(value1
);
268 if ((b
= strchr (value2
, '%'))) {
270 panel_config
->pourcenty
= 1;
272 panel_config
->initial_height
= atof(value2
);
275 else if (strcmp (key
, "panel_margin") == 0) {
276 extract_values(value
, &value1
, &value2
, &value3
);
277 panel_config
->marginx
= atoi (value1
);
278 if (value2
) panel_config
->marginy
= atoi (value2
);
280 else if (strcmp (key
, "panel_padding") == 0) {
281 extract_values(value
, &value1
, &value2
, &value3
);
282 panel_config
->area
.paddingxlr
= panel_config
->area
.paddingx
= atoi (value1
);
283 if (value2
) panel_config
->area
.paddingy
= atoi (value2
);
284 if (value3
) panel_config
->area
.paddingx
= atoi (value3
);
286 else if (strcmp (key
, "panel_position") == 0) {
287 extract_values(value
, &value1
, &value2
, &value3
);
288 if (strcmp (value1
, "top") == 0) panel_position
= TOP
;
289 else panel_position
= BOTTOM
;
291 if (!value2
) panel_position
= CENTER
;
293 if (strcmp (value2
, "left") == 0) panel_position
|= LEFT
;
295 if (strcmp (value2
, "right") == 0) panel_position
|= RIGHT
;
296 else panel_position
|= CENTER
;
300 else if (strcmp (key
, "font_shadow") == 0)
301 panel_config
->g_task
.font_shadow
= atoi (value
);
302 else if (strcmp (key
, "panel_background_id") == 0) {
303 int id
= atoi (value
);
304 Area
*a
= g_slist_nth_data(list_back
, id
);
305 memcpy(&panel_config
->area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
306 memcpy(&panel_config
->area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
310 else if (strcmp (key
, "time1_format") == 0) {
311 if (time1_format
) g_free(time1_format
);
312 if (strlen(value
) > 0) {
313 time1_format
= strdup (value
);
314 panel_config
->clock
.area
.on_screen
= 1;
318 panel_config
->clock
.area
.on_screen
= 0;
321 else if (strcmp (key
, "time2_format") == 0) {
322 if (time2_format
) g_free(time2_format
);
323 if (strlen(value
) > 0) time2_format
= strdup (value
);
324 else time2_format
= 0;
326 else if (strcmp (key
, "time1_font") == 0) {
327 if (save_file_config
) old_time1_font
= strdup (value
);
328 if (time1_font_desc
) pango_font_description_free(time1_font_desc
);
329 time1_font_desc
= pango_font_description_from_string (value
);
331 else if (strcmp (key
, "time2_font") == 0) {
332 if (save_file_config
) old_time2_font
= strdup (value
);
333 if (time2_font_desc
) pango_font_description_free(time2_font_desc
);
334 time2_font_desc
= pango_font_description_from_string (value
);
336 else if (strcmp (key
, "clock_font_color") == 0) {
337 extract_values(value
, &value1
, &value2
, &value3
);
338 get_color (value1
, panel_config
->clock
.font
.color
);
339 if (value2
) panel_config
->clock
.font
.alpha
= (atoi (value2
) / 100.0);
340 else panel_config
->clock
.font
.alpha
= 0.5;
342 else if (strcmp (key
, "clock_padding") == 0) {
343 extract_values(value
, &value1
, &value2
, &value3
);
344 panel_config
->clock
.area
.paddingxlr
= panel_config
->clock
.area
.paddingx
= atoi (value1
);
345 if (value2
) panel_config
->clock
.area
.paddingy
= atoi (value2
);
346 if (value3
) panel_config
->clock
.area
.paddingx
= atoi (value3
);
348 else if (strcmp (key
, "clock_background_id") == 0) {
349 int id
= atoi (value
);
350 Area
*a
= g_slist_nth_data(list_back
, id
);
351 memcpy(&panel_config
->clock
.area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
352 memcpy(&panel_config
->clock
.area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
356 else if (strcmp (key
, "taskbar_mode") == 0) {
357 if (strcmp (value
, "multi_desktop") == 0) panel_mode
= MULTI_DESKTOP
;
358 else if (strcmp (value
, "single_desktop") == 0) panel_mode
= SINGLE_DESKTOP
;
359 else panel_mode
= SINGLE_MONITOR
;
361 else if (strcmp (key
, "taskbar_padding") == 0) {
362 extract_values(value
, &value1
, &value2
, &value3
);
363 panel_config
->g_taskbar
.paddingxlr
= panel_config
->g_taskbar
.paddingx
= atoi (value1
);
364 if (value2
) panel_config
->g_taskbar
.paddingy
= atoi (value2
);
365 if (value3
) panel_config
->g_taskbar
.paddingx
= atoi (value3
);
367 else if (strcmp (key
, "taskbar_background_id") == 0) {
368 int id
= atoi (value
);
369 Area
*a
= g_slist_nth_data(list_back
, id
);
370 memcpy(&panel_config
->g_taskbar
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
371 memcpy(&panel_config
->g_taskbar
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
375 else if (strcmp (key
, "task_text") == 0)
376 panel_config
->g_task
.text
= atoi (value
);
377 else if (strcmp (key
, "task_icon") == 0)
378 panel_config
->g_task
.icon
= atoi (value
);
379 else if (strcmp (key
, "task_centered") == 0)
380 panel_config
->g_task
.centered
= atoi (value
);
381 else if (strcmp (key
, "task_width") == 0)
382 panel_config
->g_task
.maximum_width
= atoi (value
);
383 else if (strcmp (key
, "task_padding") == 0) {
384 extract_values(value
, &value1
, &value2
, &value3
);
385 panel_config
->g_task
.area
.paddingxlr
= panel_config
->g_task
.area
.paddingx
= atoi (value1
);
386 if (value2
) panel_config
->g_task
.area
.paddingy
= atoi (value2
);
387 if (value3
) panel_config
->g_task
.area
.paddingx
= atoi (value3
);
389 else if (strcmp (key
, "task_font") == 0) {
390 if (save_file_config
) old_task_font
= strdup (value
);
391 if (panel_config
->g_task
.font_desc
) pango_font_description_free(panel_config
->g_task
.font_desc
);
392 panel_config
->g_task
.font_desc
= pango_font_description_from_string (value
);
394 else if (strcmp (key
, "task_font_color") == 0) {
395 extract_values(value
, &value1
, &value2
, &value3
);
396 get_color (value1
, panel_config
->g_task
.font
.color
);
397 if (value2
) panel_config
->g_task
.font
.alpha
= (atoi (value2
) / 100.0);
398 else panel_config
->g_task
.font
.alpha
= 0.1;
400 else if (strcmp (key
, "task_active_font_color") == 0) {
401 extract_values(value
, &value1
, &value2
, &value3
);
402 get_color (value1
, panel_config
->g_task
.font_active
.color
);
403 if (value2
) panel_config
->g_task
.font_active
.alpha
= (atoi (value2
) / 100.0);
404 else panel_config
->g_task
.font_active
.alpha
= 0.1;
406 else if (strcmp (key
, "task_background_id") == 0) {
407 int id
= atoi (value
);
408 Area
*a
= g_slist_nth_data(list_back
, id
);
409 memcpy(&panel_config
->g_task
.area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
410 memcpy(&panel_config
->g_task
.area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
412 else if (strcmp (key
, "task_active_background_id") == 0) {
413 int id
= atoi (value
);
414 Area
*a
= g_slist_nth_data(list_back
, id
);
415 memcpy(&panel_config
->g_task
.area
.pix_active
.back
, &a
->pix
.back
, sizeof(Color
));
416 memcpy(&panel_config
->g_task
.area
.pix_active
.border
, &a
->pix
.border
, sizeof(Border
));
420 else if (strcmp (key
, "systray_padding") == 0) {
421 extract_values(value
, &value1
, &value2
, &value3
);
422 systray
.area
.paddingxlr
= systray
.area
.paddingx
= atoi (value1
);
423 if (value2
) systray
.area
.paddingy
= atoi (value2
);
424 if (value3
) systray
.area
.paddingx
= atoi (value3
);
425 systray
.area
.on_screen
= 1;
427 else if (strcmp (key
, "systray_background_id") == 0) {
428 int id
= atoi (value
);
429 Area
*a
= g_slist_nth_data(list_back
, id
);
430 memcpy(&systray
.area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
431 memcpy(&systray
.area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
435 else if (strcmp (key
, "mouse_middle") == 0)
436 get_action (value
, &mouse_middle
);
437 else if (strcmp (key
, "mouse_right") == 0)
438 get_action (value
, &mouse_right
);
439 else if (strcmp (key
, "mouse_scroll_up") == 0)
440 get_action (value
, &mouse_scroll_up
);
441 else if (strcmp (key
, "mouse_scroll_down") == 0)
442 get_action (value
, &mouse_scroll_down
);
445 /* Read tint-0.6 config for backward compatibility */
446 else if (strcmp (key
, "panel_mode") == 0) {
447 if (strcmp (value
, "multi_desktop") == 0) panel_mode
= MULTI_DESKTOP
;
448 else if (strcmp (value
, "single_desktop") == 0) panel_mode
= SINGLE_DESKTOP
;
449 else panel_mode
= SINGLE_MONITOR
;
451 else if (strcmp (key
, "panel_rounded") == 0) {
452 Area
*a
= calloc(1, sizeof(Area
));
453 a
->pix
.border
.rounded
= atoi (value
);
454 list_back
= g_slist_append(list_back
, a
);
456 else if (strcmp (key
, "panel_border_width") == 0) {
457 Area
*a
= g_slist_last(list_back
)->data
;
458 a
->pix
.border
.width
= atoi (value
);
460 else if (strcmp (key
, "panel_background_color") == 0) {
461 Area
*a
= g_slist_last(list_back
)->data
;
462 extract_values(value
, &value1
, &value2
, &value3
);
463 get_color (value1
, a
->pix
.back
.color
);
464 if (value2
) a
->pix
.back
.alpha
= (atoi (value2
) / 100.0);
465 else a
->pix
.back
.alpha
= 0.5;
467 else if (strcmp (key
, "panel_border_color") == 0) {
468 Area
*a
= g_slist_last(list_back
)->data
;
469 extract_values(value
, &value1
, &value2
, &value3
);
470 get_color (value1
, a
->pix
.border
.color
);
471 if (value2
) a
->pix
.border
.alpha
= (atoi (value2
) / 100.0);
472 else a
->pix
.border
.alpha
= 0.5;
474 else if (strcmp (key
, "task_text_centered") == 0)
475 panel_config
->g_task
.centered
= atoi (value
);
476 else if (strcmp (key
, "task_margin") == 0) {
477 panel_config
->g_taskbar
.paddingxlr
= 0;
478 panel_config
->g_taskbar
.paddingx
= atoi (value
);
480 else if (strcmp (key
, "task_icon_size") == 0)
481 old_task_icon_size
= atoi (value
);
482 else if (strcmp (key
, "task_rounded") == 0) {
483 area_task
= calloc(1, sizeof(Area
));
484 area_task
->pix
.border
.rounded
= atoi (value
);
485 list_back
= g_slist_append(list_back
, area_task
);
487 area_task_active
= calloc(1, sizeof(Area
));
488 area_task_active
->pix
.border
.rounded
= atoi (value
);
489 list_back
= g_slist_append(list_back
, area_task_active
);
491 else if (strcmp (key
, "task_background_color") == 0) {
492 extract_values(value
, &value1
, &value2
, &value3
);
493 get_color (value1
, area_task
->pix
.back
.color
);
494 if (value2
) area_task
->pix
.back
.alpha
= (atoi (value2
) / 100.0);
495 else area_task
->pix
.back
.alpha
= 0.5;
497 else if (strcmp (key
, "task_active_background_color") == 0) {
498 extract_values(value
, &value1
, &value2
, &value3
);
499 get_color (value1
, area_task_active
->pix
.back
.color
);
500 if (value2
) area_task_active
->pix
.back
.alpha
= (atoi (value2
) / 100.0);
501 else area_task_active
->pix
.back
.alpha
= 0.5;
503 else if (strcmp (key
, "task_border_width") == 0) {
504 area_task
->pix
.border
.width
= atoi (value
);
505 area_task_active
->pix
.border
.width
= atoi (value
);
507 else if (strcmp (key
, "task_border_color") == 0) {
508 extract_values(value
, &value1
, &value2
, &value3
);
509 get_color (value1
, area_task
->pix
.border
.color
);
510 if (value2
) area_task
->pix
.border
.alpha
= (atoi (value2
) / 100.0);
511 else area_task
->pix
.border
.alpha
= 0.5;
513 else if (strcmp (key
, "task_active_border_color") == 0) {
514 extract_values(value
, &value1
, &value2
, &value3
);
515 get_color (value1
, area_task_active
->pix
.border
.color
);
516 if (value2
) area_task_active
->pix
.border
.alpha
= (atoi (value2
) / 100.0);
517 else area_task_active
->pix
.border
.alpha
= 0.5;
521 fprintf(stderr
, "tint2 : invalid option \"%s\", correct your config file\n", key
);
523 if (value1
) free (value1
);
524 if (value2
) free (value2
);
525 if (value3
) free (value3
);
529 int parse_line (const char *line
)
531 char *a
, *b
, *key
, *value
;
533 /* Skip useless lines */
534 if ((line
[0] == '#') || (line
[0] == '\n')) return 0;
535 if (!(a
= strchr (line
, '='))) return 0;
537 /* overwrite '=' with '\0' */
542 /* overwrite '\n' with '\0' if '\n' present */
543 if ((b
= strchr (a
, '\n'))) b
[0] = '\0';
550 add_entry (key
, value
);
558 void config_finish ()
560 if (panel_config
->monitor
> (server
.nb_monitor
-1)) {
561 fprintf(stderr
, "tint2 exit : monitor %d not found.\n", panel_config
->monitor
+1);
567 if (panel_config
->monitor
>= 0) {
570 panel1
= calloc(nb_panel
, sizeof(Panel
));
571 memcpy(panel1
, panel_config
, sizeof(Panel
));
572 panel1
->monitor
= panel_config
->monitor
;
576 nb_panel
= server
.nb_monitor
;
577 panel1
= calloc(nb_panel
, sizeof(Panel
));
579 for (i
=0 ; i
< nb_panel
; i
++) {
580 memcpy(&panel1
[i
], panel_config
, sizeof(Panel
));
581 panel1
[i
].monitor
= i
;
585 // TODO: user can configure layout => ordered objects in panel.area.list
586 // clock and systray before taskbar because resize(clock) can resize others object ??
595 task_refresh_tasklist();
601 const gchar
* const * system_dirs
;
605 save_file_config
= 0;
607 // follow XDG specification
609 // check tint2rc in user directory
610 path1
= g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL
);
611 if (g_file_test (path1
, G_FILE_TEST_EXISTS
)) {
612 i
= config_read_file (path1
);
618 if (save_file_config
) {
619 fprintf(stderr
, "tint2 exit : enable to write $HOME/.config/tint2/tint2rc\n");
623 // check old tintrc config file
624 path1
= g_build_filename (g_get_user_config_dir(), "tint", "tintrc", NULL
);
625 if (g_file_test (path1
, G_FILE_TEST_EXISTS
)) {
626 save_file_config
= 1;
630 config_read_file (path1
);
632 if (old_task_font
) g_free(old_task_font
);
633 if (old_time1_font
) g_free(old_time1_font
);
634 if (old_time2_font
) g_free(old_time2_font
);
639 // copy tint2rc from system directory to user directory
642 system_dirs
= g_get_system_config_dirs();
643 for (i
= 0; system_dirs
[i
]; i
++) {
644 path2
= g_build_filename(system_dirs
[i
], "tint2", "tint2rc", NULL
);
646 if (g_file_test(path2
, G_FILE_TEST_EXISTS
)) break;
652 // copy file in user directory (path1)
653 char *dir
= g_build_filename (g_get_user_config_dir(), "tint2", NULL
);
654 if (!g_file_test (dir
, G_FILE_TEST_IS_DIR
)) g_mkdir(dir
, 0777);
657 path1
= g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL
);
658 copy_file(path2
, path1
);
661 i
= config_read_file (path1
);
669 int config_read_file (const char *path
)
674 if ((fp
= fopen(path
, "r")) == NULL
) return 0;
676 while (fgets(line
, sizeof(line
), fp
) != NULL
)
686 fprintf(stderr
, "tint2 : convert user's config file tintrc to tint2rc\n");
691 if (old_task_icon_size
) {
692 panel_config
->g_task
.area
.paddingy
= ((int)panel_config
->initial_height
- (2 * panel_config
->area
.paddingy
) - old_task_icon_size
) / 2;
695 dir
= g_build_filename (g_get_user_config_dir(), "tint2", NULL
);
696 if (!g_file_test (dir
, G_FILE_TEST_IS_DIR
)) g_mkdir(dir
, 0777);
699 path
= g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL
);
700 fp
= fopen(path
, "w");
702 if (fp
== NULL
) return;
704 fputs("#---------------------------------------------\n", fp
);
705 fputs("# TINT2 CONFIG FILE\n", fp
);
706 fputs("#---------------------------------------------\n\n", fp
);
707 fputs("#---------------------------------------------\n", fp
);
708 fputs("# BACKGROUND AND BORDER\n", fp
);
709 fputs("#---------------------------------------------\n", fp
);
712 l0
= list_back
->next
;
715 fprintf(fp
, "rounded = %d\n", a
->pix
.border
.rounded
);
716 fprintf(fp
, "border_width = %d\n", a
->pix
.border
.width
);
717 fprintf(fp
, "background_color = #%02x%02x%02x %d\n", (int)(a
->pix
.back
.color
[0]*255), (int)(a
->pix
.back
.color
[1]*255), (int)(a
->pix
.back
.color
[2]*255), (int)(a
->pix
.back
.alpha
*100));
718 fprintf(fp
, "border_color = #%02x%02x%02x %d\n\n", (int)(a
->pix
.border
.color
[0]*255), (int)(a
->pix
.border
.color
[1]*255), (int)(a
->pix
.border
.color
[2]*255), (int)(a
->pix
.border
.alpha
*100));
723 fputs("#---------------------------------------------\n", fp
);
724 fputs("# PANEL\n", fp
);
725 fputs("#---------------------------------------------\n", fp
);
726 fputs("panel_monitor = all\n", fp
);
727 if (panel_position
& BOTTOM
) fputs("panel_position = bottom", fp
);
728 else fputs("panel_position = top", fp
);
729 if (panel_position
& LEFT
) fputs(" left\n", fp
);
730 else if (panel_position
& RIGHT
) fputs(" right\n", fp
);
731 else fputs(" center\n", fp
);
732 fprintf(fp
, "panel_size = %d %d\n", (int)panel_config
->initial_width
, (int)panel_config
->initial_height
);
733 fprintf(fp
, "panel_margin = %d %d\n", panel_config
->marginx
, panel_config
->marginy
);
734 fprintf(fp
, "panel_padding = %d %d\n", panel_config
->area
.paddingx
, panel_config
->area
.paddingy
);
735 fprintf(fp
, "font_shadow = %d\n", panel_config
->g_task
.font_shadow
);
736 fputs("panel_background_id = 1\n", fp
);
738 fputs("\n#---------------------------------------------\n", fp
);
739 fputs("# TASKBAR\n", fp
);
740 fputs("#---------------------------------------------\n", fp
);
741 if (panel_mode
== MULTI_DESKTOP
) fputs("taskbar_mode = multi_desktop\n", fp
);
742 else fputs("taskbar_mode = single_desktop\n", fp
);
743 fprintf(fp
, "taskbar_padding = 0 0 %d\n", panel_config
->g_taskbar
.paddingx
);
744 fputs("taskbar_background_id = 0\n", fp
);
746 fputs("\n#---------------------------------------------\n", fp
);
747 fputs("# TASK\n", fp
);
748 fputs("#---------------------------------------------\n", fp
);
749 if (old_task_icon_size
) fputs("task_icon = 1\n", fp
);
750 else fputs("task_icon = 0\n", fp
);
751 fputs("task_text = 1\n", fp
);
752 fprintf(fp
, "task_width = %d\n", panel_config
->g_task
.maximum_width
);
753 fprintf(fp
, "task_centered = %d\n", panel_config
->g_task
.centered
);
754 fprintf(fp
, "task_padding = %d %d\n", panel_config
->g_task
.area
.paddingx
, panel_config
->g_task
.area
.paddingy
);
755 fprintf(fp
, "task_font = %s\n", old_task_font
);
756 fprintf(fp
, "task_font_color = #%02x%02x%02x %d\n", (int)(panel_config
->g_task
.font
.color
[0]*255), (int)(panel_config
->g_task
.font
.color
[1]*255), (int)(panel_config
->g_task
.font
.color
[2]*255), (int)(panel_config
->g_task
.font
.alpha
*100));
757 fprintf(fp
, "task_active_font_color = #%02x%02x%02x %d\n", (int)(panel_config
->g_task
.font_active
.color
[0]*255), (int)(panel_config
->g_task
.font_active
.color
[1]*255), (int)(panel_config
->g_task
.font_active
.color
[2]*255), (int)(panel_config
->g_task
.font_active
.alpha
*100));
758 fputs("task_background_id = 2\n", fp
);
759 fputs("task_active_background_id = 3\n", fp
);
761 fputs("\n#---------------------------------------------\n", fp
);
762 fputs("# SYSTRAYBAR\n", fp
);
763 fputs("#---------------------------------------------\n", fp
);
764 fputs("systray_padding = 4 3 4\n", fp
);
765 fputs("systray_background_id = 0\n", fp
);
767 fputs("\n#---------------------------------------------\n", fp
);
768 fputs("# CLOCK\n", fp
);
769 fputs("#---------------------------------------------\n", fp
);
770 if (time1_format
) fprintf(fp
, "time1_format = %s\n", time1_format
);
771 else fputs("#time1_format = %H:%M\n", fp
);
772 fprintf(fp
, "time1_font = %s\n", old_time1_font
);
773 if (time2_format
) fprintf(fp
, "time2_format = %s\n", time2_format
);
774 else fputs("#time2_format = %A %d %B\n", fp
);
775 fprintf(fp
, "time2_font = %s\n", old_time2_font
);
776 fprintf(fp
, "clock_font_color = #%02x%02x%02x %d\n", (int)(panel_config
->clock
.font
.color
[0]*255), (int)(panel_config
->clock
.font
.color
[1]*255), (int)(panel_config
->clock
.font
.color
[2]*255), (int)(panel_config
->clock
.font
.alpha
*100));
777 fputs("clock_padding = 2 2\n", fp
);
778 fputs("clock_background_id = 0\n", fp
);
780 fputs("\n#---------------------------------------------\n", fp
);
781 fputs("# MOUSE ACTION ON TASK\n", fp
);
782 fputs("#---------------------------------------------\n", fp
);
783 if (mouse_middle
== NONE
) fputs("mouse_middle = none\n", fp
);
784 else if (mouse_middle
== CLOSE
) fputs("mouse_middle = close\n", fp
);
785 else if (mouse_middle
== TOGGLE
) fputs("mouse_middle = toggle\n", fp
);
786 else if (mouse_middle
== ICONIFY
) fputs("mouse_middle = iconify\n", fp
);
787 else if (mouse_middle
== SHADE
) fputs("mouse_middle = shade\n", fp
);
788 else fputs("mouse_middle = toggle_iconify\n", fp
);
790 if (mouse_right
== NONE
) fputs("mouse_right = none\n", fp
);
791 else if (mouse_right
== CLOSE
) fputs("mouse_right = close\n", fp
);
792 else if (mouse_right
== TOGGLE
) fputs("mouse_right = toggle\n", fp
);
793 else if (mouse_right
== ICONIFY
) fputs("mouse_right = iconify\n", fp
);
794 else if (mouse_right
== SHADE
) fputs("mouse_right = shade\n", fp
);
795 else fputs("mouse_right = toggle_iconify\n", fp
);
797 if (mouse_scroll_up
== NONE
) fputs("mouse_scroll_up = none\n", fp
);
798 else if (mouse_scroll_up
== CLOSE
) fputs("mouse_scroll_up = close\n", fp
);
799 else if (mouse_scroll_up
== TOGGLE
) fputs("mouse_scroll_up = toggle\n", fp
);
800 else if (mouse_scroll_up
== ICONIFY
) fputs("mouse_scroll_up = iconify\n", fp
);
801 else if (mouse_scroll_up
== SHADE
) fputs("mouse_scroll_up = shade\n", fp
);
802 else fputs("mouse_scroll_up = toggle_iconify\n", fp
);
804 if (mouse_scroll_down
== NONE
) fputs("mouse_scroll_down = none\n", fp
);
805 else if (mouse_scroll_down
== CLOSE
) fputs("mouse_scroll_down = close\n", fp
);
806 else if (mouse_scroll_down
== TOGGLE
) fputs("mouse_scroll_down = toggle\n", fp
);
807 else if (mouse_scroll_down
== ICONIFY
) fputs("mouse_scroll_down = iconify\n", fp
);
808 else if (mouse_scroll_down
== SHADE
) fputs("mouse_scroll_down = shade\n", fp
);
809 else fputs("mouse_scroll_down = toggle_iconify\n", fp
);
This page took 0.080478 seconds and 5 git commands to generate.