Add config option for the hide_if_empty behaviour

This commit is contained in:
Benoit Averty
2016-09-04 15:55:51 +02:00
parent d765190e3d
commit 863ef0259c
3 changed files with 8 additions and 2 deletions

View File

@@ -771,6 +771,8 @@ void add_entry(char *key, char *value)
hide_inactive_tasks = atoi(value); hide_inactive_tasks = atoi(value);
} else if (strcmp(key, "taskbar_hide_different_monitor") == 0) { } else if (strcmp(key, "taskbar_hide_different_monitor") == 0) {
hide_task_diff_monitor = atoi(value); hide_task_diff_monitor = atoi(value);
} else if (strcmp(key, "taskbar_hide_if_empty") == 0) {
hide_taskbar_if_empty = atoi(value);
} else if (strcmp(key, "taskbar_always_show_all_desktop_tasks") == 0) { } else if (strcmp(key, "taskbar_always_show_all_desktop_tasks") == 0) {
always_show_all_desktop_tasks = atoi(value); always_show_all_desktop_tasks = atoi(value);
} else if (strcmp(key, "taskbar_sort_order") == 0) { } else if (strcmp(key, "taskbar_sort_order") == 0) {

View File

@@ -41,6 +41,7 @@ gboolean taskbar_enabled;
gboolean taskbar_distribute_size; gboolean taskbar_distribute_size;
gboolean hide_inactive_tasks; gboolean hide_inactive_tasks;
gboolean hide_task_diff_monitor; gboolean hide_task_diff_monitor;
gboolean hide_taskbar_if_empty;
gboolean always_show_all_desktop_tasks; gboolean always_show_all_desktop_tasks;
TaskbarSortMethod taskbar_sort_method; TaskbarSortMethod taskbar_sort_method;
Alignment taskbar_alignment; Alignment taskbar_alignment;
@@ -74,6 +75,7 @@ void default_taskbar()
taskbar_distribute_size = FALSE; taskbar_distribute_size = FALSE;
hide_inactive_tasks = FALSE; hide_inactive_tasks = FALSE;
hide_task_diff_monitor = FALSE; hide_task_diff_monitor = FALSE;
hide_taskbar_if_empty = FALSE;
always_show_all_desktop_tasks = FALSE; always_show_all_desktop_tasks = FALSE;
taskbar_sort_method = TASKBAR_NOSORT; taskbar_sort_method = TASKBAR_NOSORT;
taskbar_alignment = ALIGN_LEFT; taskbar_alignment = ALIGN_LEFT;
@@ -430,7 +432,7 @@ gboolean resize_taskbar(void *obj)
return FALSE; return FALSE;
} }
gboolean taskbar_is_empty(Taskbar *taskbar) gboolean taskbar_is_not_empty(Taskbar *taskbar)
{ {
GList *l = taskbar->area.children; GList *l = taskbar->area.children;
if (taskbarname_enabled) if (taskbarname_enabled)
@@ -448,7 +450,8 @@ void update_one_taskbar_visibility(Taskbar *taskbar)
if (taskbar->desktop == server.desktop) { if (taskbar->desktop == server.desktop) {
// Taskbar for current desktop is always shown // Taskbar for current desktop is always shown
show(&taskbar->area); show(&taskbar->area);
} else if (taskbar_mode == MULTI_DESKTOP && taskbar_is_empty(taskbar)) { }
else if (taskbar_mode == MULTI_DESKTOP && (taskbar_is_not_empty(taskbar) || hide_taskbar_if_empty == FALSE)) {
// MULTI_DESKTOP : show non-empty taskbars // MULTI_DESKTOP : show non-empty taskbars
show(&taskbar->area); show(&taskbar->area);
} else { } else {

View File

@@ -49,6 +49,7 @@ extern gboolean taskbar_enabled;
extern gboolean taskbar_distribute_size; extern gboolean taskbar_distribute_size;
extern gboolean hide_inactive_tasks; extern gboolean hide_inactive_tasks;
extern gboolean hide_task_diff_monitor; extern gboolean hide_task_diff_monitor;
extern gboolean hide_taskbar_if_empty;
extern gboolean always_show_all_desktop_tasks; extern gboolean always_show_all_desktop_tasks;
extern TaskbarSortMethod taskbar_sort_method; extern TaskbarSortMethod taskbar_sort_method;
extern Alignment taskbar_alignment; extern Alignment taskbar_alignment;