New config option: taskbar sort by LRU/MRU (no config GUI yet) (issue #532)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
- Enhancements:
|
- Enhancements:
|
||||||
- Support for NETWM viewports (as in Compiz) (issue #94)
|
- Support for NETWM viewports (as in Compiz) (issue #94)
|
||||||
- New plugin: executor
|
- New plugin: executor
|
||||||
|
- New taskbar sort order: least-recently-used (lru), most-recently-used (mru)
|
||||||
2015-11-12 0.12.3
|
2015-11-12 0.12.3
|
||||||
- Enhancements:
|
- Enhancements:
|
||||||
- Battery: Multiple batteries are now supported under Linux (issue #139;
|
- Battery: Multiple batteries are now supported under Linux (issue #139;
|
||||||
|
|||||||
@@ -749,6 +749,10 @@ void add_entry(char *key, char *value)
|
|||||||
taskbar_sort_method = TASKBAR_SORT_CENTER;
|
taskbar_sort_method = TASKBAR_SORT_CENTER;
|
||||||
} else if (strcmp(value, "title") == 0) {
|
} else if (strcmp(value, "title") == 0) {
|
||||||
taskbar_sort_method = TASKBAR_SORT_TITLE;
|
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 {
|
} else {
|
||||||
taskbar_sort_method = TASKBAR_NOSORT;
|
taskbar_sort_method = TASKBAR_NOSORT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -552,6 +552,20 @@ void set_task_state(Task *task, TaskState state)
|
|||||||
if (!task || state < 0 || state >= TASK_STATE_COUNT)
|
if (!task || state < 0 || state >= TASK_STATE_COUNT)
|
||||||
return;
|
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) {
|
if (task->current_state != state || hide_task_diff_monitor) {
|
||||||
GPtrArray *task_group = task_get_tasks(task->win);
|
GPtrArray *task_group = task_get_tasks(task->win);
|
||||||
if (task_group) {
|
if (task_group) {
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ typedef struct Task {
|
|||||||
int win_y;
|
int win_y;
|
||||||
int win_w;
|
int win_w;
|
||||||
int win_h;
|
int win_h;
|
||||||
|
struct timespec last_activation_time;
|
||||||
} Task;
|
} Task;
|
||||||
|
|
||||||
Task *add_task(Window win);
|
Task *add_task(Window win);
|
||||||
|
|||||||
@@ -522,6 +522,10 @@ gint compare_tasks(Task *a, Task *b, Taskbar *taskbar)
|
|||||||
return compare_task_centers(a, b, taskbar);
|
return compare_task_centers(a, b, taskbar);
|
||||||
} else if (taskbar_sort_method == TASKBAR_SORT_TITLE) {
|
} else if (taskbar_sort_method == TASKBAR_SORT_TITLE) {
|
||||||
return compare_task_titles(a, b, taskbar);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ typedef enum TaskbarSortMethod {
|
|||||||
TASKBAR_NOSORT = 0,
|
TASKBAR_NOSORT = 0,
|
||||||
TASKBAR_SORT_CENTER,
|
TASKBAR_SORT_CENTER,
|
||||||
TASKBAR_SORT_TITLE,
|
TASKBAR_SORT_TITLE,
|
||||||
|
TASKBAR_SORT_LRU,
|
||||||
|
TASKBAR_SORT_MRU,
|
||||||
} TaskbarSortMethod;
|
} TaskbarSortMethod;
|
||||||
|
|
||||||
extern GHashTable *win_to_task;
|
extern GHashTable *win_to_task;
|
||||||
|
|||||||
Reference in New Issue
Block a user