You are not logged in.
Hi everyone,
since this is my first post in this board, I want to say that I love the Xfce desktop environment and have been using it exclusively for about a year now after trying many others, like LXDE, Unity, Gnome and KDE. I just find it to be the most beautiful and snappy to use, so I would like to thank everyone who contributed to it and put in work and effort to improve it over the years, as a happy user.
There's one thing that bothers me about the Panel and maybe there's a solution for it that I have not found yet.
I use different workspaces a lot. Currently, I'm running Ubuntu Studio 16.04 with the addition of WINE and some Windows Software for multimedia editing, which sometimes wants its own workspace, because some windows overlap others, this is not a big issue by itself.
However, I tend to have many open tabs/programs in the Panel and need to switch between them quickly (also to other workspaces), so I set the xfce4-tasklist plugin to show open tabs on all workspaces in the panel. This works well, but can get a bit confusing if many different tabs are opened. Another issue is that as soon as I try to move one open program window to another workspace where I need it, I have to find out on which workspace the program is that I want to move it to, because I am unable to see what program is currently open on which workspace.
Then I saw this screenshot and I thought to myself, how great it would be to be able to separate the open tabs by workspaces (as seen on the left):
I don't know what desktop environment this is, but I would really like to have the same setup on my Xfce Panel.
Now, I am not a developer and unfortunately, I don't know where to start. The way I see it, there are two ways to get this done by using the standard Xfce plugins:
1. If the "tasklist"-plugin would be able to not only show the tabs open on the "current workspace" or on "all workspaces", but also on a "specific workspace" that can be set by the user (e.g. "show only tabs on workspace 1,2,3, etc.") - Then it would be possible to simply add the plugin to the Panel four times and set each one to a different workspace (1-4 in my case).
2. The "windowmenu"-plugin is able to display all open tabs exactly the way that it is shown in the screenshot, but it does so by opening a sub-menu in the Panel and not as icons on the Panel directly, which limits the usability, because a relatively small menu must be navigated before being able to access the tabs. If the workspaces could be listed directly on the Panel, that might work, but I haven't seen a setting for this.
(3. Another way would be that someone already wrote a plugin that exactly does what I need, however I haven't been able to find anything so far, but maybe there is one and I just haven't seen it yet.)
I would be very glad if you would share any suggestions or ideas with me on this, because it is basically the only thing that I still miss about Xfce on an almost daily basis and I think it would be a great addition to the Panel features. Is there a way for me to set this up without being able to program?
Kind regards you all! :)
Last edited by Megadoomer (2017-02-17 13:29:46)
Offline
Hello and welcome.
That screenshot looks like tint2 with taskbar_mode set to multi_desktop.
AFAIK, none of the Xfce plugins can do that.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Hi ToZ, thanks for your reply!
AFAIK, none of the Xfce plugins can do that.
That's what I figured, too. I've just seen that this is actually the second entry on the Taskbar wishlist currently. I also had a look at tint2, but it appears that switching to this panel would result in a whole lot of other issues and I'm not in the mood for that, either.
I read that you have some development experience, do you think one of the suggestions in my first post would be feasible? As I mentioned, I don't really have much "programming" experience (except for a bit of PHP and JavaScript), but let's just say that I reconise a function and could probably figure something out with a couple of tutorials. I would really like to at least have a look at the way the tasklist-plugin sets up the tabs in the panel.
I was considering, maybe it's possible to copy the plugin four times and subtract three of the workspaces from the full tab-display, so each copy ends up displaying only the windows opened on one workspace. Then I would add all four of these modified plugins in the correct order to my panel and separate them with a simple space or a line separator to have a bit of visual distinction.
Again, I can't tell how feasible that would be and to be honest, I don't even know where to find the source code for the plugin, but maybe you or someone else who has more programming experience than me is able to tell me right away if that would even work or if there's another way..
Offline
I don't even know where to find the source code for the plugin,
All of the code is available at here. You can view it for both the Window Buttons (tasklist) or the taskbar plugin.
but maybe you or someone else who has more programming experience than me is able to tell me right away if that would even work or if there's another way.
The proper way to do this would be to add another parameter or option that would allow you to specify the workspace to use for the plugin. Then add one copy of the plugin for each workspace and specify the workspace to use for that plugin.
.....
Ok, you created that itch that needed to be scratched. Here is a "first crack" at it:
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 53174a99..27a9e3c7 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -81,6 +81,7 @@ enum
PROP_0,
PROP_GROUPING,
PROP_INCLUDE_ALL_WORKSPACES,
+ PROP_USE_WORKSPACE,
PROP_INCLUDE_ALL_MONITORS,
PROP_FLAT_BUTTONS,
PROP_SWITCH_WORKSPACE_ON_UNMINIMIZE,
@@ -138,6 +139,10 @@ struct _XfceTasklist
/* whether we show windows from all workspaces or
* only the active workspace */
guint all_workspaces : 1;
+
+ /* specify a workspace whose windows will be
+ * displayed regardless of actual workspace */
+ gint use_workspace;
/* whether we switch to another workspace when we try to
* unminimize a window on another workspace */
@@ -339,6 +344,8 @@ static XfceTasklistChild *xfce_tasklist_group_button_new (WnckCl
/* potential public functions */
static void xfce_tasklist_set_include_all_workspaces (XfceTasklist *tasklist,
gboolean all_workspaces);
+static void xfce_tasklist_set_use_workspace (XfceTasklist *tasklist,
+ gint use_workspace);
static void xfce_tasklist_set_include_all_monitors (XfceTasklist *tasklist,
gboolean all_monitors);
static void xfce_tasklist_set_button_relief (XfceTasklist *tasklist,
@@ -402,6 +409,13 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
NULL, NULL,
FALSE,
EXO_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_USE_WORKSPACE,
+ g_param_spec_int ("use-workspace",
+ NULL, NULL,
+ -1, 12, -1,
+ EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_INCLUDE_ALL_MONITORS,
@@ -559,6 +573,7 @@ xfce_tasklist_init (XfceTasklist *tasklist)
tasklist->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
tasklist->nrows = 1;
tasklist->all_workspaces = FALSE;
+ tasklist->use_workspace = -1;
tasklist->button_relief = GTK_RELIEF_NORMAL;
tasklist->switch_workspace = TRUE;
tasklist->only_minimized = FALSE;
@@ -621,6 +636,10 @@ xfce_tasklist_get_property (GObject *object,
case PROP_INCLUDE_ALL_WORKSPACES:
g_value_set_boolean (value, tasklist->all_workspaces);
break;
+
+ case PROP_USE_WORKSPACE:
+ g_value_set_int (value, tasklist->use_workspace);
+ break;
case PROP_INCLUDE_ALL_MONITORS:
g_value_set_boolean (value, tasklist->all_monitors);
@@ -696,6 +715,10 @@ xfce_tasklist_set_property (GObject *object,
case PROP_INCLUDE_ALL_WORKSPACES:
xfce_tasklist_set_include_all_workspaces (tasklist, g_value_get_boolean (value));
break;
+
+ case PROP_USE_WORKSPACE:
+ xfce_tasklist_set_use_workspace (tasklist, g_value_get_int (value));
+ break;
case PROP_INCLUDE_ALL_MONITORS:
xfce_tasklist_set_include_all_monitors (tasklist, g_value_get_boolean (value));
@@ -1617,7 +1640,11 @@ xfce_tasklist_active_workspace_changed (WnckScreen *screen,
return;
/* walk all the children and update their visibility */
- active_ws = wnck_screen_get_active_workspace (screen);
+ if (tasklist->use_workspace > -1)
+ active_ws = wnck_screen_get_workspace (screen, tasklist->use_workspace);
+ else
+ active_ws = wnck_screen_get_active_workspace (screen);
+
for (li = tasklist->windows; li != NULL; li = li->next)
{
child = li->data;
@@ -1662,9 +1689,16 @@ xfce_tasklist_window_added (WnckScreen *screen,
/* create new window button */
child = xfce_tasklist_button_new (window, tasklist);
- /* initial visibility of the function */
- if (xfce_tasklist_button_visible (child, wnck_screen_get_active_workspace (screen)))
- gtk_widget_show (child->button);
+ /* initial visibility of the function - dependent on use_workspace if used*/
+ if (xfce_tasklist_button_visible (child, wnck_screen_get_active_workspace (screen))) {
+ if (tasklist->use_workspace > -1) {
+ if (wnck_screen_get_active_workspace (screen) == wnck_screen_get_workspace (screen, tasklist->use_workspace))
+ gtk_widget_show (child->button);
+ }
+ else
+ gtk_widget_show (child->button);
+ }
+
if (G_LIKELY (child->class_group != NULL))
{
@@ -1799,7 +1833,11 @@ xfce_tasklist_viewports_changed (WnckScreen *screen,
/* pretend we changed workspace, this will update the
* visibility of all the buttons */
- active_ws = wnck_screen_get_active_workspace (screen);
+ if (tasklist->use_workspace > -1)
+ active_ws = wnck_screen_get_workspace (screen, tasklist->use_workspace);
+ else
+ active_ws = wnck_screen_get_active_workspace (screen);
+
xfce_tasklist_active_workspace_changed (screen, active_ws, tasklist);
}
@@ -2575,7 +2613,11 @@ xfce_tasklist_button_state_changed (WnckWindow *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 (tasklist->use_workspace > -1)
+ active_ws = wnck_screen_get_workspace (screen, tasklist->use_workspace);
+ else
+ active_ws = wnck_screen_get_active_workspace (child->tasklist->screen);
+
if (child->tasklist->all_blinking && blink
&& !xfce_tasklist_button_visible (child, active_ws))
{
@@ -2628,6 +2670,7 @@ xfce_tasklist_button_geometry_changed2 (WnckWindow *window,
{
/* check if we need to change the visibility of the button */
active_ws = wnck_screen_get_active_workspace (child->tasklist->screen);
+
if (xfce_tasklist_button_visible (child, active_ws))
gtk_widget_show (child->button);
else
@@ -3159,6 +3202,7 @@ xfce_tasklist_button_new (WnckWindow *window,
xfce_tasklist_button_icon_changed (window, child);
xfce_tasklist_button_name_changed (NULL, child);
+
/* insert */
tasklist->windows = g_list_insert_sorted_with_data (tasklist->windows, child,
xfce_tasklist_button_compare,
@@ -3735,6 +3779,28 @@ xfce_tasklist_set_include_all_workspaces (XfceTasklist *tasklist,
}
}
+static void
+xfce_tasklist_set_use_workspace (XfceTasklist *tasklist,
+ gint use_workspace)
+{
+ panel_return_if_fail (XFCE_IS_TASKLIST (tasklist));
+
+ if (tasklist->use_workspace != use_workspace)
+ {
+ tasklist->use_workspace = use_workspace;
+
+ if (tasklist->screen != NULL)
+ {
+ /* update visibility of buttons */
+ xfce_tasklist_active_workspace_changed (tasklist->screen,
+ NULL, tasklist);
+
+ /* make sure sorting is ok */
+ xfce_tasklist_sort (tasklist);
+ }
+ }
+}
+
static void
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index fdea3044..06007da8 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -132,6 +132,7 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
{ "show-labels", G_TYPE_BOOLEAN },
{ "grouping", G_TYPE_UINT },
{ "include-all-workspaces", G_TYPE_BOOLEAN },
+ { "use-workspace", G_TYPE_INT },
{ "include-all-monitors", G_TYPE_BOOLEAN },
{ "flat-buttons", G_TYPE_BOOLEAN },
{ "switch-workspace-on-unminimize", G_TYPE_BOOLEAN },
Apply this patch to the xfce4-panel source from git and build/install the package (preferably in a VM somewhere first so you don't risk your production system to test it). The patch works on my system.
This patch creates and uses a new (currently hidden) xfconf paramter called "use-workspace". If this is specified, it will force the Windows Buttons plugin to only display windows from that workspace. To create the parameter, first get the plugin value (you can get this by hovering over the plugin on the items tab). It will be something like "tasklist-1" - the "1" is what you need. Then run this command to create the key:
xfconf-query -c xfce4-panel -n -t int -p /plugins/plugin-1/use-workspace -s 0
...change the one (1) in "plugin-1" to match the value from the previous step and change the zero (0) in "use-workspace -s 0" to match the number of the workspace that you want it tied to (workspace numbering starts at 0).
To revert back to default, change the workspace to -1.
Here is a screenie to demonstrate:
Left side tasklist displays workspace 0 icons, centre tasklist displays workspace 1 icons and right tasklist displays workspace 2 icons.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Awesome!!! But I have one question: How do I apply the patch?
And I have a wish for xfce: I want that window buttons plugin stick launchers, so we can use super lightweight docks on xfce with the window buttons plugin!!
I think Xfce need this stuff!
thanks
Offline
An enhancement request for this functionality already existed in the bug tracker, so I posted this patch there. See Bug 11303.
How do I apply the patch?
Since you are using ubuntu 16.04, I believe this wiki article is what you need to follow.
And I have a wish for xfce: I want that window buttons plugin stick launchers, so we can use super lightweight docks on xfce with the window buttons plugin!!
I' ve heard/read this request often. The current priority for Xfce is the gtk3 migration. After that is complete, we'll just need to find someone to program this functionality.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Hello ToZ,
sorry for my late reply. Thank you so much for figuring this out, I haven't expected to get a fully written solution right away.
Unfortunately, it's been a bit busy lately and I haven't had a chance to try out the patch, but I'll see to it that I test it very soon. Thanks also for that link on how to install the patch, that will come in handy for me as well.
I'll let you know how it works for me.
Thanks again!
Offline
[ Generated in 0.021 seconds, 7 queries executed - Memory usage: 606.86 KiB (Peak: 624.14 KiB) ]