all repos — tint2 @ ea82926b3f901d74425c0038137621d6f0578ba6

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

New config option: taskbar sort by LRU/MRU (no config GUI yet) (issue #532)
o9000 mrovi9000@gmail.com
commit

ea82926b3f901d74425c0038137621d6f0578ba6

parent

3f84d5d14c6adf7e4df1174bea3014b34bff252d

M ChangeLogChangeLog

@@ -2,6 +2,7 @@ 2015-12-05 master

- Enhancements: - Support for NETWM viewports (as in Compiz) (issue #94) - New plugin: executor + - New taskbar sort order: least-recently-used (lru), most-recently-used (mru) 2015-11-12 0.12.3 - Enhancements: - Battery: Multiple batteries are now supported under Linux (issue #139;
M src/config.csrc/config.c

@@ -749,6 +749,10 @@ if (strcmp(value, "center") == 0) {

taskbar_sort_method = TASKBAR_SORT_CENTER; } else if (strcmp(value, "title") == 0) { taskbar_sort_method = TASKBAR_SORT_TITLE; + } else if (strcmp(value, "lru") == 0) { + taskbar_sort_method = TASKBAR_SORT_LRU; + } else if (strcmp(value, "mru") == 0) { + taskbar_sort_method = TASKBAR_SORT_MRU; } else { taskbar_sort_method = TASKBAR_NOSORT; }
M src/taskbar/task.csrc/taskbar/task.c

@@ -552,6 +552,20 @@ {

if (!task || state < 0 || state >= TASK_STATE_COUNT) return; + if (state == TASK_ACTIVE && task->current_state != state) { + clock_gettime(CLOCK_MONOTONIC, &task->last_activation_time); + if (taskbar_sort_method == TASKBAR_SORT_LRU || taskbar_sort_method == TASKBAR_SORT_MRU) { + GPtrArray *task_group = task_get_tasks(task->win); + if (task_group) { + for (int i = 0; i < task_group->len; ++i) { + Task *task1 = g_ptr_array_index(task_group, i); + Taskbar *taskbar = (Taskbar *)task1->area.parent; + sort_tasks(taskbar); + } + } + } + } + if (task->current_state != state || hide_task_diff_monitor) { GPtrArray *task_group = task_get_tasks(task->win); if (task_group) {
M src/taskbar/task.hsrc/taskbar/task.h

@@ -74,6 +74,7 @@ int win_x;

int win_y; int win_w; int win_h; + struct timespec last_activation_time; } Task; Task *add_task(Window win);
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -522,6 +522,10 @@ } else if (taskbar_sort_method == TASKBAR_SORT_CENTER) {

return compare_task_centers(a, b, taskbar); } else if (taskbar_sort_method == TASKBAR_SORT_TITLE) { return compare_task_titles(a, b, taskbar); + } else if (taskbar_sort_method == TASKBAR_SORT_LRU) { + return compare_timespecs(&a->last_activation_time, &b->last_activation_time); + } else if (taskbar_sort_method == TASKBAR_SORT_MRU) { + return -compare_timespecs(&a->last_activation_time, &b->last_activation_time); } return 0; }
M src/taskbar/taskbar.hsrc/taskbar/taskbar.h

@@ -21,6 +21,8 @@ typedef enum TaskbarSortMethod {

TASKBAR_NOSORT = 0, TASKBAR_SORT_CENTER, TASKBAR_SORT_TITLE, + TASKBAR_SORT_LRU, + TASKBAR_SORT_MRU, } TaskbarSortMethod; extern GHashTable *win_to_task;