]>
Dogcows Code - chaz/tint2/blob - src/config.c
bfdea1b2a3e578778a7bde48eb9a1430155ccaa1
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>
46 // --------------------------------------------------
47 // backward compatibility
48 static int old_config_file
= 0;
49 static int old_task_icon
;
50 static int old_panel_background
;
51 static int old_task_background
;
52 static char *old_task_font
= 0;
55 static Panel
*panel_config
= 0;
57 // temporary list of background
58 static GSList
*list_back
;
65 // get monitor and desktop config
66 get_monitors_and_desktops();
68 // append full transparency background
69 list_back
= g_slist_append(0, calloc(1, sizeof(Area
)));
71 panel_config
= calloc(1, sizeof(Panel
));
77 if (old_task_font
) free(old_task_font
);
78 if (panel_config
) free(panel_config
);
80 // cleanup background list
82 for (l0
= list_back
; l0
; l0
= l0
->next
) {
85 g_slist_free(list_back
);
90 void copy_file(const char *pathSrc
, const char *pathDest
)
92 FILE *fileSrc
, *fileDest
;
96 fileSrc
= fopen(pathSrc
, "rb");
97 if (fileSrc
== NULL
) return;
99 fileDest
= fopen(pathDest
, "wb");
100 if (fileDest
== NULL
) return;
102 while ((nb
= fread(line
, 1, 100, fileSrc
)) > 0) fwrite(line
, 1, nb
, fileDest
);
109 void extract_values (const char *value
, char **value1
, char **value2
, char **value3
)
113 if (*value1
) free (*value1
);
114 if (*value2
) free (*value2
);
115 if (*value3
) free (*value3
);
117 if ((b
= strchr (value
, ' '))) {
125 *value1
= strdup (value
);
129 if ((c
= strchr (b
, ' '))) {
137 *value2
= strdup (b
);
142 *value3
= strdup (c
);
148 int hex_char_to_int (char c
)
152 if (c
>= '0' && c
<= '9') r
= c
- '0';
153 else if (c
>= 'a' && c
<= 'f') r
= c
- 'a' + 10;
154 else if (c
>= 'A' && c
<= 'F') r
= c
- 'A' + 10;
161 int hex_to_rgb (char *hex
, int *r
, int *g
, int *b
)
165 if (hex
== NULL
|| hex
[0] != '#') return (0);
169 *r
= hex_char_to_int (hex
[1]);
170 *g
= hex_char_to_int (hex
[2]);
171 *b
= hex_char_to_int (hex
[3]);
173 else if (len
== 6 + 1) {
174 *r
= hex_char_to_int (hex
[1]) * 16 + hex_char_to_int (hex
[2]);
175 *g
= hex_char_to_int (hex
[3]) * 16 + hex_char_to_int (hex
[4]);
176 *b
= hex_char_to_int (hex
[5]) * 16 + hex_char_to_int (hex
[6]);
178 else if (len
== 12 + 1) {
179 *r
= hex_char_to_int (hex
[1]) * 16 + hex_char_to_int (hex
[2]);
180 *g
= hex_char_to_int (hex
[5]) * 16 + hex_char_to_int (hex
[6]);
181 *b
= hex_char_to_int (hex
[9]) * 16 + hex_char_to_int (hex
[10]);
189 void get_color (char *hex
, double *rgb
)
192 hex_to_rgb (hex
, &r
, &g
, &b
);
194 rgb
[0] = (r
/ 255.0);
195 rgb
[1] = (g
/ 255.0);
196 rgb
[2] = (b
/ 255.0);
200 void get_action (char *event
, int *action
)
202 if (strcmp (event
, "none") == 0)
204 else if (strcmp (event
, "close") == 0)
206 else if (strcmp (event
, "toggle") == 0)
208 else if (strcmp (event
, "iconify") == 0)
210 else if (strcmp (event
, "shade") == 0)
212 else if (strcmp (event
, "toggle_iconify") == 0)
213 *action
= TOGGLE_ICONIFY
;
217 void add_entry (char *key
, char *value
)
219 char *value1
=0, *value2
=0, *value3
=0;
221 /* Background and border */
222 if (strcmp (key
, "rounded") == 0) {
223 // 'rounded' is the first parameter => alloc a new background
224 Area
*a
= calloc(1, sizeof(Area
));
225 a
->pix
.border
.rounded
= atoi (value
);
226 list_back
= g_slist_append(list_back
, a
);
228 else if (strcmp (key
, "border_width") == 0) {
229 Area
*a
= g_slist_last(list_back
)->data
;
230 a
->pix
.border
.width
= atoi (value
);
232 else if (strcmp (key
, "background_color") == 0) {
233 Area
*a
= g_slist_last(list_back
)->data
;
234 extract_values(value
, &value1
, &value2
, &value3
);
235 get_color (value1
, a
->pix
.back
.color
);
236 if (value2
) a
->pix
.back
.alpha
= (atoi (value2
) / 100.0);
237 else a
->pix
.back
.alpha
= 0.5;
239 else if (strcmp (key
, "border_color") == 0) {
240 Area
*a
= g_slist_last(list_back
)->data
;
241 extract_values(value
, &value1
, &value2
, &value3
);
242 get_color (value1
, a
->pix
.border
.color
);
243 if (value2
) a
->pix
.border
.alpha
= (atoi (value2
) / 100.0);
244 else a
->pix
.border
.alpha
= 0.5;
248 else if (strcmp (key
, "panel_monitor") == 0) {
249 if (strcmp (value
, "all") == 0) panel_config
->monitor
= -1;
251 panel_config
->monitor
= atoi (value
);
252 if (panel_config
->monitor
> 0) panel_config
->monitor
-= 1;
255 else if (strcmp (key
, "panel_size") == 0) {
256 extract_values(value
, &value1
, &value2
, &value3
);
259 if ((b
= strchr (value1
, '%'))) {
261 panel_config
->pourcentx
= 1;
263 panel_config
->initial_width
= atof(value1
);
265 if ((b
= strchr (value2
, '%'))) {
267 panel_config
->pourcenty
= 1;
269 panel_config
->initial_height
= atof(value2
);
272 else if (strcmp (key
, "panel_margin") == 0) {
273 extract_values(value
, &value1
, &value2
, &value3
);
274 panel_config
->marginx
= atoi (value1
);
275 if (value2
) panel_config
->marginy
= atoi (value2
);
277 else if (strcmp (key
, "panel_padding") == 0) {
278 extract_values(value
, &value1
, &value2
, &value3
);
279 panel_config
->area
.paddingxlr
= panel_config
->area
.paddingx
= atoi (value1
);
280 if (value2
) panel_config
->area
.paddingy
= atoi (value2
);
281 if (value3
) panel_config
->area
.paddingx
= atoi (value3
);
283 else if (strcmp (key
, "panel_position") == 0) {
284 extract_values(value
, &value1
, &value2
, &value3
);
285 if (strcmp (value1
, "top") == 0) panel_position
= TOP
;
286 else panel_position
= BOTTOM
;
288 if (!value2
) panel_position
= CENTER
;
290 if (strcmp (value2
, "left") == 0) panel_position
|= LEFT
;
292 if (strcmp (value2
, "right") == 0) panel_position
|= RIGHT
;
293 else panel_position
|= CENTER
;
297 else if (strcmp (key
, "font_shadow") == 0)
298 panel_config
->g_task
.font_shadow
= atoi (value
);
299 else if (strcmp (key
, "panel_background_id") == 0) {
300 int id
= atoi (value
);
301 Area
*a
= g_slist_nth_data(list_back
, id
);
302 memcpy(&panel_config
->area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
303 memcpy(&panel_config
->area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
307 else if (strcmp (key
, "time1_format") == 0) {
308 if (time1_format
) g_free(time1_format
);
309 if (strlen(value
) > 0) time1_format
= strdup (value
);
310 else time1_format
= 0;
312 else if (strcmp (key
, "time2_format") == 0) {
313 if (time2_format
) g_free(time2_format
);
314 if (strlen(value
) > 0) time2_format
= strdup (value
);
315 else time2_format
= 0;
317 else if (strcmp (key
, "time1_font") == 0) {
318 if (time1_font_desc
) pango_font_description_free(time1_font_desc
);
319 time1_font_desc
= pango_font_description_from_string (value
);
321 else if (strcmp (key
, "time2_font") == 0) {
322 if (time2_font_desc
) pango_font_description_free(time2_font_desc
);
323 time2_font_desc
= pango_font_description_from_string (value
);
325 else if (strcmp (key
, "clock_font_color") == 0) {
326 extract_values(value
, &value1
, &value2
, &value3
);
327 get_color (value1
, panel_config
->clock
.font
.color
);
328 if (value2
) panel_config
->clock
.font
.alpha
= (atoi (value2
) / 100.0);
329 else panel_config
->clock
.font
.alpha
= 0.5;
331 else if (strcmp (key
, "clock_padding") == 0) {
332 extract_values(value
, &value1
, &value2
, &value3
);
333 panel_config
->clock
.area
.paddingxlr
= panel_config
->clock
.area
.paddingx
= atoi (value1
);
334 if (value2
) panel_config
->clock
.area
.paddingy
= atoi (value2
);
335 if (value3
) panel_config
->clock
.area
.paddingx
= atoi (value3
);
337 else if (strcmp (key
, "clock_background_id") == 0) {
338 int id
= atoi (value
);
339 Area
*a
= g_slist_nth_data(list_back
, id
);
340 memcpy(&panel_config
->clock
.area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
341 memcpy(&panel_config
->clock
.area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
345 else if (strcmp (key
, "taskbar_mode") == 0) {
346 if (strcmp (value
, "multi_desktop") == 0) panel_mode
= MULTI_DESKTOP
;
347 else if (strcmp (value
, "single_desktop") == 0) panel_mode
= SINGLE_DESKTOP
;
348 else panel_mode
= SINGLE_MONITOR
;
350 else if (strcmp (key
, "taskbar_padding") == 0) {
351 extract_values(value
, &value1
, &value2
, &value3
);
352 panel_config
->g_taskbar
.paddingxlr
= panel_config
->g_taskbar
.paddingx
= atoi (value1
);
353 if (value2
) panel_config
->g_taskbar
.paddingy
= atoi (value2
);
354 if (value3
) panel_config
->g_taskbar
.paddingx
= atoi (value3
);
356 else if (strcmp (key
, "taskbar_background_id") == 0) {
357 int id
= atoi (value
);
358 Area
*a
= g_slist_nth_data(list_back
, id
);
359 memcpy(&panel_config
->g_taskbar
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
360 memcpy(&panel_config
->g_taskbar
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
364 else if (strcmp (key
, "task_text") == 0)
365 panel_config
->g_task
.text
= atoi (value
);
366 else if (strcmp (key
, "task_icon") == 0)
367 panel_config
->g_task
.icon
= atoi (value
);
368 else if (strcmp (key
, "task_centered") == 0)
369 panel_config
->g_task
.centered
= atoi (value
);
370 else if (strcmp (key
, "task_width") == 0)
371 panel_config
->g_task
.maximum_width
= atoi (value
);
372 else if (strcmp (key
, "task_padding") == 0) {
373 extract_values(value
, &value1
, &value2
, &value3
);
374 panel_config
->g_task
.area
.paddingxlr
= panel_config
->g_task
.area
.paddingx
= atoi (value1
);
375 if (value2
) panel_config
->g_task
.area
.paddingy
= atoi (value2
);
376 if (value3
) panel_config
->g_task
.area
.paddingx
= atoi (value3
);
378 else if (strcmp (key
, "task_font") == 0) {
379 if (panel_config
->g_task
.font_desc
) pango_font_description_free(panel_config
->g_task
.font_desc
);
380 panel_config
->g_task
.font_desc
= pango_font_description_from_string (value
);
382 else if (strcmp (key
, "task_font_color") == 0) {
383 extract_values(value
, &value1
, &value2
, &value3
);
384 get_color (value1
, panel_config
->g_task
.font
.color
);
385 if (value2
) panel_config
->g_task
.font
.alpha
= (atoi (value2
) / 100.0);
386 else panel_config
->g_task
.font
.alpha
= 0.1;
388 else if (strcmp (key
, "task_active_font_color") == 0) {
389 extract_values(value
, &value1
, &value2
, &value3
);
390 get_color (value1
, panel_config
->g_task
.font_active
.color
);
391 if (value2
) panel_config
->g_task
.font_active
.alpha
= (atoi (value2
) / 100.0);
392 else panel_config
->g_task
.font_active
.alpha
= 0.1;
394 else if (strcmp (key
, "task_background_id") == 0) {
395 int id
= atoi (value
);
396 Area
*a
= g_slist_nth_data(list_back
, id
);
397 memcpy(&panel_config
->g_task
.area
.pix
.back
, &a
->pix
.back
, sizeof(Color
));
398 memcpy(&panel_config
->g_task
.area
.pix
.border
, &a
->pix
.border
, sizeof(Border
));
400 else if (strcmp (key
, "task_active_background_id") == 0) {
401 int id
= atoi (value
);
402 Area
*a
= g_slist_nth_data(list_back
, id
);
403 memcpy(&panel_config
->g_task
.area
.pix_active
.back
, &a
->pix
.back
, sizeof(Color
));
404 memcpy(&panel_config
->g_task
.area
.pix_active
.border
, &a
->pix
.border
, sizeof(Border
));
408 else if (strcmp (key
, "mouse_middle") == 0)
409 get_action (value
, &mouse_middle
);
410 else if (strcmp (key
, "mouse_right") == 0)
411 get_action (value
, &mouse_right
);
412 else if (strcmp (key
, "mouse_scroll_up") == 0)
413 get_action (value
, &mouse_scroll_up
);
414 else if (strcmp (key
, "mouse_scroll_down") == 0)
415 get_action (value
, &mouse_scroll_down
);
418 /* Read old config for backward compatibility */
419 else if (strcmp (key
, "font") == 0) {
421 if (panel_config
->g_task
.font_desc
) pango_font_description_free(panel_config
->g_task
.font_desc
);
422 panel_config
->g_task
.font_desc
= pango_font_description_from_string (value
);
423 if (old_task_font
) free(old_task_font
);
424 old_task_font
= strdup (value
);
426 else if (strcmp (key
, "font_color") == 0)
427 get_color (value
, panel_config
->g_task
.font
.color
);
428 else if (strcmp (key
, "font_alpha") == 0)
429 panel_config
->g_task
.font
.alpha
= (atoi (value
) / 100.0);
430 else if (strcmp (key
, "font_active_color") == 0)
431 get_color (value
, panel_config
->g_task
.font_active
.color
);
432 else if (strcmp (key
, "font_active_alpha") == 0)
433 panel_config
->g_task
.font_active
.alpha
= (atoi (value
) / 100.0);
434 else if (strcmp (key
, "panel_show_all_desktop") == 0) {
435 if (atoi (value
) == 0) panel_mode
= SINGLE_DESKTOP
;
436 else panel_mode
= MULTI_DESKTOP
;
438 else if (strcmp (key
, "panel_width") == 0)
439 panel_config
->area
.width
= atoi (value
);
440 else if (strcmp (key
, "panel_height") == 0)
441 panel_config
->area
.height
= atoi (value
);
442 else if (strcmp (key
, "panel_background") == 0)
443 old_panel_background
= atoi (value
);
444 else if (strcmp (key
, "panel_background_alpha") == 0)
445 panel_config
->area
.pix
.back
.alpha
= (atoi (value
) / 100.0);
446 else if (strcmp (key
, "panel_border_alpha") == 0)
447 panel_config
->area
.pix
.border
.alpha
= (atoi (value
) / 100.0);
448 else if (strcmp (key
, "task_icon") == 0)
449 old_task_icon
= atoi (value
);
450 else if (strcmp (key
, "task_background") == 0)
451 old_task_background
= atoi (value
);
452 else if (strcmp (key
, "task_background_alpha") == 0)
453 panel_config
->g_task
.area
.pix
.back
.alpha
= (atoi (value
) / 100.0);
454 else if (strcmp (key
, "task_active_background_alpha") == 0)
455 panel_config
->g_task
.area
.pix_active
.back
.alpha
= (atoi (value
) / 100.0);
456 else if (strcmp (key
, "task_border_alpha") == 0)
457 panel_config
->g_task
.area
.pix
.border
.alpha
= (atoi (value
) / 100.0);
458 else if (strcmp (key
, "task_active_border_alpha") == 0)
459 panel_config
->g_task
.area
.pix_active
.border
.alpha
= (atoi (value
) / 100.0);
460 // disabled parameters
461 else if (strcmp (key
, "task_active_border_width") == 0) ;
462 else if (strcmp (key
, "task_active_rounded") == 0) ;
465 fprintf(stderr
, "Invalid option: \"%s\", correct your config file\n", key
);
467 if (value1
) free (value1
);
468 if (value2
) free (value2
);
469 if (value3
) free (value3
);
473 int parse_line (const char *line
)
475 char *a
, *b
, *key
, *value
;
477 /* Skip useless lines */
478 if ((line
[0] == '#') || (line
[0] == '\n')) return 0;
479 if (!(a
= strchr (line
, '='))) return 0;
481 /* overwrite '=' with '\0' */
486 /* overwrite '\n' with '\0' if '\n' present */
487 if ((b
= strchr (a
, '\n'))) b
[0] = '\0';
494 add_entry (key
, value
);
502 void config_finish ()
504 if (old_config_file
) save_config();
506 if (panel_config
->monitor
> (server
.nb_monitor
-1)) {
507 fprintf(stderr
, "tint2 exit : monitor %d not found.\n", panel_config
->monitor
+1);
511 if (!server
.monitor
[panel_config
->monitor
].width
|| !server
.monitor
[panel_config
->monitor
].height
)
512 fprintf(stderr
, "tint2 error : invalid monitor size.\n");
517 if (panel_config
->monitor
>= 0) {
519 panel1
= calloc(nb_panel
, sizeof(Panel
));
520 memcpy(panel1
, panel_config
, sizeof(Panel
));
524 nb_panel
= server
.nb_monitor
;
525 panel1
= calloc(nb_panel
, sizeof(Panel
));
527 for (i
=0 ; i
< nb_panel
; i
++) {
528 memcpy(&panel1
[i
], panel_config
, sizeof(Panel
));
529 panel1
[i
].monitor
= i
;
537 task_refresh_tasklist();
539 // XFlush (server.dsp);
547 const gchar
* const * system_dirs
;
548 char *path1
, *path2
, *dir
;
551 // check tint2rc file according to XDG specification
552 path1
= g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL
);
553 if (!g_file_test (path1
, G_FILE_TEST_EXISTS
)) {
556 system_dirs
= g_get_system_config_dirs();
557 for (i
= 0; system_dirs
[i
]; i
++) {
558 path2
= g_build_filename(system_dirs
[i
], "tint2", "tint2rc", NULL
);
560 if (g_file_test(path2
, G_FILE_TEST_EXISTS
)) break;
566 // copy file in user directory (path1)
567 dir
= g_build_filename (g_get_user_config_dir(), "tint2", NULL
);
568 if (!g_file_test (dir
, G_FILE_TEST_IS_DIR
)) g_mkdir(dir
, 0777);
571 copy_file(path2
, path1
);
576 i
= config_read_file (path1
);
582 int config_read_file (const char *path
)
587 if ((fp
= fopen(path
, "r")) == NULL
) return 0;
589 while (fgets(line
, sizeof(line
), fp
) != NULL
)
600 fprintf(stderr, "tint2 warning : convert user's config file\n");
601 panel.area.paddingx = panel.area.paddingy = panel.marginx;
602 panel.marginx = panel.marginy = 0;
604 if (old_task_icon == 0) g_task.icon_size1 = 0;
605 if (old_panel_background == 0) panel.area.pix.back.alpha = 0;
606 if (old_task_background == 0) {
607 g_task.area.pix.back.alpha = 0;
608 g_task.area.pix_active.back.alpha = 0;
610 g_task.area.pix.border.rounded = g_task.area.pix.border.rounded / 2;
611 g_task.area.pix_active.border.rounded = g_task.area.pix.border.rounded;
612 panel.area.pix.border.rounded = panel.area.pix.border.rounded / 2;
617 path = g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL);
618 fp = fopen(path, "w");
620 if (fp == NULL) return;
622 fputs("#---------------------------------------------\n", fp);
623 fputs("# TINT CONFIG FILE\n", fp);
624 fputs("#---------------------------------------------\n\n", fp);
625 fputs("#---------------------------------------------\n", fp);
626 fputs("# PANEL\n", fp);
627 fputs("#---------------------------------------------\n", fp);
628 if (panel_mode == SINGLE_DESKTOP) fputs("panel_mode = single_desktop\n", fp);
629 else fputs("panel_mode = multi_desktop\n", fp);
630 fputs("panel_monitor = 1\n", fp);
631 if (panel_position & BOTTOM) fputs("panel_position = bottom", fp);
632 else fputs("panel_position = top", fp);
633 if (panel_position & LEFT) fputs(" left\n", fp);
634 else if (panel_position & RIGHT) fputs(" right\n", fp);
635 else fputs(" center\n", fp);
636 fprintf(fp, "panel_size = %d %d\n", panel.area.width, panel.area.height);
637 fprintf(fp, "panel_margin = %d %d\n", panel.marginx, panel.marginy);
638 fprintf(fp, "panel_padding = %d %d\n", panel.area.paddingx, panel.area.paddingy);
639 fprintf(fp, "font_shadow = %d\n", g_task.font_shadow);
641 fputs("\n#---------------------------------------------\n", fp);
642 fputs("# PANEL BACKGROUND AND BORDER\n", fp);
643 fputs("#---------------------------------------------\n", fp);
644 fprintf(fp, "panel_rounded = %d\n", panel.area.pix.border.rounded);
645 fprintf(fp, "panel_border_width = %d\n", panel.area.pix.border.width);
646 fprintf(fp, "panel_background_color = #%02x%02x%02x %d\n", (int)(panel.area.pix.back.color[0]*255), (int)(panel.area.pix.back.color[1]*255), (int)(panel.area.pix.back.color[2]*255), (int)(panel.area.pix.back.alpha*100));
647 fprintf(fp, "panel_border_color = #%02x%02x%02x %d\n", (int)(panel.area.pix.border.color[0]*255), (int)(panel.area.pix.border.color[1]*255), (int)(panel.area.pix.border.color[2]*255), (int)(panel.area.pix.border.alpha*100));
649 fputs("\n#---------------------------------------------\n", fp);
650 fputs("# TASKS\n", fp);
651 fputs("#---------------------------------------------\n", fp);
652 fprintf(fp, "task_centered = %d\n", g_task.centered);
653 fprintf(fp, "task_width = %d\n", g_task.maximum_width);
654 fprintf(fp, "task_padding = %d\n", g_task.area.paddingx);
655 fprintf(fp, "task_icon = %d\n", g_task.icon);
656 fprintf(fp, "task_font = %s\n", old_task_font);
657 fprintf(fp, "task_font_color = #%02x%02x%02x %d\n", (int)(g_task.font.color[0]*255), (int)(g_task.font.color[1]*255), (int)(g_task.font.color[2]*255), (int)(g_task.font.alpha*100));
658 fprintf(fp, "task_active_font_color = #%02x%02x%02x %d\n", (int)(g_task.font_active.color[0]*255), (int)(g_task.font_active.color[1]*255), (int)(g_task.font_active.color[2]*255), (int)(g_task.font_active.alpha*100));
660 fputs("\n#---------------------------------------------\n", fp);
661 fputs("# TASK BACKGROUND AND BORDER\n", fp);
662 fputs("#---------------------------------------------\n", fp);
663 fprintf(fp, "task_rounded = %d\n", g_task.area.pix.border.rounded);
664 fprintf(fp, "task_background_color = #%02x%02x%02x %d\n", (int)(g_task.area.pix.back.color[0]*255), (int)(g_task.area.pix.back.color[1]*255), (int)(g_task.area.pix.back.color[2]*255), (int)(g_task.area.pix.back.alpha*100));
665 fprintf(fp, "task_active_background_color = #%02x%02x%02x %d\n", (int)(g_task.area.pix_active.back.color[0]*255), (int)(g_task.area.pix_active.back.color[1]*255), (int)(g_task.area.pix_active.back.color[2]*255), (int)(g_task.area.pix_active.back.alpha*100));
666 fprintf(fp, "task_border_width = %d\n", g_task.area.pix.border.width);
667 fprintf(fp, "task_border_color = #%02x%02x%02x %d\n", (int)(g_task.area.pix.border.color[0]*255), (int)(g_task.area.pix.border.color[1]*255), (int)(g_task.area.pix.border.color[2]*255), (int)(g_task.area.pix.border.alpha*100));
668 fprintf(fp, "task_active_border_color = #%02x%02x%02x %d\n", (int)(g_task.area.pix_active.border.color[0]*255), (int)(g_task.area.pix_active.border.color[1]*255), (int)(g_task.area.pix_active.border.color[2]*255), (int)(g_task.area.pix_active.border.alpha*100));
670 fputs("\n#---------------------------------------------\n", fp);
671 fputs("# CLOCK\n", fp);
672 fputs("#---------------------------------------------\n", fp);
673 fputs("#time1_format = %H:%M\n", fp);
674 fputs("time1_font = sans bold 8\n", fp);
675 fputs("#time2_format = %A %d %B\n", fp);
676 fputs("time2_font = sans 6\n", fp);
677 fputs("clock_font_color = #ffffff 75\n", fp);
679 fputs("\n#---------------------------------------------\n", fp);
680 fputs("# MOUSE ACTION ON TASK\n", fp);
681 fputs("#---------------------------------------------\n", fp);
682 if (mouse_middle == NONE) fputs("mouse_middle = none\n", fp);
683 else if (mouse_middle == CLOSE) fputs("mouse_middle = close\n", fp);
684 else if (mouse_middle == TOGGLE) fputs("mouse_middle = toggle\n", fp);
685 else if (mouse_middle == ICONIFY) fputs("mouse_middle = iconify\n", fp);
686 else if (mouse_middle == SHADE) fputs("mouse_middle = shade\n", fp);
687 else fputs("mouse_middle = toggle_iconify\n", fp);
689 if (mouse_right == NONE) fputs("mouse_right = none\n", fp);
690 else if (mouse_right == CLOSE) fputs("mouse_right = close\n", fp);
691 else if (mouse_right == TOGGLE) fputs("mouse_right = toggle\n", fp);
692 else if (mouse_right == ICONIFY) fputs("mouse_right = iconify\n", fp);
693 else if (mouse_right == SHADE) fputs("mouse_right = shade\n", fp);
694 else fputs("mouse_right = toggle_iconify\n", fp);
696 if (mouse_scroll_up == NONE) fputs("mouse_scroll_up = none\n", fp);
697 else if (mouse_scroll_up == CLOSE) fputs("mouse_scroll_up = close\n", fp);
698 else if (mouse_scroll_up == TOGGLE) fputs("mouse_scroll_up = toggle\n", fp);
699 else if (mouse_scroll_up == ICONIFY) fputs("mouse_scroll_up = iconify\n", fp);
700 else if (mouse_scroll_up == SHADE) fputs("mouse_scroll_up = shade\n", fp);
701 else fputs("mouse_scroll_up = toggle_iconify\n", fp);
703 if (mouse_scroll_down == NONE) fputs("mouse_scroll_down = none\n", fp);
704 else if (mouse_scroll_down == CLOSE) fputs("mouse_scroll_down = close\n", fp);
705 else if (mouse_scroll_down == TOGGLE) fputs("mouse_scroll_down = toggle\n", fp);
706 else if (mouse_scroll_down == ICONIFY) fputs("mouse_scroll_down = iconify\n", fp);
707 else if (mouse_scroll_down == SHADE) fputs("mouse_scroll_down = shade\n", fp);
708 else fputs("mouse_scroll_down = toggle_iconify\n", fp);
This page took 0.071505 seconds and 3 git commands to generate.