all repos — tint2 @ f5a18cc4f49100667bc6344883a9f2399e3f47b2

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

Option taskbar_hide_inactive_tasks (issue 458)

git-svn-id: http://tint2.googlecode.com/svn/trunk@732 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
o9000 o9000
commit

f5a18cc4f49100667bc6344883a9f2399e3f47b2

parent

c583ea42eb7f2f904ada851438b987e0f768ac29

M src/config.csrc/config.c

@@ -497,6 +497,9 @@ get_color (value1, taskbarname_active_font.color);

if (value2) taskbarname_active_font.alpha = (atoi (value2) / 100.0); else taskbarname_active_font.alpha = 0.5; } + else if (strcmp (key, "taskbar_hide_inactive_tasks") == 0) { + hide_inactive_tasks = atoi (value); + } /* Task */ else if (strcmp (key, "task_text") == 0)
M src/taskbar/task.csrc/taskbar/task.c

@@ -541,6 +541,19 @@ if (tsk1->state_pix[state] == 0)

tsk1->area.redraw = 1; if (state == TASK_ACTIVE && g_slist_find(urgent_list, tsk1)) del_urgent(tsk1); + // Show only the active task + if (hide_inactive_tasks) { + if (state != TASK_ACTIVE) { + tsk1->area.on_screen = 0; + } else { + tsk1->area.on_screen = 1; + } + set_task_redraw(tsk1); + Panel *p = (Panel*)tsk->area.panel; + tsk->area.resize = 1; + p->taskbar->area.resize = 1; + p->area.resize = 1; + } } panel_refresh = 1; }
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -43,6 +43,7 @@ Task *task_active;

Task *task_drag; int taskbar_enabled; int taskbar_distribute_size; +int hide_inactive_tasks; guint win_hash(gconstpointer key) { return (guint)*((Window*)key); } gboolean win_compare(gconstpointer a, gconstpointer b) { return (*((Window*)a) == *((Window*)b)); }

@@ -56,6 +57,7 @@ urgent_timeout = 0;

urgent_list = 0; taskbar_enabled = 0; taskbar_distribute_size = 0; + hide_inactive_tasks = 0; default_taskbarname(); }
M src/taskbar/taskbar.hsrc/taskbar/taskbar.h

@@ -17,6 +17,7 @@ extern Task *task_active;

extern Task *task_drag; extern int taskbar_enabled; extern int taskbar_distribute_size; +extern int hide_inactive_tasks; typedef struct { // always start with area
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -41,6 +41,7 @@ GtkWidget *panel_background;

// taskbar GtkWidget *taskbar_show_desktop, *taskbar_show_name, *taskbar_padding_x, *taskbar_padding_y, *taskbar_spacing; +GtkWidget *taskbar_hide_inactive_tasks; GtkWidget *taskbar_name_padding_x, *taskbar_name_inactive_color, *taskbar_name_active_color, *taskbar_name_font; GtkWidget *taskbar_active_background, *taskbar_inactive_background; GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background;

@@ -1875,7 +1876,7 @@ void create_taskbar(GtkWidget *parent)

{ GtkWidget *table, *label; - table = gtk_table_new(2, 2, FALSE); + table = gtk_table_new(3, 2, FALSE); gtk_widget_show(table); gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0); gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);

@@ -1898,6 +1899,15 @@

taskbar_show_name = gtk_check_button_new(); gtk_widget_show(taskbar_show_name); gtk_table_attach(GTK_TABLE(table), taskbar_show_name, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); + + label = gtk_label_new(_("Hide inactive tasks")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); + + taskbar_hide_inactive_tasks = gtk_check_button_new(); + gtk_widget_show(taskbar_hide_inactive_tasks); + gtk_table_attach(GTK_TABLE(table), taskbar_hide_inactive_tasks, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); change_paragraph(parent);
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -46,6 +46,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; extern GtkWidget *taskbar_name_padding_x, *taskbar_name_inactive_color, *taskbar_name_active_color, *taskbar_name_font; extern GtkWidget *taskbar_active_background, *taskbar_inactive_background; extern GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background;
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -191,6 +191,7 @@ (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_spacing)));

fprintf(fp, "taskbar_background_id = %d\n", 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_inactive_background))); fprintf(fp, "taskbar_active_background_id = %d\n", 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(taskbar_active_background))); 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_name_padding = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(taskbar_name_padding_x)));

@@ -870,6 +871,9 @@ gtk_combo_box_set_active(GTK_COMBO_BOX(taskbar_active_background), id);

} else if (strcmp(key, "taskbar_name") == 0) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(taskbar_show_name), atoi(value)); + } + 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_name_padding") == 0) { extract_values(value, &value1, &value2, &value3);