src/clock
src/systray
src/taskbar
+ src/launcher
src/tooltip
src/util
${X11_INCLUDE_DIRS}
src/tint.c
src/clock/clock.c
src/systray/systraybar.c
+ src/launcher/launcher.c
src/taskbar/task.c
src/taskbar/taskbar.c
src/tooltip/tooltip.c
#include "task.h"
#include "taskbar.h"
#include "systraybar.h"
+#include "launcher.h"
#include "clock.h"
#include "config.h"
#include "window.h"
// systray disabled in snapshot mode
else if (strcmp (key, "systray") == 0 && snapshot_path == 0) {
systray_enabled = atoi(value);
- // systray is latest option added. files without 'systray' are old.
old_config_file = 0;
}
else if (strcmp (key, "systray_padding") == 0 && snapshot_path == 0) {
- if (old_config_file)
+ if (old_config_file) {
+ // if tint2rc is an old config file, systray_padding enabled the systray bar.
systray_enabled = 1;
+ }
extract_values(value, &value1, &value2, &value3);
systray.area.paddingxlr = systray.area.paddingx = atoi (value1);
if (value2) systray.area.paddingy = atoi (value2);
systray.brightness = atoi(value3);
}
+ /* Launcher */
+ else if (strcmp (key, "launcher") == 0) {
+ launcher_enabled = atoi(value);
+ }
+ else if (strcmp (key, "launcher_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.launcher.area.paddingxlr = panel_config.launcher.area.paddingx = atoi (value1);
+ if (value2) panel_config.launcher.area.paddingy = atoi (value2);
+ if (value3) panel_config.launcher.area.paddingx = atoi (value3);
+ }
+ else if (strcmp (key, "launcher_background_id") == 0) {
+ int id = atoi (value);
+ id = (id < backgrounds->len && id >= 0) ? id : 0;
+ panel_config.launcher.area.bg = &g_array_index(backgrounds, Background, id);
+ }
+ else if (strcmp(key, "launcher_icon_size") == 0) {
+ launcher_max_icon_size = atoi(value);
+ }
+ else if (strcmp(key, "launcher_item_icon") == 0) {
+ char *path = strdup(value);
+ panel_config.launcher.list_icon_paths = g_slist_append(panel_config.launcher.list_icon_paths, path);
+ }
+ else if (strcmp(key, "launcher_item_cmd") == 0) {
+ char *cmd = strdup(value);
+ panel_config.launcher.list_cmds = g_slist_append(panel_config.launcher.list_cmds, cmd);
+ }
+
/* Tooltip */
else if (strcmp (key, "tooltip") == 0)
g_tooltip.enabled = atoi(value);
init_tooltip();
init_systray();
+ init_launcher();
init_clock();
#ifdef ENABLE_BATTERY
init_battery();
p->area.list = g_slist_append(p->area.list, &p->battery);
}
#endif
+ if (launcher_enabled) {
+ init_launcher_panel(p);
+ p->area.list = g_slist_append(p->area.list, &p->launcher);
+ }
// systray only on first panel
if (systray.area.on_screen && i == 0) {
init_systray_panel(p);
taskbar_width = panel->area.width - (2 * panel->area.paddingxlr) - (2 * panel->area.bg->border.width);
if (panel->clock.area.on_screen && panel->clock.area.width)
taskbar_width -= (panel->clock.area.width + panel->area.paddingx);
+ if (panel->launcher.area.on_screen && panel->launcher.area.width)
+ taskbar_width -= (panel->launcher.area.width + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen && panel->battery.area.width)
taskbar_width -= (panel->battery.area.width + panel->area.paddingx);
// change posx and width for all taskbar
int i, posx;
posx = panel->area.bg->border.width + panel->area.paddingxlr;
+ if (panel->launcher.area.on_screen && panel->launcher.area.width)
+ posx += (panel->launcher.area.width + panel->area.paddingx);
for (i=0 ; i < panel->nb_desktop ; i++) {
panel->taskbar[i].area.posx = posx;
panel->taskbar[i].area.width = taskbar_width;
taskbar_height = panel->area.height - (2 * panel->area.paddingxlr) - (2 * panel->area.bg->border.width);
if (panel->clock.area.on_screen && panel->clock.area.height)
taskbar_height -= (panel->clock.area.height + panel->area.paddingx);
+ if (panel->launcher.area.on_screen && panel->launcher.area.height)
+ taskbar_height -= (panel->launcher.area.height + panel->area.paddingx);
#ifdef ENABLE_BATTERY
if (panel->battery.area.on_screen && panel->battery.area.height)
taskbar_height -= (panel->battery.area.height + panel->area.paddingx);
taskbar_height -= (systray.area.height + panel->area.paddingx);
posy = panel->area.height - panel->area.bg->border.width - panel->area.paddingxlr - taskbar_height;
+ if (panel->launcher.area.on_screen && panel->launcher.area.height)
+ posy -= (panel->launcher.area.height + panel->area.paddingx);
if (panel_mode == MULTI_DESKTOP) {
int height = taskbar_height - ((panel->nb_desktop-1) * panel->area.paddingx);
taskbar_height = height / panel->nb_desktop;
}
+Launcher *click_launcher (Panel *panel, int x, int y)
+{
+ Launcher *launcher = &panel->launcher;
+
+ if (panel_horizontal) {
+ if (launcher->area.on_screen && x >= launcher->area.posx && x <= (launcher->area.posx + launcher->area.width))
+ return launcher;
+ }
+ else {
+ if (launcher->area.on_screen && y >= launcher->area.posy && y <= (launcher->area.posy + launcher->area.height))
+ return launcher;
+ }
+ return NULL;
+}
+
+
+LauncherIcon *click_launcher_icon (Panel *panel, int x, int y)
+{
+ GSList *l0;
+ Launcher *launcher;
+
+ //printf("Click x=%d y=%d\n", x, y);
+ if ( (launcher = click_launcher(panel, x, y)) ) {
+ LauncherIcon *icon;
+ for (l0 = launcher->list_icons; l0 ; l0 = l0->next) {
+ icon = l0->data;
+ if (x >= (launcher->area.posx + icon->x) && x <= (launcher->area.posx + icon->x + icon->width) &&
+ y >= (launcher->area.posy + icon->y) && y <= (launcher->area.posy + icon->y + icon->height)) {
+ //printf("Hit rect x=%d y=%d xmax=%d ymax=%d\n", launcher->area.posx + icon->x, launcher->area.posy + icon->y, launcher->area.posx + icon->x + icon->width, launcher->area.posy + icon->y + icon->height);
+ return icon;
+ }
+ }
+ }
+ return NULL;
+}
+
+
int click_padding(Panel *panel, int x, int y)
{
if (panel_horizontal) {
#include "task.h"
#include "taskbar.h"
#include "systraybar.h"
+#include "launcher.h"
#ifdef ENABLE_BATTERY
#include "battery.h"
Battery battery;
#endif
+ Launcher launcher;
+
// autohide
int is_hidden;
int hidden_width, hidden_height;
Taskbar *click_taskbar (Panel *panel, int x, int y);
Task *click_task (Panel *panel, int x, int y);
+Launcher *click_launcher (Panel *panel, int x, int y);
+LauncherIcon *click_launcher_icon (Panel *panel, int x, int y);
int click_padding(Panel *panel, int x, int y);
int click_clock(Panel *panel, int x, int y);
Area* click_area(Panel *panel, int x, int y);
#include "task.h"
#include "taskbar.h"
#include "systraybar.h"
+#include "launcher.h"
#include "panel.h"
#include "tooltip.h"
#include "timer.h"
default_battery();
#endif
default_clock();
+ default_launcher();
default_taskbar();
default_tooltip();
default_panel();
cleanup_panel();
cleanup_tooltip();
cleanup_clock();
+ cleanup_launcher();
#ifdef ENABLE_BATTERY
cleanup_battery();
#endif
else
return 0;
}
- // no task clicked --> check if taskbar clicked
+ LauncherIcon *icon = click_launcher_icon(panel, e->x, e->y);
+ if (icon) {
+ if (e->button == 1) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ // no launcher/task clicked --> check if taskbar clicked
Taskbar *tskbar = click_taskbar(panel, e->x, e->y);
if (tskbar && e->button == 1 && panel_mode == MULTI_DESKTOP)
return 1;
return;
}
+ if ( click_launcher(panel, e->xbutton.x, e->xbutton.y)) {
+ LauncherIcon *icon = click_launcher_icon(panel, e->xbutton.x, e->xbutton.y);
+ if (icon) {
+ launcher_action(icon);
+ }
+ task_drag = 0;
+ return;
+ }
+
Taskbar *tskbar;
if ( !(tskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y)) ) {
// TODO: check better solution to keep window below