From 863ef0259c44a51b13edefe2c15989eb93a355f9 Mon Sep 17 00:00:00 2001 From: Benoit Averty Date: Sun, 4 Sep 2016 15:55:51 +0200 Subject: [PATCH] Add config option for the hide_if_empty behaviour --- src/config.c | 2 ++ src/taskbar/taskbar.c | 7 +++++-- src/taskbar/taskbar.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index 27ccb8c..a831ece 100644 --- a/src/config.c +++ b/src/config.c @@ -771,6 +771,8 @@ void add_entry(char *key, char *value) hide_inactive_tasks = atoi(value); } else if (strcmp(key, "taskbar_hide_different_monitor") == 0) { 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) { always_show_all_desktop_tasks = atoi(value); } else if (strcmp(key, "taskbar_sort_order") == 0) { diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index 5578a77..ea3e996 100644 --- a/src/taskbar/taskbar.c +++ b/src/taskbar/taskbar.c @@ -41,6 +41,7 @@ gboolean taskbar_enabled; gboolean taskbar_distribute_size; gboolean hide_inactive_tasks; gboolean hide_task_diff_monitor; +gboolean hide_taskbar_if_empty; gboolean always_show_all_desktop_tasks; TaskbarSortMethod taskbar_sort_method; Alignment taskbar_alignment; @@ -74,6 +75,7 @@ void default_taskbar() taskbar_distribute_size = FALSE; hide_inactive_tasks = FALSE; hide_task_diff_monitor = FALSE; + hide_taskbar_if_empty = FALSE; always_show_all_desktop_tasks = FALSE; taskbar_sort_method = TASKBAR_NOSORT; taskbar_alignment = ALIGN_LEFT; @@ -430,7 +432,7 @@ gboolean resize_taskbar(void *obj) return FALSE; } -gboolean taskbar_is_empty(Taskbar *taskbar) +gboolean taskbar_is_not_empty(Taskbar *taskbar) { GList *l = taskbar->area.children; if (taskbarname_enabled) @@ -448,7 +450,8 @@ void update_one_taskbar_visibility(Taskbar *taskbar) if (taskbar->desktop == server.desktop) { // Taskbar for current desktop is always shown 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 show(&taskbar->area); } else { diff --git a/src/taskbar/taskbar.h b/src/taskbar/taskbar.h index 92f71cb..7138916 100644 --- a/src/taskbar/taskbar.h +++ b/src/taskbar/taskbar.h @@ -49,6 +49,7 @@ extern gboolean taskbar_enabled; extern gboolean taskbar_distribute_size; extern gboolean hide_inactive_tasks; extern gboolean hide_task_diff_monitor; +extern gboolean hide_taskbar_if_empty; extern gboolean always_show_all_desktop_tasks; extern TaskbarSortMethod taskbar_sort_method; extern Alignment taskbar_alignment;