Dear all,

I am working on a patch for lxpanel that allows to configure taskbars such that 
they only show tasks on a specific workspace. That way, one can have one 
taskbar for each workspace and have it display all tasks on that (and only 
that) workspace.
The behavior is similar to what the tint2 bar does.

At this point I got the functionality working but it must be configured by 
manually editing the configuration file.

What's missing is the extension of the configuration dialog, which I probably 
wouldn't bother to implement for myself but would be willing to take a crack at 
if you guys were interested to merge the change. (I have very little experience 
in c programming so do expect this to take a while...)

Before doing that (and creating a sourceforge account, or what's your preferred 
way of contributing code?) I just wanted to get some initial feedback on this.
You can find my current diff below (created with git format-patch).

Let me know what you think,
kind regards

Enguerrand


---
 plugins/launchtaskbar.c | 5 ++++-
 plugins/task-button.c   | 7 +++++--
 plugins/task-button.h   | 2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/plugins/launchtaskbar.c b/plugins/launchtaskbar.c
index 81af676..161341c 100644
--- a/plugins/launchtaskbar.c
+++ b/plugins/launchtaskbar.c
@@ -119,6 +119,7 @@ struct LaunchTaskBarPlugin {
     GtkWidget * tb_icon_grid;      /* Manager for taskbar buttons */
     int number_of_desktops;        /* Number of desktops, from 
NET_WM_NUMBER_OF_DESKTOPS */
     int current_desktop;           /* Current desktop, from 
NET_WM_CURRENT_DESKTOP */
+    int show_icons_for_desktop;    /* Only icons of windows from on desktop 
are shown. */
     guint dnd_delay_timer;         /* Timer for drag and drop delay */
     gboolean dnd_task_moving;      /* User is currently moving a task button */
     int icon_size;                 /* Size of task icons */
@@ -1008,6 +1009,7 @@ static void 
launchtaskbar_constructor_task(LaunchTaskBarPlugin *ltbp)
             ltbp->flags.icons_only = (tmp_int != 0);
         if (config_setting_lookup_int(s, "ShowAllDesks", &tmp_int))
             ltbp->flags.show_all_desks = (tmp_int != 0);
+        config_setting_lookup_int(s, "ShowIconsForDesktop", 
&ltbp->show_icons_for_desktop);
         if (config_setting_lookup_int(s, "SameMonitorOnly", &tmp_int))
             ltbp->flags.same_monitor_only = (tmp_int != 0);
         if (config_setting_lookup_int(s, "DisableUpscale", &tmp_int))
@@ -1104,6 +1106,7 @@ static GtkWidget *_launchtaskbar_constructor(LXPanel 
*panel, config_setting_t *s
     ltbp->flags.tooltips    = TRUE;
     ltbp->flags.icons_only  = FALSE;
     ltbp->flags.show_all_desks = TRUE;
+    ltbp->show_icons_for_desktop = ALL_WORKSPACES;
     ltbp->task_width_max    = TASK_WIDTH_MAX;
     ltbp->spacing           = 1;
     ltbp->flags.use_mouse_wheel = TRUE;
@@ -2162,7 +2165,7 @@ static void taskbar_add_new_window(LaunchTaskBarPlugin * 
tb, Window win, GList *
         return; /* some button accepted it, done */
 
     task = task_button_new(win, tb->current_desktop, tb->number_of_desktops,
-                           tb->panel, res_class, tb->flags);
+                           tb->panel, res_class, tb->flags, 
tb->show_icons_for_desktop);
     taskbar_add_task_button(tb, task);
 }
 
diff --git a/plugins/task-button.c b/plugins/task-button.c
index ea8ca9c..10eb315 100644
--- a/plugins/task-button.c
+++ b/plugins/task-button.c
@@ -95,6 +95,7 @@ struct _TaskButton
     gint desktop;               /* Current desktop of the button */
     gint n_desktops;            /* total number of desktops */
     gint monitor;               /* current monitor for the panel */
+    gint show_icons_for_desktop; /* only show task icons for windows on this 
desktop */
     guint icon_size;            /* Current value from last update */
     TaskShowFlags flags;        /* flags to show */
     unsigned int set_bold :1;   /* flat buttons only: TRUE if set bold */
@@ -206,7 +207,8 @@ static gboolean task_is_visible(TaskButton *b, TaskDetails 
*task)
 
     /* Desktop placement. */
     return ((task->desktop == ALL_WORKSPACES) ||
-            (task->desktop == b->desktop) ||
+            (task->desktop == b->desktop && b->show_icons_for_desktop == 
ALL_WORKSPACES) ||
+            (task->desktop == b->show_icons_for_desktop) ||
             (b->flags.show_all_desks) ||
             (b->flags.use_urgency_hint && task->urgency));
 }
@@ -1470,7 +1472,7 @@ static void task_button_init(TaskButton *self)
 
 /* creates new button and sets rendering options */
 TaskButton *task_button_new(Window win, gint desk, gint desks, LXPanel *panel,
-                            const char *res_class, TaskShowFlags flags)
+                            const char *res_class, TaskShowFlags flags, gint 
show_icons_for_desktop)
 {
     TaskButton *self = g_object_new(PANEL_TYPE_TASK_BUTTON,
                                     "relief", flags.flat_button ? 
GTK_RELIEF_NONE : GTK_RELIEF_NORMAL,
@@ -1480,6 +1482,7 @@ TaskButton *task_button_new(Window win, gint desk, gint 
desks, LXPanel *panel,
     self->desktop = desk;
     self->n_desktops = desks;
     self->panel = panel;
+    self->show_icons_for_desktop = show_icons_for_desktop;
     self->monitor = panel_get_monitor(panel);
     self->icon_size = panel_get_icon_size(panel);
     if (flags.use_smaller_icons)
diff --git a/plugins/task-button.h b/plugins/task-button.h
index e6acc6d..7cc0469 100644
--- a/plugins/task-button.h
+++ b/plugins/task-button.h
@@ -63,7 +63,7 @@ struct _TaskButtonClass
 
 /* creates new button and sets rendering options */
 TaskButton *task_button_new(Window win, gint desk, gint desks, LXPanel *panel,
-                            const char *cl, TaskShowFlags flags);
+                            const char *cl, TaskShowFlags flags, gint 
show_icons_for_desktop);
 
 gboolean task_button_has_window(TaskButton *button, Window win);
 /* removes windows from button, that are missing in list */
-- 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to