[RFC] [PATCH] Option to show blinking buttons from all workspaces in Window Button
Mathieu Chouquet-Stringer
mchouque at online.fr
Tue May 8 18:28:18 CEST 2012
Hello,
[Resending as I used the wrong email for the list)
I think Xfce used to have this feature (a long time ago or maybe I'm just
confused) where you could have blinking buttons for urgent windows which
are not in your current workspace.
Right now, blinking buttons only works if (or'ed):
- the urgent window is in your current workspace
- you have the "Show windows from all workspaces or viewports" enabled
There's even a bug open regarding this issue:
https://bugzilla.xfce.org/show_bug.cgi?id=6150
I also recall the "blinking on all workspaces" code was removed as some
people didn't really appreciate this feature. Specially given it wasn't
an option: it was the standard behavior, whether you'd like it or not.
I've never hacked Xfce or anything remotely gtk/X related so bear that
in mind when you read the following...
I've cloned xfce4-panel from git and created a patch to fix this.
Right now, it's an optional feature (disabled by default) called "Show
all blinking windows" (for a lack of creativity).
I certainly have to fix some styling issues (indenting in particular)
and to figure out how the whole i18n thing works but before I do this,
I'd like to get some feedback regarding this patch. Namely:
- Would it be acceptable?
- Did I miss anything? (of course I did but...)
- any other comments...
Thanks!
Stats:
tasklist-dialog.glade | 13 +++++++++++++
tasklist-widget.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------
tasklist.c | 2 ++
diff --git a/plugins/tasklist/tasklist-dialog.glade b/plugins/tasklist/tasklist-dialog.glade
index db6db74..e6583d8 100644
--- a/plugins/tasklist/tasklist-dialog.glade
+++ b/plugins/tasklist/tasklist-dialog.glade
@@ -293,6 +293,19 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="include-all-blinking">
+ <property name="label" translatable="yes">Show all _blinking windows</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 0f1991a..d0c6d7f 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -94,7 +94,8 @@ enum
PROP_SHOW_WIREFRAMES,
PROP_SHOW_HANDLE,
PROP_SORT_ORDER,
- PROP_WINDOW_SCROLLING
+ PROP_WINDOW_SCROLLING,
+ PROP_INCLUDE_ALL_BLINKING
};
struct _XfceTasklistClass
@@ -155,6 +156,10 @@ struct _XfceTasklist
/* switch window with the mouse wheel */
guint window_scrolling : 1;
+ /* whether we show blinking windows from all workspaces
+ * or only the active workspace */
+ guint all_blinking : 1;
+
/* whether we only show windows that are in the geometry of
* the monitor the tasklist is on */
guint all_monitors : 1;
@@ -460,6 +465,13 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
TRUE,
EXO_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_INCLUDE_ALL_BLINKING,
+ g_param_spec_boolean ("include-all-blinking",
+ NULL, NULL,
+ FALSE,
+ EXO_PARAM_READWRITE));
+
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("max-button-length",
NULL,
@@ -536,6 +548,7 @@ xfce_tasklist_init (XfceTasklist *tasklist)
tasklist->show_handle = TRUE;
tasklist->all_monitors = TRUE;
tasklist->window_scrolling = TRUE;
+ tasklist->all_blinking = FALSE;
xfce_tasklist_geometry_set_invalid (tasklist);
#ifdef GDK_WINDOWING_X11
tasklist->wireframe_window = 0;
@@ -622,6 +635,10 @@ xfce_tasklist_get_property (GObject *object,
g_value_set_boolean (value, tasklist->window_scrolling);
break;
+ case PROP_INCLUDE_ALL_BLINKING:
+ g_value_set_boolean (value, tasklist->all_blinking);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -692,6 +709,10 @@ xfce_tasklist_set_property (GObject *object,
tasklist->window_scrolling = g_value_get_boolean (value);
break;
+ case PROP_INCLUDE_ALL_BLINKING:
+ tasklist->all_blinking = g_value_get_boolean (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2220,7 +2241,9 @@ xfce_tasklist_button_visible (XfceTasklistChild *child,
|| (active_ws != NULL
&& (G_UNLIKELY (wnck_workspace_is_virtual (active_ws))
? wnck_window_is_in_viewport (child->window, active_ws)
- : wnck_window_is_on_workspace (child->window, active_ws))))
+ : wnck_window_is_on_workspace (child->window, active_ws)))
+ || (tasklist->all_blinking
+ && xfce_arrow_button_get_blinking (XFCE_ARROW_BUTTON (child->button))))
{
return (!tasklist->only_minimized
|| wnck_window_is_minimized (child->window));
@@ -2444,6 +2467,7 @@ xfce_tasklist_button_state_changed (WnckWindow *window,
gboolean blink;
WnckScreen *screen;
XfceTasklist *tasklist;
+ WnckWorkspace *active_ws;
panel_return_if_fail (WNCK_IS_WINDOW (window));
panel_return_if_fail (child->window == window);
@@ -2490,11 +2514,26 @@ xfce_tasklist_button_state_changed (WnckWindow *window,
if (PANEL_HAS_FLAG (changed_state, WNCK_WINDOW_STATE_DEMANDS_ATTENTION)
|| PANEL_HAS_FLAG (changed_state, WNCK_WINDOW_STATE_URGENT))
{
- /* only start blinking if the window requesting urgentcy
+ /* only start blinking if the window requesting urgency
* notification is not the active window */
blink = wnck_window_or_transient_needs_attention (window);
if (!blink || (blink && !wnck_window_is_active (window)))
+ {
+ /* if we have all_blinking set make sure we toggle visibility of the button
+ * in case the window is not in the current workspace */
+ active_ws = wnck_screen_get_active_workspace (child->tasklist->screen);
+ if (child->tasklist->all_blinking && blink
+ && !xfce_tasklist_button_visible (child, active_ws))
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (child->button), FALSE);
+ gtk_widget_show (child->button);
+ }
+
xfce_arrow_button_set_blinking (XFCE_ARROW_BUTTON (child->button), blink);
+
+ if (child->tasklist->all_blinking && !xfce_tasklist_button_visible (child, active_ws))
+ gtk_widget_hide (child->button);
+ }
}
}
@@ -2776,9 +2815,12 @@ xfce_tasklist_button_activate (XfceTasklistChild *child,
else
{
/* we only change worksapces/viewports for non-pinned windows
- * and if all workspaces/viewports are shown */
- if (child->tasklist->all_workspaces
- && !wnck_window_is_pinned (child->window))
+ * and if all workspaces/viewports are shown or if we have
+ * all blinking enabled and the current button is blinking */
+ if ((child->tasklist->all_workspaces
+ && !wnck_window_is_pinned (child->window)) ||
+ (child->tasklist->all_blinking
+ && xfce_arrow_button_get_blinking (XFCE_ARROW_BUTTON (child->button))))
{
workspace = wnck_window_get_workspace (child->window);
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index 8f12f5c..1780344 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -140,6 +140,7 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
{ "show-handle", G_TYPE_BOOLEAN },
{ "sort-order", G_TYPE_UINT },
{ "window-scrolling", G_TYPE_BOOLEAN },
+ { "include-all-blinking", G_TYPE_BOOLEAN },
{ NULL }
};
@@ -252,6 +253,7 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
TASKLIST_DIALOG_BIND ("show-handle", "active")
TASKLIST_DIALOG_BIND ("sort-order", "active")
TASKLIST_DIALOG_BIND ("window-scrolling", "active")
+ TASKLIST_DIALOG_BIND ("include-all-blinking", "active")
#ifndef GDK_WINDOWING_X11
/* not functional in x11, so avoid confusion */
--
Mathieu Chouquet-Stringer mchouque at online.fr
The sun itself sees not till heaven clears.
-- William Shakespeare --
More information about the Xfce4-dev
mailing list