New config option: taskbar_always_show_all_desktop_tasks (fixes issue #279)

This commit is contained in:
o9000 2016-01-10 14:40:24 +01:00
parent 6ae4c0a9a8
commit ac5aefb52b
8 changed files with 31 additions and 5 deletions

View file

@ -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;

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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)

View file

@ -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"));

View file

@ -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;

View file

@ -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));