From 0cbcf0e7c8a92746ba2d0f519e8a3d2d1c127b7d Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sun, 27 Jul 2014 13:33:13 +0300 Subject: [PATCH] Improve twp and xfdesktop 4.11 Improve Thunar Wallpaper plugin to handle xfdesktop's single workspace mode. --- plugins/thunar-wallpaper/twp-provider.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/plugins/thunar-wallpaper/twp-provider.c b/plugins/thunar-wallpaper/twp-provider.c index 79874f6..18e8a97 100644 --- a/plugins/thunar-wallpaper/twp-provider.c +++ b/plugins/thunar-wallpaper/twp-provider.c @@ -31,6 +31,9 @@ #include +#include +#include + #include "twp-provider.h" @@ -230,6 +233,8 @@ twp_action_set_wallpaper (GtkAction *action, gchar *file_name = NULL; gchar *hostname = NULL; gchar *command; + gchar *is_single_workspace; + gchar *single_workspace_number; if (n_screens > 1) screen = gdk_display_get_default_screen (display); @@ -288,6 +293,34 @@ twp_action_set_wallpaper (GtkAction *action, g_free(image_show_prop); g_free(image_style_prop); + + /* Xfdesktop 4.11+ has a concept of a single-workspace-mode where + * the same workspace is used for everything but additionally allows + * the user to use any current workspace as the single active + * workspace, we'll need to check if it is enabled and use that. */ + command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p /backdrop/single-workspace-mode"); + if (g_spawn_command_line_sync (command, &is_single_workspace, NULL, NULL, NULL)) + { + if (g_strrstr (is_single_workspace, "true") != NULL) + { + g_free (command); + command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p /backdrop/single-workspace-number"); + if (g_spawn_command_line_sync (command, &single_workspace_number, NULL, NULL, NULL)) + { + char *end; + long workspace_num = strtol(single_workspace_number, &end, 10); + /* sanity checks */ + if (workspace_num <= INT_MAX && workspace_num >= 0) + { + workspace = (int)workspace_num; + } + g_free (single_workspace_number); + } + } + g_free (is_single_workspace); + } + g_free (command); + /* This is the format for xfdesktop post 4.11. A workspace number is * added and the monitor is referred to name. We set both formats so * that it works as the user expects. */ -- 2.0.2