From ac5aefb52b47e4afd96aafa59c51590ae10d9446 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sun, 10 Jan 2016 14:40:24 +0100 Subject: [PATCH] New config option: taskbar_always_show_all_desktop_tasks (fixes issue #279) --- src/config.c | 2 ++ src/taskbar/task.c | 4 ++-- src/taskbar/taskbar.c | 2 ++ src/taskbar/taskbar.h | 1 + src/tint.c | 2 +- src/tint2conf/properties.c | 19 ++++++++++++++++++- src/tint2conf/properties.h | 2 +- src/tint2conf/properties_rw.c | 4 ++++ 8 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 3644a57..850b0e4 100644 --- a/src/config.c +++ b/src/config.c @@ -758,6 +758,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_always_show_all_desktop_tasks") == 0) { + always_show_all_desktop_tasks = atoi(value); } else if (strcmp(key, "taskbar_sort_order") == 0) { if (strcmp(value, "center") == 0) { taskbar_sort_method = TASKBAR_SORT_CENTER; diff --git a/src/taskbar/task.c b/src/taskbar/task.c index b00744c..ad52ddc 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -104,7 +104,7 @@ Task *add_task(Window win) task_instance->current_state = TASK_UNDEFINED; // to update the current state later in set_task_state... if (task_instance->desktop == ALL_DESKTOPS && server.desktop != j) { // fprintf(stderr, "%s %d: win = %ld hiding task: another desktop\n", __FUNCTION__, __LINE__, win); - task_instance->area.on_screen = FALSE; + task_instance->area.on_screen = always_show_all_desktop_tasks; } task_instance->title = task_template.title; if (panels[monitor].g_task.tooltip_enabled) @@ -562,7 +562,7 @@ void set_task_state(Task *task, TaskState state) Taskbar *taskbar = (Taskbar *)task1->area.parent; if (task->desktop == ALL_DESKTOPS && server.desktop != taskbar->desktop) { // Hide ALL_DESKTOPS task on non-current desktop - hide = TRUE; + hide = !always_show_all_desktop_tasks; } if (hide_inactive_tasks) { // Show only the active task diff --git a/src/taskbar/taskbar.c b/src/taskbar/taskbar.c index dd033fd..9ffdca8 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 always_show_all_desktop_tasks; TaskbarSortMethod taskbar_sort_method; Alignment taskbar_alignment; @@ -73,6 +74,7 @@ void default_taskbar() taskbar_distribute_size = FALSE; hide_inactive_tasks = FALSE; hide_task_diff_monitor = FALSE; + always_show_all_desktop_tasks = FALSE; taskbar_sort_method = TASKBAR_NOSORT; taskbar_alignment = ALIGN_LEFT; default_taskbarname(); diff --git a/src/taskbar/taskbar.h b/src/taskbar/taskbar.h index 0ed97ca..886f8c0 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 always_show_all_desktop_tasks; extern TaskbarSortMethod taskbar_sort_method; extern Alignment taskbar_alignment; diff --git a/src/tint.c b/src/tint.c index d6247c6..3117656 100644 --- a/src/tint.c +++ b/src/tint.c @@ -978,7 +978,7 @@ void event_property_notify(XEvent *e) for (; l; l = l->next) { Task *task = l->data; if (task->desktop == ALL_DESKTOPS) { - task->area.on_screen = FALSE; + task->area.on_screen = always_show_all_desktop_tasks; taskbar->area.resize_needed = 1; panel_refresh = TRUE; if (taskbar_mode == MULTI_DESKTOP) diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index 2c9716a..10f4acd 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -55,7 +55,7 @@ GtkWidget *taskbar_name_padding_x, *taskbar_name_padding_y, *taskbar_name_inacti GtkWidget *taskbar_name_font, *taskbar_name_font_set; GtkWidget *taskbar_active_background, *taskbar_inactive_background; GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background; -GtkWidget *taskbar_distribute_size, *taskbar_sort_order, *taskbar_alignment; +GtkWidget *taskbar_distribute_size, *taskbar_sort_order, *taskbar_alignment, *taskbar_always_show_all_desktop_tasks; // task GtkWidget *task_mouse_left, *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down; @@ -2910,6 +2910,23 @@ void create_taskbar(GtkWidget *parent) gtk_tooltips_set_tip(tooltips, taskbar_hide_diff_monitor, _("If enabled, tasks that are not on the same monitor as the panel will not be displayed. " "This behavior is enabled automatically if the panel monitor is set to 'All'."), NULL); + + col = 2; + row++; + label = gtk_label_new(_("Always show all desktop tasks")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + + taskbar_always_show_all_desktop_tasks = gtk_check_button_new(); + gtk_widget_show(taskbar_always_show_all_desktop_tasks); + gtk_table_attach(GTK_TABLE(table), taskbar_always_show_all_desktop_tasks, col, col+1, row, row+1, GTK_FILL, 0, 0, 0); + col++; + gtk_tooltips_set_tip(tooltips, taskbar_always_show_all_desktop_tasks, _("Has effect only if 'Show a taskbar for each desktop' is enabled. " + "If enabled, tasks that appear on all desktops are shown on all taskbars. " + "Otherwise, they are shown only on the taskbar of the current desktop."), NULL); + row++; col = 2; label = gtk_label_new(_("Task sorting")); diff --git a/src/tint2conf/properties.h b/src/tint2conf/properties.h index 1fe1f07..fd8812b 100644 --- a/src/tint2conf/properties.h +++ b/src/tint2conf/properties.h @@ -56,7 +56,7 @@ extern GtkWidget *taskbar_name_padding_x, *taskbar_name_padding_y, *taskbar_name extern GtkWidget *taskbar_name_font, *taskbar_name_font_set; extern GtkWidget *taskbar_active_background, *taskbar_inactive_background; extern GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background; -extern GtkWidget *taskbar_distribute_size, *taskbar_sort_order, *taskbar_alignment; +extern GtkWidget *taskbar_distribute_size, *taskbar_sort_order, *taskbar_alignment, *taskbar_always_show_all_desktop_tasks; // task extern GtkWidget *task_mouse_left, *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down; diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index 1602670..71f7f04 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -284,6 +284,7 @@ void config_write_taskbar(FILE *fp) fprintf(fp, "taskbar_name = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_show_name)) ? 1 : 0); fprintf(fp, "taskbar_hide_inactive_tasks = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_inactive_tasks)) ? 1 : 0); fprintf(fp, "taskbar_hide_different_monitor = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_monitor)) ? 1 : 0); + fprintf(fp, "taskbar_always_show_all_desktop_tasks = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_always_show_all_desktop_tasks)) ? 1 : 0); fprintf(fp, "taskbar_name_padding = %d %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_name_padding_x)), @@ -1305,6 +1306,9 @@ void add_entry(char *key, char *value) else if (strcmp(key, "taskbar_hide_different_monitor") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_monitor), atoi(value)); } + else if (strcmp(key, "taskbar_always_show_all_desktop_tasks") == 0) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_always_show_all_desktop_tasks), atoi(value)); + } else if (strcmp(key, "taskbar_name_padding") == 0) { extract_values(value, &value1, &value2, &value3); gtk_spin_button_set_value(GTK_SPIN_BUTTON(taskbar_name_padding_x), atoi(value1));