From: Thierry Lorthiois Date: Tue, 20 Jan 2009 21:16:54 +0000 (+0000) Subject: add another padding parameter in config file, update documentation and sample config... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=ad0010a813450116f875d943f36cd6c93d84cb04;p=chaz%2Ftint2 add another padding parameter in config file, update documentation and sample config file --- diff --git a/ChangeLog b/ChangeLog index 7e5d991..0ffd74f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ +2009-01-20 +- change config file format : add another padding parameter +- update documentation and sample config file + 2009-01-19 - patch from Robert Escriva, fixed tint2 on multi-monitor - fixed bug between MULTI_MONITOR mode and 'task on all desktop' @@ -38,7 +42,7 @@ user's background start with number 1, 2, ... 2008-09-22 -- better control on icon opacity +- better control on icon opacity icon opacity use the same value as text opacity 2008-09-21 @@ -48,23 +52,23 @@ 2008-09-19 - improve clock drawing on 2 lines -- new design : object oriented +- new design : object oriented clock inherit Area (with draw_background) - rename parameter 'panel_mode' in 'taskbar_mode' 2008-09-17 - change name from tint to tint2 because debian has already a package named tint -- new design : object oriented +- new design : object oriented tasks inherit Area taskbars inherit Area 2008-09-16 -- new design : object oriented +- new design : object oriented remove task_margin parameter, replaced by taskbar_padding fixed segfault with new layout 2008-09-04 -- new design : object oriented +- new design : object oriented all objects inherit from Area : panel, taskbar, task, clock 2008-09-02 licence changed to GPL V2 @@ -106,7 +110,7 @@ released tint-0.6 - update documentation 2008-07-04 -- changed in config file, panel_show_all_desktop +- changed in config file, panel_show_all_desktop replaced by panel_mode = single_desktop / multi_desktop / multi_monitor - with panel_mode = multi_monitor, tint show one taskbar by monitor @@ -120,24 +124,24 @@ released tint-0.6 2008-06-30 patch from goo...@dougbarton.us - tint wait for window manager on startup -2008-06-29 +2008-06-29 - specify monitor with parameter 'panel_monitor' - panel_position is relative to your monitor panel_monitor = 1 panel_position = bottom center -2008-06-24 +2008-06-24 - fixed bug : show tint on all desktop with fluxbox -2008-06-23 +2008-06-23 - task_width = 0 to get full taskbar width - added documentation in /doc -2008-06-16 +2008-06-16 - renamed parameter panel_margin to panel_padding - added parameter panel_margin = vertical_margin horizontal_margin -2008-06-15 +2008-06-15 - fixed bug : icon position changed when clock adjust width - removed boolean parameter panel_background and task_background replaced with opacity (alpha) = 0 @@ -145,51 +149,51 @@ released tint-0.6 identical to task_border_width - fixed bug : draw task below panel border -2008-06-11 +2008-06-11 - removed the need of desktop margin. tint specify margin to window magager (_NET_WM_STRUT) -2008-06-10 +2008-06-10 - fixed bug : time/date vertical and horizontal center 2008-06-10 patch from benjaminfranzke - fixed bug : draw icon on 64bit system. -2008-06-08 +2008-06-08 - fixed bug : in draw border and fill background -2008-06-04 +2008-06-04 - allow config file on the command line : tint -c ./tintrc2 - allow 2 value in config file : key = value1 value2 - panel_margin can get 2 values : vertical_margin horizontal_margin panel_margin = 8 4 -2008-05-30 +2008-05-30 - put panel below other window - set locale LANG -2008-05-28 +2008-05-28 - clock_width adjust automatically - configure : time2_format see 'man strftime' -2008-05-27 +2008-05-27 - configure : time1_format see 'man strftime' - cleanup code : refresh_pos() -2008-05-26 +2008-05-26 - catch time event in main loop - draw clock fixed format %H:%M -2008-05-24 +2008-05-24 - removed boolean parameter task_icon task_icon_size = 0 replace task_icon = 0 - all colors parameters can get 2 values : color and opacity (alpha) font_color = #ffffff 70 -2008-05-23 +2008-05-23 - cpu optimisation : limit call to visual_refresh() -2008-05-22 +2008-05-22 - configure clock : clock_font, clock_font_color @@ -197,7 +201,7 @@ released tint-0.6 2008-05-20 thil7 released tint-0.5 -2008-05-19 +2008-05-19 - improve usability in mode 'show_all_desktop' -> don't switch desktop when close a task of another desktop -> allow to drag and drop task between desktop @@ -218,7 +222,7 @@ released tint-0.5 2008-05-14 thil7 released tint-0.4 -2008-05-12 +2008-05-12 - boolean option 'show_all_desktop' 0 : tint panel show one taskbar (from current desktop) 1 : tint panel show all taskbars (from all desktops) @@ -235,7 +239,7 @@ released tint-0.4 2008-05-10 thil7 released tint-0.3 -2008-05-10 +2008-05-10 - manage events : 'send to desktop' and 'send to all desktop' - bug solved : 'close' action now send _NET_CLOSE_WINDOW so openoffice ask 'save document...' if needed @@ -250,27 +254,27 @@ released tint-0.3 2008-05-09 thil7 released tint-0.2 -2008-05-08 +2008-05-08 - panel : add rounded and border (color and alpha) -- remove option 'panel_tasks_centered' +- remove option 'panel_tasks_centered' - user can configure mouse event on task (none, toggle, iconify, shade, close, toggle_iconify) -2008-05-07 -- cpu optimisation : resize_tasks only when add/remove task, +2008-05-07 +- cpu optimisation : resize_tasks only when add/remove task, compute pos_y at startup -2008-05-04 +2008-05-04 - task width adjust when too many task -2008-05-01 +2008-05-01 - task : add rounded and border (color and alpha) - panel position (left, right, center) thank to ak47izatool - cleanup code : vertical position (icon and text), better refresh after delete task, memory leak *font - panel : changed panel_margin and task_margin -2008-04-22 +2008-04-22 - fork ttm projet from p://code.google.com/p/ttm/ (by PÃ¥l Staurland staura@gmail.com) while the projet is no longer in developpement, have not changed the name of 'tint'. diff --git a/doc/tint2-0.7.odt b/doc/tint2-0.7.odt index 41dafe9..37a72fe 100644 Binary files a/doc/tint2-0.7.odt and b/doc/tint2-0.7.odt differ diff --git a/doc/tint2-0.7.pdf b/doc/tint2-0.7.pdf index 988301d..81b3463 100644 Binary files a/doc/tint2-0.7.pdf and b/doc/tint2-0.7.pdf differ diff --git a/src/Makefile b/src/Makefile index b0cd6c4..3b5d9fe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ CFLAGS= -O2 CC = gcc FLAGS=-W -Wall -g `pkg-config --cflags --libs cairo pangocairo x11 xinerama imlib2 glib-2.0` PROGNAME=tint2 -FILES=tint.c server.c panel.c config.c taskbar/task.c taskbar/taskbar.c clock/clock.c systray/docker.c systray/icons.c systray/kde.c systray/net.c systray/xproperty.c util/window.c util/area.c +FILES=tint.c server.c panel.c config.c taskbar/task.c taskbar/taskbar.c clock/clock.c systray/systraybar.c systray/docker.c systray/icons.c systray/kde.c systray/net.c systray/xproperty.c util/window.c util/area.c ifndef DESTDIR ifndef PREFIX diff --git a/src/clock/clock.c b/src/clock/clock.c index 5fb6cb1..42cfd90 100644 --- a/src/clock/clock.c +++ b/src/clock/clock.c @@ -94,13 +94,13 @@ redraw: } if (time_width > date_width) new_width = time_width; else new_width = date_width; - new_width += (2*clock->area.paddingx) + (2*clock->area.pix.border.width); + new_width += (2*clock->area.paddingxlr) + (2*clock->area.pix.border.width); if (new_width > clock->area.width || (new_width != clock->area.width && date_width > time_width)) { //printf("clock_width %d, new_width %d\n", clock->area.width, new_width); // resize clock clock->area.width = new_width; - panel.clock.area.posx = panel.area.width - panel.clock.area.width - panel.area.paddingx - panel.area.pix.border.width; + panel.clock.area.posx = panel.area.width - panel.clock.area.width - panel.area.paddingxlr - panel.area.pix.border.width; g_object_unref (layout); resize_taskbar(); diff --git a/src/clock/clock.h b/src/clock/clock.h index b886d4a..246bb2e 100644 --- a/src/clock/clock.h +++ b/src/clock/clock.h @@ -1,5 +1,7 @@ /************************************************************************** -* clock : +* Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) +* +* clock : * - draw clock, adjust width * **************************************************************************/ diff --git a/src/config.c b/src/config.c index acb49e8..56deba2 100644 --- a/src/config.c +++ b/src/config.c @@ -103,23 +103,43 @@ void copy_file(const char *pathSrc, const char *pathDest) } -void extract_values (const char *value, char **value1, char **value2) +void extract_values (const char *value, char **value1, char **value2, char **value3) { - char *b; + char *b, *c; if (*value1) free (*value1); if (*value2) free (*value2); + if (*value3) free (*value3); - if ((b = strchr (value, ' '))) { + if (b = strchr (value, ' ')) { b[0] = '\0'; b++; - *value2 = strdup (b); - g_strstrip(*value2); - } - else *value2 = 0; - - *value1 = strdup (value); - g_strstrip(*value1); + } + else { + b = 0; + *value2 = 0; + *value3 = 0; + } + *value1 = strdup (value); + g_strstrip(*value1); + + if (b) { + if (c = strchr (b, ' ')) { + c[0] = '\0'; + c++; + } + else { + c = 0; + *value3 = 0; + } + *value2 = strdup (b); + g_strstrip(*value2); + } + + if (c) { + *value3 = strdup (c); + g_strstrip(*value3); + } } @@ -194,7 +214,7 @@ void get_action (char *event, int *action) void add_entry (char *key, char *value) { - char *value1=0, *value2=0; + char *value1=0, *value2=0, *value3=0; /* Background and border */ if (strcmp (key, "rounded") == 0) { @@ -209,14 +229,14 @@ void add_entry (char *key, char *value) } else if (strcmp (key, "background_color") == 0) { Area *a = g_slist_last(list_back)->data; - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); get_color (value1, a->pix.back.color); if (value2) a->pix.back.alpha = (atoi (value2) / 100.0); else a->pix.back.alpha = 0.5; } else if (strcmp (key, "border_color") == 0) { Area *a = g_slist_last(list_back)->data; - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); get_color (value1, a->pix.border.color); if (value2) a->pix.border.alpha = (atoi (value2) / 100.0); else a->pix.border.alpha = 0.5; @@ -228,22 +248,23 @@ void add_entry (char *key, char *value) if (panel.monitor > 0) panel.monitor -= 1; } else if (strcmp (key, "panel_size") == 0) { - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); panel.area.width = atoi (value1); if (value2) panel.area.height = atoi (value2); } else if (strcmp (key, "panel_margin") == 0) { - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); panel.marginx = atoi (value1); if (value2) panel.marginy = atoi (value2); } else if (strcmp (key, "panel_padding") == 0) { - extract_values(value, &value1, &value2); - panel.area.paddingx = atoi (value1); + extract_values(value, &value1, &value2, &value3); + panel.area.paddingxlr = panel.area.paddingx = atoi (value1); if (value2) panel.area.paddingy = atoi (value2); + if (value3) panel.area.paddingx = atoi (value3); } else if (strcmp (key, "panel_position") == 0) { - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); if (strcmp (value1, "top") == 0) panel.position = TOP; else panel.position = BOTTOM; @@ -285,15 +306,16 @@ void add_entry (char *key, char *value) panel.clock.time2_font_desc = pango_font_description_from_string (value); } else if (strcmp (key, "clock_font_color") == 0) { - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); get_color (value1, panel.clock.font.color); if (value2) panel.clock.font.alpha = (atoi (value2) / 100.0); else panel.clock.font.alpha = 0.1; } else if (strcmp (key, "clock_padding") == 0) { - extract_values(value, &value1, &value2); - panel.clock.area.paddingx = atoi (value1); + extract_values(value, &value1, &value2, &value3); + panel.clock.area.paddingxlr = panel.clock.area.paddingx = atoi (value1); if (value2) panel.clock.area.paddingy = atoi (value2); + if (value3) panel.clock.area.paddingx = atoi (value3); } else if (strcmp (key, "clock_background_id") == 0) { int id = atoi (value); @@ -309,9 +331,10 @@ void add_entry (char *key, char *value) else panel.mode = SINGLE_DESKTOP; } else if (strcmp (key, "taskbar_padding") == 0) { - extract_values(value, &value1, &value2); - g_taskbar.paddingx = atoi (value1); + extract_values(value, &value1, &value2, &value3); + g_taskbar.paddingxlr = g_taskbar.paddingx = atoi (value1); if (value2) g_taskbar.paddingy = atoi (value2); + if (value3) g_taskbar.paddingx = atoi (value3); } else if (strcmp (key, "taskbar_background_id") == 0) { int id = atoi (value); @@ -330,24 +353,23 @@ void add_entry (char *key, char *value) else if (strcmp (key, "task_width") == 0) g_task.maximum_width = atoi (value); else if (strcmp (key, "task_padding") == 0) { - extract_values(value, &value1, &value2); - g_task.area.paddingx = atoi (value1); - if (value2) { - g_task.area.paddingy = atoi (value2); - } + extract_values(value, &value1, &value2, &value3); + g_task.area.paddingxlr = g_task.area.paddingx = atoi (value1); + if (value2) g_task.area.paddingy = atoi (value2); + if (value3) g_task.area.paddingx = atoi (value3); } else if (strcmp (key, "task_font") == 0) { if (g_task.font_desc) pango_font_description_free(g_task.font_desc); g_task.font_desc = pango_font_description_from_string (value); } else if (strcmp (key, "task_font_color") == 0) { - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); get_color (value1, g_task.font.color); if (value2) g_task.font.alpha = (atoi (value2) / 100.0); else g_task.font.alpha = 0.1; } else if (strcmp (key, "task_active_font_color") == 0) { - extract_values(value, &value1, &value2); + extract_values(value, &value1, &value2, &value3); get_color (value1, g_task.font_active.color); if (value2) g_task.font_active.alpha = (atoi (value2) / 100.0); else g_task.font_active.alpha = 0.1; @@ -427,6 +449,7 @@ void add_entry (char *key, char *value) if (value1) free (value1); if (value2) free (value2); + if (value3) free (value3); } @@ -556,7 +579,7 @@ void config_finish () g_task.text_posy = (g_task.area.height - height) / 2.0; // add task_icon_size - g_task.text_posx = g_task.area.paddingx + g_task.area.pix.border.width; + g_task.text_posx = g_task.area.paddingxlr + g_task.area.pix.border.width; if (g_task.icon) { g_task.icon_size1 = g_task.area.height - (2 * g_task.area.paddingy); g_task.text_posx += g_task.icon_size1; diff --git a/src/panel.c b/src/panel.c index 71802e6..b5be1a2 100644 --- a/src/panel.c +++ b/src/panel.c @@ -45,7 +45,7 @@ void visual_refresh () refresh (l->data); // main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right. - XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingx, 0, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, 0); + XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingxlr, 0, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, 0); XFlush (server.dsp); panel.refresh = 0; } @@ -129,7 +129,7 @@ void window_draw_panel () // XCreateWindow(display, parent, x, y, w, h, border, depth, class, visual, mask, attrib) // main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right. if (window.main_win) XDestroyWindow(server.dsp, window.main_win); - win = XCreateWindow (server.dsp, server.root_win, server.posx+panel.area.paddingx, server.posy, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att); + win = XCreateWindow (server.dsp, server.root_win, server.posx+panel.area.paddingxlr, server.posy, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att); set_panel_properties (win); window.main_win = win; diff --git a/src/panel.h b/src/panel.h index 4a3e245..79fb625 100644 --- a/src/panel.h +++ b/src/panel.h @@ -1,8 +1,10 @@ /************************************************************************** -* panel : +* Copyright (C) 2008 PÃ¥l Staurland (staura@gmail.com) +* Modified (C) 2008/2009 thierry lorthiois (lorthiois@bbsoft.fr) +* +* panel : * - draw panel and all objects according to panel_layout -* -* Check COPYING file for Copyright +* * **************************************************************************/ @@ -16,6 +18,7 @@ #include "clock.h" #include "task.h" #include "taskbar.h" +#include "systraybar.h" //panel mode @@ -54,13 +57,14 @@ typedef struct { int nb_monitor; Task *task_active; Task *task_drag; - + // -------------------------------------------------- // clock Clock clock; // -------------------------------------------------- // systray + Systraybar systraybar; // -------------------------------------------------- // mouse events diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c new file mode 100644 index 0000000..9fd7083 --- /dev/null +++ b/src/systray/systraybar.c @@ -0,0 +1,80 @@ +/************************************************************************** +* Tint2 : systraybar +* +* Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr) +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "systraybar.h" +#include "server.h" +#include "window.h" +#include "panel.h" + + + +int resize_systray (Systraybar *sysbar) +{ + return 0; +} + +/* +// initialise taskbar posx and width +void resize_taskbar() +{ + int taskbar_width, modulo_width, taskbar_on_screen; + + if (panel.mode == MULTI_DESKTOP) taskbar_on_screen = panel.nb_desktop; + else taskbar_on_screen = panel.nb_monitor; + + taskbar_width = panel.area.width - (2 * panel.area.paddingx) - (2 * panel.area.pix.border.width); + if (panel.clock.time1_format) + taskbar_width -= (panel.clock.area.width + panel.area.paddingx); + taskbar_width = (taskbar_width - ((taskbar_on_screen-1) * panel.area.paddingx)) / taskbar_on_screen; + + if (taskbar_on_screen > 1) + modulo_width = (taskbar_width - ((taskbar_on_screen-1) * panel.area.paddingx)) % taskbar_on_screen; + else + modulo_width = 0; + + int i, nb, modulo=0, posx=0; + nb = panel.nb_desktop * panel.nb_monitor; + for (i=0 ; i < nb ; i++) { + if ((i % taskbar_on_screen) == 0) { + posx = panel.area.pix.border.width + panel.area.paddingx; + modulo = modulo_width; + } + else posx += taskbar_width + panel.area.paddingx; + + panel.taskbar[i].area.posx = posx; + panel.taskbar[i].area.width = taskbar_width; + if (modulo) { + panel.taskbar[i].area.width++; + modulo--; + } + + resize_tasks(&panel.taskbar[i]); + } +} +*/ + + diff --git a/src/systray/systraybar.h b/src/systray/systraybar.h new file mode 100644 index 0000000..7fd8c9e --- /dev/null +++ b/src/systray/systraybar.h @@ -0,0 +1,32 @@ +/************************************************************************** +* Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr) +* +* systraybar +* +**************************************************************************/ + +#ifndef SYSTRAYBAR_H +#define SYSTRAYBAR_H + +#include "area.h" + + +typedef struct { + // always start with area + Area area; + +} Systraybar; + + +// -------------------------------------------------- +// global taskbar parameter +Area g_systraybar; + + +// return 1 if task_width changed +int resize_systray (Systraybar *sysbar); + + + +#endif + diff --git a/src/taskbar/task.c b/src/taskbar/task.c index aaebcbf..0aeb45e 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -63,7 +63,7 @@ deb: get_icon(new_tsk); get_title(new_tsk); memcpy(&new_tsk->area, &g_task.area, sizeof(Area)); - + //printf("task %s : desktop %d, monitor %d\n", new_tsk->title, desktop, monitor); XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask); @@ -85,14 +85,14 @@ deb: void remove_task (Task *tsk) { if (!tsk) return; - + Task *tsk2 = tsk; Taskbar *tskbar; Window win = tsk->win; int desktop = 0, all_desktop = tsk->all_desktop; int monitor = ((Taskbar*)tsk->area.parent)->monitor; - -deb: + +deb: if (all_desktop) { tskbar = &panel.taskbar[index(desktop, monitor)]; GSList *l0; @@ -103,28 +103,28 @@ deb: break; } } - else + else tskbar = (Taskbar*)tsk->area.parent; - + tskbar->area.list = g_slist_remove(tskbar->area.list, tsk2); resize_tasks (tskbar); set_redraw (&tskbar->area); //printf("remove_task %d %s\n", index(tskbar->desktop, tskbar->monitor), tsk->title); - if (tsk2 == panel.task_active) + if (tsk2 == panel.task_active) panel.task_active = 0; - if (tsk2 == panel.task_drag) + if (tsk2 == panel.task_drag) panel.task_drag = 0; - if (tsk2->title) + if (tsk2->title) free (tsk2->title); - if (tsk2->icon_data) + if (tsk2->icon_data) free (tsk2->icon_data); XFreePixmap (server.dsp, tsk2->area.pix.pmap); XFreePixmap (server.dsp, tsk2->area.pix_active.pmap); free(tsk2); - + if (all_desktop) { desktop++; if (desktop < server.nb_desktop) @@ -214,7 +214,7 @@ void draw_task_icon (Task *tsk, int text_width, int active) else pos_x = (tsk->area.width - g_task.icon_size1) / 2; } - else pos_x = g_task.area.paddingx + g_task.area.pix.border.width; + else pos_x = g_task.area.paddingxlr + g_task.area.pix.border.width; /* Render */ Imlib_Image icon; diff --git a/src/taskbar/task.h b/src/taskbar/task.h index 2948906..e99c577 100644 --- a/src/taskbar/task.h +++ b/src/taskbar/task.h @@ -34,8 +34,6 @@ typedef struct { -// -------------------------------------------------- -// task parameter typedef struct { // always start with area Area area; diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index fe2383c..7a2bb3f 100644 --- a/src/taskbar/taskbar.c +++ b/src/taskbar/taskbar.c @@ -43,7 +43,7 @@ Task *task_get_task (Window win) for (i=0 ; i < nb ; i++) { for (l0 = panel.taskbar[i].area.list; l0 ; l0 = l0->next) { tsk = l0->data; - if (win == tsk->win) + if (win == tsk->win) return tsk; } } @@ -109,7 +109,8 @@ int resize_tasks (Taskbar *taskbar) task_count = g_slist_length(taskbar->area.list); if (!task_count) pixel_width = g_task.maximum_width; else { - taskbar_width = taskbar->area.width - (2 * g_taskbar.pix.border.width) - ((task_count+1) * g_taskbar.paddingx); + taskbar_width = taskbar->area.width - (2 * g_taskbar.pix.border.width) - (2 * g_taskbar.paddingxlr); + if (task_count>1) taskbar_width -= ((task_count-1) * g_taskbar.paddingx); pixel_width = taskbar_width / task_count; if (pixel_width > g_task.maximum_width) pixel_width = g_task.maximum_width; @@ -127,7 +128,7 @@ int resize_tasks (Taskbar *taskbar) } // change pos_x and width for all tasks - x = taskbar->area.posx + taskbar->area.pix.border.width + taskbar->area.paddingx; + x = taskbar->area.posx + taskbar->area.pix.border.width + taskbar->area.paddingxlr; for (l = taskbar->area.list; l ; l = l->next) { tsk = l->data; tsk->area.posx = x; @@ -151,7 +152,7 @@ void resize_taskbar() if (panel.mode == MULTI_DESKTOP) taskbar_on_screen = panel.nb_desktop; else taskbar_on_screen = panel.nb_monitor; - taskbar_width = panel.area.width - (2 * panel.area.paddingx) - (2 * panel.area.pix.border.width); + taskbar_width = panel.area.width - (2 * panel.area.paddingxlr) - (2 * panel.area.pix.border.width); if (panel.clock.time1_format) taskbar_width -= (panel.clock.area.width + panel.area.paddingx); taskbar_width = (taskbar_width - ((taskbar_on_screen-1) * panel.area.paddingx)) / taskbar_on_screen; @@ -165,7 +166,7 @@ void resize_taskbar() nb = panel.nb_desktop * panel.nb_monitor; for (i=0 ; i < nb ; i++) { if ((i % taskbar_on_screen) == 0) { - posx = panel.area.pix.border.width + panel.area.paddingx; + posx = panel.area.pix.border.width + panel.area.paddingxlr; modulo = modulo_width; } else posx += taskbar_width + panel.area.paddingx; diff --git a/src/taskbar/taskbar.h b/src/taskbar/taskbar.h index b35c60f..597f441 100644 --- a/src/taskbar/taskbar.h +++ b/src/taskbar/taskbar.h @@ -1,3 +1,9 @@ +/************************************************************************** +* Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) +* +* taskbar +* +**************************************************************************/ #ifndef TASKBAR_H #define TASKBAR_H @@ -5,15 +11,13 @@ #include "task.h" -// -------------------------------------------------- -// taskbar parameter typedef struct { // always start with area Area area; int desktop; int monitor; - + // task parameters int task_width; int task_modulo; diff --git a/src/tint.c b/src/tint.c index e64f8d9..9ff04fc 100644 --- a/src/tint.c +++ b/src/tint.c @@ -471,7 +471,7 @@ load_config: case Expose: XCopyArea (server.dsp, panel.area.pix.pmap, server.root_win, server.gc_root, 0, 0, panel.area.width, panel.area.height, server.posx, server.posy); - XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingx, 0, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, 0); + XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingxlr, 0, panel.area.width-(2*panel.area.paddingxlr), panel.area.height, 0, 0); break; case PropertyNotify: diff --git a/src/tint2 b/src/tint2 index e441bf4..93633b2 100755 Binary files a/src/tint2 and b/src/tint2 differ diff --git a/src/util/area.h b/src/util/area.h index 0294353..29adf96 100644 --- a/src/util/area.h +++ b/src/util/area.h @@ -75,7 +75,9 @@ typedef struct { // need redraw Pixmap int redraw; int use_active, is_active; - int paddingx, paddingy; + // paddingxlr = horizontal padding left/right + // paddingx = horizontal padding between childs + int paddingxlr, paddingx, paddingy; // parent Area void *parent; diff --git a/tintrc01 b/tintrc01 index f616c4d..7555b52 100644 --- a/tintrc01 +++ b/tintrc01 @@ -46,7 +46,7 @@ task_text = 1 task_width = 130 task_centered = 1 task_padding = 4 2 -task_font = sans 7 +task_font = sans 8 task_font_color = #ffffff 65 task_active_font_color = #ffffff 85 task_background_id = 2 diff --git a/tintrc02 b/tintrc02 index bd826ac..04dc7ea 100644 --- a/tintrc02 +++ b/tintrc02 @@ -8,44 +8,49 @@ rounded = 1 border_width = 0 background_color = #282828 40 -border_color = #000000 40 +border_color = #000000 0 rounded = 1 border_width = 1 -background_color = #282828 0 +background_color = #cccccc 0 +border_color = #cccccc 30 + +rounded = 1 +border_width = 0 +background_color = #cccccc 20 border_color = #cccccc 40 #--------------------------------------------- # PANEL #--------------------------------------------- panel_monitor = 1 -panel_position = bottom left +panel_position = top left panel_size = 0 27 panel_margin = 0 0 -panel_padding = 4 0 +panel_padding = 7 3 7 font_shadow = 0 panel_background_id = 1 #--------------------------------------------- # TASKBAR #--------------------------------------------- -taskbar_mode = multi_monitor -taskbar_padding = 4 0 -taskbar_background_id = 0 +taskbar_mode = multi_desktop +taskbar_padding = 0 0 0 +taskbar_background_id = 2 #--------------------------------------------- # TASKS #--------------------------------------------- task_icon = 1 task_text = 0 -task_width = 30 +task_width = 35 task_centered = 1 -task_padding = 2 5 +task_padding = 2 1 task_font = sans 8 task_font_color = #ffffff 60 task_active_font_color = #ffffff 100 task_background_id = 0 -task_active_background_id = 2 +task_active_background_id = 3 #--------------------------------------------- # SYSTRAY diff --git a/tintrc03 b/tintrc03 index 0106f89..4a27348 100644 --- a/tintrc03 +++ b/tintrc03 @@ -24,18 +24,18 @@ border_color = #d1d1d1 14 # PANEL #--------------------------------------------- panel_monitor = 1 -panel_position = bottom center +panel_position = top center panel_size = 1000 25 panel_margin = 0 7 -panel_padding = 6 0 +panel_padding = 7 3 0 font_shadow = 0 panel_background_id = 1 #--------------------------------------------- # TASKBAR #--------------------------------------------- -taskbar_mode = multi_desktop -taskbar_padding = 2 3 +taskbar_mode = single_desktop +taskbar_padding = 0 0 0 taskbar_background_id = 0 #--------------------------------------------- @@ -45,7 +45,7 @@ task_icon = 1 task_text = 1 task_width = 150 task_centered = 1 -task_padding = 3 2 +task_padding = 2 1 task_font = myriad pro 8 task_font_color = #000000 70 task_active_font_color = #000000 100 @@ -66,7 +66,7 @@ time1_font = sans bold 12 #time2_format = %A %d %B #time2_font = sans bold 10 clock_font_color = #000000 70 -clock_padding = 6 0 +clock_padding = 4 0 clock_background_id = 0 #--------------------------------------------- diff --git a/tintrc04 b/tintrc04 deleted file mode 100644 index 5c7378b..0000000 --- a/tintrc04 +++ /dev/null @@ -1,74 +0,0 @@ -#--------------------------------------------- -# TINT CONFIG FILE -#--------------------------------------------- - -#--------------------------------------------- -# BACKGROUND AND BORDER -#--------------------------------------------- -rounded = 3 -border_width = 1 -background_color = #3c3020 90 -border_color = #3c3020 90 - -rounded = 3 -border_width = 1 -background_color = #3c3020 90 -border_color = #ffffff 30 - -#--------------------------------------------- -# PANEL -#--------------------------------------------- -panel_monitor = 1 -panel_position = bottom center -panel_size = 900 30 -panel_margin = 0 0 -panel_padding = 10 2 -font_shadow = 0 -panel_background_id = 0 - -#--------------------------------------------- -# TASKBAR -#--------------------------------------------- -taskbar_mode = single_desktop -taskbar_padding = 9 0 -taskbar_background_id = 0 - -#--------------------------------------------- -# TASKS -#--------------------------------------------- -task_icon = 0 -task_text = 1 -task_width = 190 -task_centered = 1 -task_padding = 2 0 -task_font = sans 8.4 -task_font_color = #ececec 50 -task_active_font_color = #ffffff 90 -task_background_id = 1 -task_active_background_id = 2 - -#--------------------------------------------- -# SYSTRAY -#--------------------------------------------- -#systray_padding = 9 3 -#systray_background_id = 0 - -#--------------------------------------------- -# CLOCK -#--------------------------------------------- -time1_format = %H:%M -time1_font = sans bold 8 -time2_format = %A %d %B -time2_font = sans 7 -clock_font_color = #ececec 50 -clock_padding = 4 0 -clock_background_id = 1 - -#--------------------------------------------- -# MOUSE ACTION ON TASK -#--------------------------------------------- -mouse_middle = none -mouse_right = close -mouse_scroll_up = toggle -mouse_scroll_down = iconify - diff --git a/tintrc05 b/tintrc05 deleted file mode 100644 index 5c7378b..0000000 --- a/tintrc05 +++ /dev/null @@ -1,74 +0,0 @@ -#--------------------------------------------- -# TINT CONFIG FILE -#--------------------------------------------- - -#--------------------------------------------- -# BACKGROUND AND BORDER -#--------------------------------------------- -rounded = 3 -border_width = 1 -background_color = #3c3020 90 -border_color = #3c3020 90 - -rounded = 3 -border_width = 1 -background_color = #3c3020 90 -border_color = #ffffff 30 - -#--------------------------------------------- -# PANEL -#--------------------------------------------- -panel_monitor = 1 -panel_position = bottom center -panel_size = 900 30 -panel_margin = 0 0 -panel_padding = 10 2 -font_shadow = 0 -panel_background_id = 0 - -#--------------------------------------------- -# TASKBAR -#--------------------------------------------- -taskbar_mode = single_desktop -taskbar_padding = 9 0 -taskbar_background_id = 0 - -#--------------------------------------------- -# TASKS -#--------------------------------------------- -task_icon = 0 -task_text = 1 -task_width = 190 -task_centered = 1 -task_padding = 2 0 -task_font = sans 8.4 -task_font_color = #ececec 50 -task_active_font_color = #ffffff 90 -task_background_id = 1 -task_active_background_id = 2 - -#--------------------------------------------- -# SYSTRAY -#--------------------------------------------- -#systray_padding = 9 3 -#systray_background_id = 0 - -#--------------------------------------------- -# CLOCK -#--------------------------------------------- -time1_format = %H:%M -time1_font = sans bold 8 -time2_format = %A %d %B -time2_font = sans 7 -clock_font_color = #ececec 50 -clock_padding = 4 0 -clock_background_id = 1 - -#--------------------------------------------- -# MOUSE ACTION ON TASK -#--------------------------------------------- -mouse_middle = none -mouse_right = close -mouse_scroll_up = toggle -mouse_scroll_down = iconify - diff --git a/tintrc06 b/tintrc06 index 9cc94bb..7230796 100644 --- a/tintrc06 +++ b/tintrc06 @@ -25,10 +25,10 @@ border_color = #ffffff 0 # PANEL #--------------------------------------------- panel_monitor = 1 -panel_position = bottom left +panel_position = top left panel_size = 0 30 panel_margin = 0 0 -panel_padding = 11 2 +panel_padding = 9 2 7 font_shadow = 0 panel_background_id = 0 @@ -36,7 +36,7 @@ panel_background_id = 0 # TASKBAR #--------------------------------------------- taskbar_mode = multi_desktop -taskbar_padding = 3 3 +taskbar_padding = 3 3 0 taskbar_background_id = 1 #--------------------------------------------- @@ -67,7 +67,7 @@ time1_format = %A %d %H:%M time1_font = sans bold 8 #time2_format = %A %d %B time2_font = sans 7 -clock_font_color = #ffffff 59 +clock_font_color = #ffffff 65 clock_padding = 6 0 clock_background_id = 1