all repos — tint2 @ d55f6d7baa56eb8ce8ca2d70a70e6f263b26ee64

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

taskbar_hide_different_desktop
o9000 mrovi9000@gmail.com
commit

d55f6d7baa56eb8ce8ca2d70a70e6f263b26ee64

parent

2dfcab170d983d14ff514c3ae4ff22d4e0f50953

M ChangeLogChangeLog

@@ -1,3 +1,7 @@

+2017-06-20 master +- Enhancements: + - Taskbar: new config option taskbar_hide_different_desktop + 2017-06-11 0.14.6 - Fixes: - Take into account border width when computing text height
M doc/tint2.mddoc/tint2.md

@@ -370,6 +370,8 @@ * `taskbar_hide_inactive_tasks = boolean (0 or 1)` : If enabled, the taskbar shows only the active task. *(since 0.12)*

* `taskbar_hide_different_monitor = boolean (0 or 1)` : If enabled, the taskbar shows only the tasks from the current monitor. Useful when running different tint2 instances on different monitors, each one having its own config. *(since 0.12)* + * `taskbar_hide_different_desktop = boolean (0 or 1)` : If enabled, the taskbar shows only the tasks from the current desktop. Useful to make multi-desktop taskbars more compact, but still allow desktop switching with mouse click. *(since 0.15)* + * `taskbar_always_show_all_desktop_tasks = boolean (0 or 1)` : Has effect only if `taskbar_mode = multi_desktop`. 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. *(since 0.12.4)* * `taskbar_sort_order = none/title/center` : Specifies the sort order of the tasks on the taskbar. *(since 0.12)*
M src/config.csrc/config.c

@@ -960,6 +960,8 @@ } else if (strcmp(key, "taskbar_hide_inactive_tasks") == 0) {

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_different_desktop") == 0) { + hide_task_diff_desktop = 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) {
M src/taskbar/task.csrc/taskbar/task.c

@@ -624,7 +624,7 @@ }

} } - if (task->current_state != state || hide_task_diff_monitor) { + if (task->current_state != state || hide_task_diff_monitor || hide_task_diff_desktop) { GPtrArray *task_buttons = get_task_buttons(task->win); if (task_buttons) { for (int i = 0; i < task_buttons->len; ++i) {

@@ -647,6 +647,10 @@ // Show only the active task

if (state != TASK_ACTIVE) { hide = TRUE; } + } + if (hide_task_diff_desktop) { + if (taskbar->desktop != server.desktop) + hide = TRUE; } if (get_window_monitor(task->win) != ((Panel *)task->area.panel)->monitor && (hide_task_diff_monitor || num_panels > 1)) {
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -39,6 +39,7 @@ Task *active_task;

Task *task_drag; gboolean taskbar_enabled; gboolean taskbar_distribute_size; +gboolean hide_task_diff_desktop; gboolean hide_inactive_tasks; gboolean hide_task_diff_monitor; gboolean hide_taskbar_if_empty;

@@ -74,6 +75,7 @@ urgent_timeout = NULL;

urgent_list = NULL; taskbar_enabled = FALSE; taskbar_distribute_size = FALSE; + hide_task_diff_desktop = FALSE; hide_inactive_tasks = FALSE; hide_task_diff_monitor = FALSE; hide_taskbar_if_empty = FALSE;

@@ -534,6 +536,15 @@ if (taskbarname_enabled)

l = l->next; for (; l; l = l->next) schedule_redraw((Area *)l->data); + } + if (taskbar_mode == MULTI_DESKTOP && hide_task_diff_desktop) { + GList *l = taskbar->area.children; + if (taskbarname_enabled) + l = l->next; + for (; l; l = l->next) { + Task *task = (Task *)l->data; + set_task_state(task, task->current_state); + } } } schedule_panel_redraw();
M src/taskbar/taskbar.hsrc/taskbar/taskbar.h

@@ -49,6 +49,7 @@ } GlobalTaskbar;

extern gboolean taskbar_enabled; extern gboolean taskbar_distribute_size; +extern gboolean hide_task_diff_desktop; extern gboolean hide_inactive_tasks; extern gboolean hide_task_diff_monitor; extern gboolean hide_taskbar_if_empty;
M src/tint.csrc/tint.c

@@ -917,6 +917,8 @@ task_drag->area.parent = &event_taskbar->area;

task_drag->desktop = event_taskbar->desktop; change_window_desktop(task_drag->win, event_taskbar->desktop); + if (hide_task_diff_desktop) + change_desktop(event_taskbar->desktop); if (taskbar_sort_method != TASKBAR_NOSORT) { sort_tasks(event_taskbar);
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -44,7 +44,7 @@ GtkWidget *notebook;

// taskbar GtkWidget *taskbar_show_desktop, *taskbar_show_name, *taskbar_padding_x, *taskbar_padding_y, *taskbar_spacing; -GtkWidget *taskbar_hide_inactive_tasks, *taskbar_hide_diff_monitor; +GtkWidget *taskbar_hide_inactive_tasks, *taskbar_hide_diff_monitor, *taskbar_hide_diff_desktop; GtkWidget *taskbar_name_padding_x, *taskbar_name_padding_y, *taskbar_name_inactive_color, *taskbar_name_active_color; GtkWidget *taskbar_name_font, *taskbar_name_font_set; GtkWidget *taskbar_active_background, *taskbar_inactive_background;

@@ -2650,6 +2650,19 @@ 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(_("Hide tasks from different desktops")); + 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_hide_diff_desktop = gtk_check_button_new(); + gtk_widget_show(taskbar_hide_diff_desktop); + gtk_table_attach(GTK_TABLE(table), taskbar_hide_diff_desktop, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; col = 2; row++;
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -49,7 +49,7 @@ #define POS_BRH 11

// taskbar extern GtkWidget *taskbar_show_desktop, *taskbar_show_name, *taskbar_padding_x, *taskbar_padding_y, *taskbar_spacing; -extern GtkWidget *taskbar_hide_inactive_tasks, *taskbar_hide_diff_monitor; +extern GtkWidget *taskbar_hide_inactive_tasks, *taskbar_hide_diff_monitor, *taskbar_hide_diff_desktop; extern GtkWidget *taskbar_name_padding_x, *taskbar_name_padding_y, *taskbar_name_inactive_color, *taskbar_name_active_color; extern GtkWidget *taskbar_name_font, *taskbar_name_font_set;
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -402,6 +402,9 @@ 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_hide_different_desktop = %d\n", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_desktop)) ? 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,

@@ -1551,6 +1554,8 @@ } else if (strcmp(key, "taskbar_hide_inactive_tasks") == 0) {

gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_hide_inactive_tasks), atoi(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_hide_different_desktop") == 0) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_hide_diff_desktop), 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) {