all repos — tint2 @ d32b4ed908aab4e7da3fd749da38a1468e83c62f

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

desktop name

git-svn-id: http://tint2.googlecode.com/svn/trunk@600 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

d32b4ed908aab4e7da3fd749da38a1468e83c62f

parent

edc5db91c62bc0990f644de8031dc9d1b861ab5d

1 files changed, 26 insertions(+), 6 deletions(-)

jump to
M src/taskbar/taskbarname.csrc/taskbar/taskbarname.c

@@ -49,11 +49,26 @@ void init_taskbarname_panel(void *p)

{ Panel *panel =(Panel*)p; Taskbar *tskbar; - int j; + int j, count; if (!taskbarname_enabled) return; - for (j=0 ; j < panel->nb_desktop ; j++) { + GList *list = NULL; + gchar *data_ptr, *ptr; + data_ptr = server_get_property (server.root_win, server.atom._NET_DESKTOP_NAMES, server.atom.UTF8_STRING, &count); + if (data_ptr) { + list = g_list_append(list, g_strdup(data_ptr)); + for (j = 0; j < count-1; j++) { + if (*(data_ptr + j) == '\0') { + ptr = (gchar*)data_ptr + j + 1; + list = g_list_append(list, g_strdup(ptr)); + } + } + XFree(data_ptr); + } + + GList *l; + for (j=0, l=list ; j < panel->nb_desktop ; j++) { tskbar = &panel->taskbar[j]; memcpy(&tskbar->bar_name.area, &panel->g_taskbar.area_name, sizeof(Area)); tskbar->bar_name.area.parent = tskbar;

@@ -61,7 +76,15 @@ if (j == server.desktop)

tskbar->bar_name.area.bg = panel->g_taskbar.background_name[TASKBAR_ACTIVE]; else tskbar->bar_name.area.bg = panel->g_taskbar.background_name[TASKBAR_NORMAL]; - tskbar->bar_name.name = g_strdup_printf("%d", j+1); + + if (l) { + tskbar->bar_name.name = g_strdup(l->data); + l = l->next; + } + else { + // use desktop number if name is missing + tskbar->bar_name.name = g_strdup_printf("%d", j+1); + } // append the name at the beginning of taskbar tskbar->area.list = g_slist_append(tskbar->area.list, &tskbar->bar_name);

@@ -147,6 +170,3 @@ }

return ret; } - - -