]>
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>
47 void cleanup_taskbar()
52 for (l0
= panel
.area
.list
; l0
; l0
= l0
->next
) {
55 for (l1
= tskbar
->area
.list
; l1
; l1
= l1
->next
) {
59 g_slist_free(tskbar
->area
.list
);
61 g_slist_free(panel
.area
.list
);
68 if (panel
.old_task_font
) free(panel
.old_task_font
);
69 if (g_task
.font_desc
) pango_font_description_free(g_task
.font_desc
);
70 if (panel
.clock
.time1_font_desc
) pango_font_description_free(panel
.clock
.time1_font_desc
);
71 if (panel
.clock
.time2_font_desc
) pango_font_description_free(panel
.clock
.time2_font_desc
);
73 if (panel
.clock
.time1_format
) g_free(panel
.clock
.time1_format
);
74 if (panel
.clock
.time2_format
) g_free(panel
.clock
.time2_format
);
75 if (server
.monitor
) free(server
.monitor
);
76 XCloseDisplay(server
.dsp
);
80 void copy_file(const char *pathSrc
, const char *pathDest
)
82 FILE *fileSrc
, *fileDest
;
86 fileSrc
= fopen(pathSrc
, "rb");
87 if (fileSrc
== NULL
) return;
89 fileDest
= fopen(pathDest
, "wb");
90 if (fileDest
== NULL
) return;
92 while ((nb
= fread(line
, 1, 100, fileSrc
)) > 0) fwrite(line
, 1, nb
, fileDest
);
99 void extract_values (const char *value
, char **value1
, char **value2
)
103 if (*value1
) free (*value1
);
104 if (*value2
) free (*value2
);
106 if ((b
= strchr (value
, ' '))) {
109 *value2
= strdup (b
);
114 *value1
= strdup (value
);
119 int hex_char_to_int (char c
)
123 if (c
>= '0' && c
<= '9') r
= c
- '0';
124 else if (c
>= 'a' && c
<= 'f') r
= c
- 'a' + 10;
125 else if (c
>= 'A' && c
<= 'F') r
= c
- 'A' + 10;
132 int hex_to_rgb (char *hex
, int *r
, int *g
, int *b
)
136 if (hex
== NULL
|| hex
[0] != '#') return (0);
140 *r
= hex_char_to_int (hex
[1]);
141 *g
= hex_char_to_int (hex
[2]);
142 *b
= hex_char_to_int (hex
[3]);
144 else if (len
== 6 + 1) {
145 *r
= hex_char_to_int (hex
[1]) * 16 + hex_char_to_int (hex
[2]);
146 *g
= hex_char_to_int (hex
[3]) * 16 + hex_char_to_int (hex
[4]);
147 *b
= hex_char_to_int (hex
[5]) * 16 + hex_char_to_int (hex
[6]);
149 else if (len
== 12 + 1) {
150 *r
= hex_char_to_int (hex
[1]) * 16 + hex_char_to_int (hex
[2]);
151 *g
= hex_char_to_int (hex
[5]) * 16 + hex_char_to_int (hex
[6]);
152 *b
= hex_char_to_int (hex
[9]) * 16 + hex_char_to_int (hex
[10]);
160 void get_color (char *hex
, double *rgb
)
163 hex_to_rgb (hex
, &r
, &g
, &b
);
165 rgb
[0] = (r
/ 255.0);
166 rgb
[1] = (g
/ 255.0);
167 rgb
[2] = (b
/ 255.0);
171 void get_action (char *event
, int *action
)
173 if (strcmp (event
, "none") == 0)
175 else if (strcmp (event
, "close") == 0)
177 else if (strcmp (event
, "toggle") == 0)
179 else if (strcmp (event
, "iconify") == 0)
181 else if (strcmp (event
, "shade") == 0)
183 else if (strcmp (event
, "toggle_iconify") == 0)
184 *action
= TOGGLE_ICONIFY
;
188 void add_entry (char *key
, char *value
)
190 char *value1
=0, *value2
=0;
192 /* Background and border */
193 if (strcmp (key
, "rounded") == 0) {
194 // 'rounded' is the first parameter => alloc a new background
195 Area
*back
= calloc(1, sizeof(Area
));
196 back
->border
.rounded
= atoi (value
);
197 list_back
= g_slist_append(list_back
, back
);
199 else if (strcmp (key
, "border_width") == 0) {
200 Area
*back
= g_slist_last(list_back
)->data
;
201 back
->border
.width
= atoi (value
);
203 else if (strcmp (key
, "background_color") == 0) {
204 Area
*back
= g_slist_last(list_back
)->data
;
205 extract_values(value
, &value1
, &value2
);
206 get_color (value1
, back
->back
.color
);
207 if (value2
) back
->back
.alpha
= (atoi (value2
) / 100.0);
208 else back
->back
.alpha
= 0.5;
210 else if (strcmp (key
, "border_color") == 0) {
211 Area
*back
= g_slist_last(list_back
)->data
;
212 extract_values(value
, &value1
, &value2
);
213 get_color (value1
, back
->border
.color
);
214 if (value2
) back
->border
.alpha
= (atoi (value2
) / 100.0);
215 else back
->border
.alpha
= 0.5;
219 else if (strcmp (key
, "panel_monitor") == 0) {
220 panel
.monitor
= atoi (value
);
221 if (panel
.monitor
> 0) panel
.monitor
-= 1;
223 else if (strcmp (key
, "panel_size") == 0) {
224 extract_values(value
, &value1
, &value2
);
225 panel
.area
.width
= atoi (value1
);
226 if (value2
) panel
.area
.height
= atoi (value2
);
228 else if (strcmp (key
, "panel_margin") == 0) {
229 extract_values(value
, &value1
, &value2
);
230 panel
.marginx
= atoi (value1
);
231 if (value2
) panel
.marginy
= atoi (value2
);
233 else if (strcmp (key
, "panel_padding") == 0) {
234 extract_values(value
, &value1
, &value2
);
235 panel
.area
.paddingx
= atoi (value1
);
236 if (value2
) panel
.area
.paddingy
= atoi (value2
);
238 else if (strcmp (key
, "panel_position") == 0) {
239 extract_values(value
, &value1
, &value2
);
240 if (strcmp (value1
, "top") == 0) panel
.position
= TOP
;
241 else panel
.position
= BOTTOM
;
243 if (!value2
) panel
.position
= CENTER
;
245 if (strcmp (value2
, "left") == 0) panel
.position
|= LEFT
;
247 if (strcmp (value2
, "right") == 0) panel
.position
|= RIGHT
;
248 else panel
.position
|= CENTER
;
252 else if (strcmp (key
, "font_shadow") == 0)
253 g_task
.font_shadow
= atoi (value
);
254 else if (strcmp (key
, "panel_background_id") == 0) {
255 int id
= atoi (value
);
256 Area
*back
= g_slist_nth_data(list_back
, id
);
257 memcpy(&panel
.area
.back
, &back
->back
, sizeof(Color
));
258 memcpy(&panel
.area
.border
, &back
->border
, sizeof(Border
));
262 else if (strcmp (key
, "time1_format") == 0) {
263 if (panel
.clock
.time1_format
) g_free(panel
.clock
.time1_format
);
264 if (strlen(value
) > 0) panel
.clock
.time1_format
= strdup (value
);
265 else panel
.clock
.time1_format
= 0;
267 else if (strcmp (key
, "time2_format") == 0) {
268 if (panel
.clock
.time2_format
) g_free(panel
.clock
.time2_format
);
269 if (strlen(value
) > 0) panel
.clock
.time2_format
= strdup (value
);
270 else panel
.clock
.time2_format
= 0;
272 else if (strcmp (key
, "time1_font") == 0) {
273 if (panel
.clock
.time1_font_desc
) pango_font_description_free(panel
.clock
.time1_font_desc
);
274 panel
.clock
.time1_font_desc
= pango_font_description_from_string (value
);
276 else if (strcmp (key
, "time2_font") == 0) {
277 if (panel
.clock
.time2_font_desc
) pango_font_description_free(panel
.clock
.time2_font_desc
);
278 panel
.clock
.time2_font_desc
= pango_font_description_from_string (value
);
280 else if (strcmp (key
, "clock_font_color") == 0) {
281 extract_values(value
, &value1
, &value2
);
282 get_color (value1
, panel
.clock
.font
.color
);
283 if (value2
) panel
.clock
.font
.alpha
= (atoi (value2
) / 100.0);
284 else panel
.clock
.font
.alpha
= 0.1;
286 else if (strcmp (key
, "clock_padding") == 0) {
287 extract_values(value
, &value1
, &value2
);
288 panel
.clock
.area
.paddingx
= atoi (value1
);
289 if (value2
) panel
.clock
.area
.paddingy
= atoi (value2
);
291 else if (strcmp (key
, "clock_background_id") == 0) {
292 int id
= atoi (value
);
293 Area
*back
= g_slist_nth_data(list_back
, id
);
294 memcpy(&panel
.clock
.area
.back
, &back
->back
, sizeof(Color
));
295 memcpy(&panel
.clock
.area
.border
, &back
->border
, sizeof(Border
));
299 else if (strcmp (key
, "taskbar_mode") == 0) {
300 if (strcmp (value
, "multi_desktop") == 0) panel
.mode
= MULTI_DESKTOP
;
301 else if (strcmp (value
, "multi_monitor") == 0) panel
.mode
= MULTI_MONITOR
;
302 else panel
.mode
= SINGLE_DESKTOP
;
304 else if (strcmp (key
, "taskbar_padding") == 0) {
305 extract_values(value
, &value1
, &value2
);
306 g_taskbar
.paddingx
= atoi (value1
);
307 if (value2
) g_taskbar
.paddingy
= atoi (value2
);
309 else if (strcmp (key
, "taskbar_background_id") == 0) {
310 int id
= atoi (value
);
311 Area
*back
= g_slist_nth_data(list_back
, id
);
312 memcpy(&g_taskbar
.back
, &back
->back
, sizeof(Color
));
313 memcpy(&g_taskbar
.border
, &back
->border
, sizeof(Border
));
317 else if (strcmp (key
, "task_text") == 0)
318 g_task
.text
= atoi (value
);
319 else if (strcmp (key
, "task_icon") == 0)
320 g_task
.icon
= atoi (value
);
321 else if (strcmp (key
, "task_centered") == 0)
322 g_task
.centered
= atoi (value
);
323 else if (strcmp (key
, "task_width") == 0)
324 g_task
.maximum_width
= atoi (value
);
325 else if (strcmp (key
, "task_padding") == 0) {
326 extract_values(value
, &value1
, &value2
);
327 g_task
.area
.paddingx
= atoi (value1
);
328 g_task
.area_active
.paddingx
= atoi (value1
);
330 g_task
.area
.paddingy
= atoi (value2
);
331 g_task
.area_active
.paddingy
= atoi (value2
);
334 else if (strcmp (key
, "task_font") == 0) {
335 if (g_task
.font_desc
) pango_font_description_free(g_task
.font_desc
);
336 g_task
.font_desc
= pango_font_description_from_string (value
);
338 else if (strcmp (key
, "task_font_color") == 0) {
339 extract_values(value
, &value1
, &value2
);
340 get_color (value1
, g_task
.font
.color
);
341 if (value2
) g_task
.font
.alpha
= (atoi (value2
) / 100.0);
342 else g_task
.font
.alpha
= 0.1;
344 else if (strcmp (key
, "task_active_font_color") == 0) {
345 extract_values(value
, &value1
, &value2
);
346 get_color (value1
, g_task
.font_active
.color
);
347 if (value2
) g_task
.font_active
.alpha
= (atoi (value2
) / 100.0);
348 else g_task
.font_active
.alpha
= 0.1;
350 else if (strcmp (key
, "task_background_id") == 0) {
351 int id
= atoi (value
);
352 Area
*back
= g_slist_nth_data(list_back
, id
);
353 memcpy(&g_task
.area
.back
, &back
->back
, sizeof(Color
));
354 memcpy(&g_task
.area
.border
, &back
->border
, sizeof(Border
));
356 else if (strcmp (key
, "task_active_background_id") == 0) {
357 int id
= atoi (value
);
358 Area
*back
= g_slist_nth_data(list_back
, id
);
359 memcpy(&g_task
.area_active
.back
, &back
->back
, sizeof(Color
));
360 memcpy(&g_task
.area_active
.border
, &back
->border
, sizeof(Border
));
364 else if (strcmp (key
, "mouse_middle") == 0)
365 get_action (value
, &panel
.mouse_middle
);
366 else if (strcmp (key
, "mouse_right") == 0)
367 get_action (value
, &panel
.mouse_right
);
368 else if (strcmp (key
, "mouse_scroll_up") == 0)
369 get_action (value
, &panel
.mouse_scroll_up
);
370 else if (strcmp (key
, "mouse_scroll_down") == 0)
371 get_action (value
, &panel
.mouse_scroll_down
);
374 /* Read old config for backward compatibility */
375 else if (strcmp (key
, "font") == 0) {
376 panel
.old_config_file
= 1;
377 if (g_task
.font_desc
) pango_font_description_free(g_task
.font_desc
);
378 g_task
.font_desc
= pango_font_description_from_string (value
);
379 if (panel
.old_task_font
) free(panel
.old_task_font
);
380 panel
.old_task_font
= strdup (value
);
382 else if (strcmp (key
, "font_color") == 0)
383 get_color (value
, g_task
.font
.color
);
384 else if (strcmp (key
, "font_alpha") == 0)
385 g_task
.font
.alpha
= (atoi (value
) / 100.0);
386 else if (strcmp (key
, "font_active_color") == 0)
387 get_color (value
, g_task
.font_active
.color
);
388 else if (strcmp (key
, "font_active_alpha") == 0)
389 g_task
.font_active
.alpha
= (atoi (value
) / 100.0);
390 else if (strcmp (key
, "panel_show_all_desktop") == 0) {
391 if (atoi (value
) == 0) panel
.mode
= SINGLE_DESKTOP
;
392 else panel
.mode
= MULTI_DESKTOP
;
394 else if (strcmp (key
, "panel_width") == 0)
395 panel
.area
.width
= atoi (value
);
396 else if (strcmp (key
, "panel_height") == 0)
397 panel
.area
.height
= atoi (value
);
398 else if (strcmp (key
, "panel_background") == 0)
399 panel
.old_panel_background
= atoi (value
);
400 else if (strcmp (key
, "panel_background_alpha") == 0)
401 panel
.area
.back
.alpha
= (atoi (value
) / 100.0);
402 else if (strcmp (key
, "panel_border_alpha") == 0)
403 panel
.area
.border
.alpha
= (atoi (value
) / 100.0);
404 else if (strcmp (key
, "task_icon") == 0)
405 panel
.old_task_icon
= atoi (value
);
406 else if (strcmp (key
, "task_background") == 0)
407 panel
.old_task_background
= atoi (value
);
408 else if (strcmp (key
, "task_background_alpha") == 0)
409 g_task
.area
.back
.alpha
= (atoi (value
) / 100.0);
410 else if (strcmp (key
, "task_active_background_alpha") == 0)
411 g_task
.area_active
.back
.alpha
= (atoi (value
) / 100.0);
412 else if (strcmp (key
, "task_border_alpha") == 0)
413 g_task
.area
.border
.alpha
= (atoi (value
) / 100.0);
414 else if (strcmp (key
, "task_active_border_alpha") == 0)
415 g_task
.area_active
.border
.alpha
= (atoi (value
) / 100.0);
416 // disabled parameters
417 else if (strcmp (key
, "task_active_border_width") == 0) ;
418 else if (strcmp (key
, "task_active_rounded") == 0) ;
421 fprintf(stderr
, "Invalid option: \"%s\", correct your config file\n", key
);
423 if (value1
) free (value1
);
424 if (value2
) free (value2
);
428 int parse_line (const char *line
)
430 char *a
, *b
, *key
, *value
;
432 /* Skip useless lines */
433 if ((line
[0] == '#') || (line
[0] == '\n')) return 0;
434 if (!(a
= strchr (line
, '='))) return 0;
436 /* overwrite '=' with '\0' */
441 /* overwrite '\n' with '\0' if '\n' present */
442 if ((b
= strchr (a
, '\n'))) b
[0] = '\0';
449 add_entry (key
, value
);
457 void config_taskbar()
461 if (g_task
.area
.border
.rounded
> g_task
.area
.height
/2) {
462 g_task
.area
.border
.rounded
= g_task
.area
.height
/2;
463 g_task
.area_active
.border
.rounded
= g_task
.area
.border
.rounded
;
466 for (i
=0 ; i
< 15 ; i
++) {
467 server
.nb_desktop
= server_get_number_of_desktop ();
468 if (server
.nb_desktop
> 0) break;
471 if (server
.nb_desktop
== 0) {
472 server
.nb_desktop
= 1;
473 fprintf(stderr
, "tint2 warning : cannot found number of desktop.\n");
478 panel
.nb_desktop
= server
.nb_desktop
;
479 if (panel
.mode
== MULTI_MONITOR
) panel
.nb_monitor
= server
.nb_monitor
;
480 else panel
.nb_monitor
= 1;
482 // TODO: mémoriser le pointeur sur la première
483 // malgré l'apparant désordre, les taskbars sont ordonnées
485 for (i
=0 ; i
< panel
.nb_desktop
; i
++) {
486 for (j
=0 ; j
< panel
.nb_monitor
; j
++) {
487 new_tskbar
= calloc(1, sizeof(Taskbar
));
488 memcpy(&new_tskbar
->area
, &g_taskbar
, sizeof(Area
));
489 new_tskbar
->desktop
= i
;
490 new_tskbar
->monitor
= j
;
492 panel
.area
.list
= g_slist_append(panel
.area
.list
, new_tskbar
);
496 comment faire pour parcourir les barres de taches ? on ne peut pas se baser sur l'ordre des éléments !!
497 a t'on besoin de parcourir les barres de taches ?? OUI !! bof ??
498 => resize_taskbar() dans panel.c =>
499 => task_refresh_tasklist () dans taskbar.c
500 => Task *task_get_task (Window win) dans taskbar.c
501 => event_button_press (int x, int y) dans tint.c => area->event_button_press() est conseillé !!
502 cela enlève aussi l'organisation des barres de taches en tableau à 2 dimensions
503 il est possible de mémoriser un pointeur sur la première barre de taches
506 //printf("tasbar (desktop x monitor) : (%d x %d)\n", panel.nb_desktop, panel.nb_monitor);
508 task_refresh_tasklist ();
513 void config_finish ()
515 int height_ink
, height
;
517 if (panel
.old_config_file
) save_config();
519 // get monitor's configuration
522 if (panel
.monitor
> (server
.nb_monitor
-1)) {
523 panel
.sleep_mode
= 1;
524 printf("tint2 sleep and wait monitor %d.\n", panel
.monitor
+1);
527 panel
.sleep_mode
= 0;
528 //printf("tint2 wake up on monitor %d\n", panel.monitor+1);
529 if (!server
.monitor
[panel
.monitor
].width
|| !server
.monitor
[panel
.monitor
].height
)
530 fprintf(stderr
, "tint2 error : invalid monitor size.\n");
533 if (!panel
.area
.width
) panel
.area
.width
= server
.monitor
[panel
.monitor
].width
;
536 g_taskbar
.posy
= panel
.area
.border
.width
+ panel
.area
.paddingy
;
537 g_taskbar
.height
= panel
.area
.height
- (2 * g_taskbar
.posy
);
538 g_taskbar
.redraw
= 1;
541 g_task
.area
.posy
= g_taskbar
.posy
+ g_taskbar
.border
.width
+ g_taskbar
.paddingy
;
542 g_task
.area_active
.posy
= g_task
.area
.posy
;
543 g_task
.area
.height
= panel
.area
.height
- (2 * g_task
.area
.posy
);
544 g_task
.area_active
.height
= g_task
.area
.height
;
545 g_task
.area
.redraw
= 1;
547 if (!g_task
.maximum_width
)
548 g_task
.maximum_width
= server
.monitor
[panel
.monitor
].width
;
550 if (panel
.area
.border
.rounded
> panel
.area
.height
/2)
551 panel
.area
.border
.rounded
= panel
.area
.height
/2;
554 panel
.clock
.area
.posy
= panel
.area
.border
.width
+ panel
.area
.paddingy
;
555 panel
.clock
.area
.height
= panel
.area
.height
- (2 * panel
.clock
.area
.posy
);
556 panel
.clock
.area
.redraw
= 1;
557 init_clock(&panel
.clock
, panel
.area
.height
);
559 // compute vertical position : text and icon
560 get_text_size(g_task
.font_desc
, &height_ink
, &height
, panel
.area
.height
, "TAjpg", 5);
561 g_task
.text_posy
= (g_task
.area
.height
- height
) / 2.0;
563 // add task_icon_size
564 g_task
.text_posx
= g_task
.area
.paddingx
+ g_task
.area
.border
.width
;
566 g_task
.icon_size1
= g_task
.area
.height
- (2 * g_task
.area
.paddingy
);
567 g_task
.text_posx
+= g_task
.icon_size1
;
568 g_task
.icon_posy
= (g_task
.area
.height
- g_task
.icon_size1
) / 2;
573 // cleanup background list
575 for (l0
= list_back
; l0
; l0
= l0
->next
) {
578 g_slist_free(list_back
);
584 const gchar
* const * system_dirs
;
585 char *path1
, *path2
, *dir
;
588 // check tint2rc file according to XDG specification
589 path1
= g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL
);
590 if (!g_file_test (path1
, G_FILE_TEST_EXISTS
)) {
593 system_dirs
= g_get_system_config_dirs();
594 for (i
= 0; system_dirs
[i
]; i
++) {
595 path2
= g_build_filename(system_dirs
[i
], "tint2", "tint2rc", NULL
);
597 if (g_file_test(path2
, G_FILE_TEST_EXISTS
)) break;
603 // copy file in user directory (path1)
604 dir
= g_build_filename (g_get_user_config_dir(), "tint2", NULL
);
605 if (!g_file_test (dir
, G_FILE_TEST_IS_DIR
)) g_mkdir(dir
, 0777);
608 copy_file(path2
, path1
);
613 i
= config_read_file (path1
);
619 int config_read_file (const char *path
)
624 if ((fp
= fopen(path
, "r")) == NULL
) return 0;
626 while (fgets(line
, sizeof(line
), fp
) != NULL
)
636 fprintf(stderr
, "tint2 warning : convert user's config file\n");
637 panel
.area
.paddingx
= panel
.area
.paddingy
= panel
.marginx
;
638 panel
.marginx
= panel
.marginy
= 0;
640 if (panel
.old_task_icon
== 0) g_task
.icon_size1
= 0;
641 if (panel
.old_panel_background
== 0) panel
.area
.back
.alpha
= 0;
642 if (panel
.old_task_background
== 0) {
643 g_task
.area
.back
.alpha
= 0;
644 g_task
.area_active
.back
.alpha
= 0;
646 g_task
.area
.border
.rounded
= g_task
.area
.border
.rounded
/ 2;
647 g_task
.area_active
.border
.rounded
= g_task
.area
.border
.rounded
;
648 panel
.area
.border
.rounded
= panel
.area
.border
.rounded
/ 2;
653 path
= g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL
);
654 fp
= fopen(path
, "w");
656 if (fp
== NULL
) return;
658 fputs("#---------------------------------------------\n", fp
);
659 fputs("# TINT CONFIG FILE\n", fp
);
660 fputs("#---------------------------------------------\n\n", fp
);
661 fputs("#---------------------------------------------\n", fp
);
662 fputs("# PANEL\n", fp
);
663 fputs("#---------------------------------------------\n", fp
);
664 if (panel
.mode
== SINGLE_DESKTOP
) fputs("panel_mode = single_desktop\n", fp
);
665 else fputs("panel_mode = multi_desktop\n", fp
);
666 fputs("panel_monitor = 1\n", fp
);
667 if (panel
.position
& BOTTOM
) fputs("panel_position = bottom", fp
);
668 else fputs("panel_position = top", fp
);
669 if (panel
.position
& LEFT
) fputs(" left\n", fp
);
670 else if (panel
.position
& RIGHT
) fputs(" right\n", fp
);
671 else fputs(" center\n", fp
);
672 fprintf(fp
, "panel_size = %d %d\n", panel
.area
.width
, panel
.area
.height
);
673 fprintf(fp
, "panel_margin = %d %d\n", panel
.marginx
, panel
.marginy
);
674 fprintf(fp
, "panel_padding = %d %d\n", panel
.area
.paddingx
, panel
.area
.paddingy
);
675 fprintf(fp
, "font_shadow = %d\n", g_task
.font_shadow
);
677 fputs("\n#---------------------------------------------\n", fp
);
678 fputs("# PANEL BACKGROUND AND BORDER\n", fp
);
679 fputs("#---------------------------------------------\n", fp
);
680 fprintf(fp
, "panel_rounded = %d\n", panel
.area
.border
.rounded
);
681 fprintf(fp
, "panel_border_width = %d\n", panel
.area
.border
.width
);
682 fprintf(fp
, "panel_background_color = #%02x%02x%02x %d\n", (int)(panel
.area
.back
.color
[0]*255), (int)(panel
.area
.back
.color
[1]*255), (int)(panel
.area
.back
.color
[2]*255), (int)(panel
.area
.back
.alpha
*100));
683 fprintf(fp
, "panel_border_color = #%02x%02x%02x %d\n", (int)(panel
.area
.border
.color
[0]*255), (int)(panel
.area
.border
.color
[1]*255), (int)(panel
.area
.border
.color
[2]*255), (int)(panel
.area
.border
.alpha
*100));
685 fputs("\n#---------------------------------------------\n", fp
);
686 fputs("# TASKS\n", fp
);
687 fputs("#---------------------------------------------\n", fp
);
688 fprintf(fp
, "task_centered = %d\n", g_task
.centered
);
689 fprintf(fp
, "task_width = %d\n", g_task
.maximum_width
);
690 fprintf(fp
, "task_padding = %d\n", g_task
.area
.paddingx
);
691 fprintf(fp
, "task_icon = %d\n", g_task
.icon
);
692 fprintf(fp
, "task_font = %s\n", panel
.old_task_font
);
693 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));
694 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));
696 fputs("\n#---------------------------------------------\n", fp
);
697 fputs("# TASK BACKGROUND AND BORDER\n", fp
);
698 fputs("#---------------------------------------------\n", fp
);
699 fprintf(fp
, "task_rounded = %d\n", g_task
.area
.border
.rounded
);
700 fprintf(fp
, "task_background_color = #%02x%02x%02x %d\n", (int)(g_task
.area
.back
.color
[0]*255), (int)(g_task
.area
.back
.color
[1]*255), (int)(g_task
.area
.back
.color
[2]*255), (int)(g_task
.area
.back
.alpha
*100));
701 fprintf(fp
, "task_active_background_color = #%02x%02x%02x %d\n", (int)(g_task
.area_active
.back
.color
[0]*255), (int)(g_task
.area_active
.back
.color
[1]*255), (int)(g_task
.area_active
.back
.color
[2]*255), (int)(g_task
.area_active
.back
.alpha
*100));
702 fprintf(fp
, "task_border_width = %d\n", g_task
.area
.border
.width
);
703 fprintf(fp
, "task_border_color = #%02x%02x%02x %d\n", (int)(g_task
.area
.border
.color
[0]*255), (int)(g_task
.area
.border
.color
[1]*255), (int)(g_task
.area
.border
.color
[2]*255), (int)(g_task
.area
.border
.alpha
*100));
704 fprintf(fp
, "task_active_border_color = #%02x%02x%02x %d\n", (int)(g_task
.area_active
.border
.color
[0]*255), (int)(g_task
.area_active
.border
.color
[1]*255), (int)(g_task
.area_active
.border
.color
[2]*255), (int)(g_task
.area_active
.border
.alpha
*100));
706 fputs("\n#---------------------------------------------\n", fp
);
707 fputs("# CLOCK\n", fp
);
708 fputs("#---------------------------------------------\n", fp
);
709 fputs("#time1_format = %H:%M\n", fp
);
710 fputs("time1_font = sans bold 8\n", fp
);
711 fputs("#time2_format = %A %d %B\n", fp
);
712 fputs("time2_font = sans 6\n", fp
);
713 fputs("clock_font_color = #ffffff 75\n", fp
);
715 fputs("\n#---------------------------------------------\n", fp
);
716 fputs("# MOUSE ACTION ON TASK\n", fp
);
717 fputs("#---------------------------------------------\n", fp
);
718 if (panel
.mouse_middle
== NONE
) fputs("mouse_middle = none\n", fp
);
719 else if (panel
.mouse_middle
== CLOSE
) fputs("mouse_middle = close\n", fp
);
720 else if (panel
.mouse_middle
== TOGGLE
) fputs("mouse_middle = toggle\n", fp
);
721 else if (panel
.mouse_middle
== ICONIFY
) fputs("mouse_middle = iconify\n", fp
);
722 else if (panel
.mouse_middle
== SHADE
) fputs("mouse_middle = shade\n", fp
);
723 else fputs("mouse_middle = toggle_iconify\n", fp
);
725 if (panel
.mouse_right
== NONE
) fputs("mouse_right = none\n", fp
);
726 else if (panel
.mouse_right
== CLOSE
) fputs("mouse_right = close\n", fp
);
727 else if (panel
.mouse_right
== TOGGLE
) fputs("mouse_right = toggle\n", fp
);
728 else if (panel
.mouse_right
== ICONIFY
) fputs("mouse_right = iconify\n", fp
);
729 else if (panel
.mouse_right
== SHADE
) fputs("mouse_right = shade\n", fp
);
730 else fputs("mouse_right = toggle_iconify\n", fp
);
732 if (panel
.mouse_scroll_up
== NONE
) fputs("mouse_scroll_up = none\n", fp
);
733 else if (panel
.mouse_scroll_up
== CLOSE
) fputs("mouse_scroll_up = close\n", fp
);
734 else if (panel
.mouse_scroll_up
== TOGGLE
) fputs("mouse_scroll_up = toggle\n", fp
);
735 else if (panel
.mouse_scroll_up
== ICONIFY
) fputs("mouse_scroll_up = iconify\n", fp
);
736 else if (panel
.mouse_scroll_up
== SHADE
) fputs("mouse_scroll_up = shade\n", fp
);
737 else fputs("mouse_scroll_up = toggle_iconify\n", fp
);
739 if (panel
.mouse_scroll_down
== NONE
) fputs("mouse_scroll_down = none\n", fp
);
740 else if (panel
.mouse_scroll_down
== CLOSE
) fputs("mouse_scroll_down = close\n", fp
);
741 else if (panel
.mouse_scroll_down
== TOGGLE
) fputs("mouse_scroll_down = toggle\n", fp
);
742 else if (panel
.mouse_scroll_down
== ICONIFY
) fputs("mouse_scroll_down = iconify\n", fp
);
743 else if (panel
.mouse_scroll_down
== SHADE
) fputs("mouse_scroll_down = shade\n", fp
);
744 else fputs("mouse_scroll_down = toggle_iconify\n", fp
);
749 panel
.old_config_file
= 0;
This page took 0.082173 seconds and 4 git commands to generate.