all repos — tint2 @ c8d09ed731c5fd7ff101032f61700d75c5ee3ba8

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

fixed issue 130 by maato

git-svn-id: http://tint2.googlecode.com/svn/trunk@165 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
lorthiois@bbsoft.fr lorthiois@bbsoft.fr@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

c8d09ed731c5fd7ff101032f61700d75c5ee3ba8

parent

f3260b67c58627bca0d9454b2e02f9f0cc19bbcc

4 files changed, 36 insertions(+), 1 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,3 +1,7 @@

+2009-08-30 +- fixed issue 130 by maato + ordered systray icon with config "systray_sort = asc/desc" + 2009-08-29 - fixed issue 134
M src/config.csrc/config.c

@@ -84,6 +84,7 @@ // append full transparency background

list_back = g_slist_append(0, calloc(1, sizeof(Area))); panel_config = calloc(1, sizeof(Panel)); + systray.sort = 1; // window manager's menu default value == false wm_menu = 0; max_tick_urgent = 7;

@@ -557,6 +558,12 @@ Area *a = g_slist_nth_data(list_back, id);

memcpy(&systray.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&systray.area.pix.border, &a->pix.border, sizeof(Border)); } + else if (strcmp(key, "systray_sort") == 0) { + if (strcmp(value, "desc") == 0) + systray.sort = -1; + else + systray.sort = 1; + } /* Mouse actions */ else if (strcmp (key, "mouse_middle") == 0)
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -227,6 +227,28 @@ return 0;

} +static gint compare_traywindows(gconstpointer a, gconstpointer b) +{ + const TrayWindow * traywin_a = (TrayWindow*)a; + const TrayWindow * traywin_b = (TrayWindow*)b; + XTextProperty name_a, name_b; + + if(XGetWMName(server.dsp, traywin_a->id, &name_a) == 0) { + return -1; + } + else if(XGetWMName(server.dsp, traywin_b->id, &name_b) == 0) { + XFree(name_a.value); + return 1; + } + else { + gint retval = g_ascii_strncasecmp((char*)name_a.value, (char*)name_b.value, -1) * systray.sort; + XFree(name_a.value); + XFree(name_b.value); + return retval; + } +} + + gboolean add_icon(Window id) { TrayWindow *traywin;

@@ -276,7 +298,8 @@

traywin = g_new0(TrayWindow, 1); traywin->id = id; - systray.list_icons = g_slist_prepend(systray.list_icons, traywin); +// systray.list_icons = g_slist_prepend(systray.list_icons, traywin); + systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows); systray.area.resize = 1; systray.area.redraw = 1; //printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons));
M src/systray/systraybar.hsrc/systray/systraybar.h

@@ -24,6 +24,7 @@ // always start with area

Area area; GSList *list_icons; + int sort; } Systraybar;