emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master fe7c015b20: Support XFCE in wallpaper.el


From: Po Lu
Subject: Re: master fe7c015b20: Support XFCE in wallpaper.el
Date: Mon, 19 Sep 2022 12:49:04 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Thierry Volpiatto <thievol@posteo.net> writes:

> Po Lu <luangruo@yahoo.com> writes:
>
>> Thierry Volpiatto <thievol@posteo.net> writes:
>>
>>> Here the command fails if you specify the workspace, it works only with
>>> "worspace0".
>>
>> But that's because you only have workspace 1 displayed, right?
>
> No, if emacs is on workspace0 and I use:
> "/backdrop/screen0/monitoreDP/workspace0/last-image"
> wallpaper is modified as expected. 
>
> Then if emacs is on workspace2 and I use:
> "/backdrop/screen0/monitoreDP/workspace2/last-image"
> Command exit with 0 status but wallpaper is not modified, but if I use:
> "/backdrop/screen0/monitoreDP/workspace0/last-image" again (always from
> workspace2), wallpaper is modified as expected.
>
> I can verify this with this command which monitor the desktop change:
>
>     xfconf-query -c xfce4-desktop -m
>
>     => Commencer à surveiller le canal « xfce4-desktop » :
>
> then I go to workspace4, modify wallpaper with mouse and the usual xfce
> interface for this, go back in workspace1 an look at output:
> I have now:
>
>     Commencer à surveiller le canal « xfce4-desktop » :
>
>     définir: /backdrop/screen0/monitoreDP/workspace0/last-image
>
> unfortunately this command is interactive :-(

But here is how Thunar, the XFCE file manager, sets the backdrop:

          image_path_prop = 
g_strdup_printf("/backdrop/screen%d/monitor%s/workspace%d/last-image", 
screen_nr, monitor_name, workspace);
          image_style_prop = 
g_strdup_printf("/backdrop/screen%d/monitor%s/workspace%d/image-style", 
screen_nr, monitor_name, workspace);
 
where `workspace' is:

  GdkWindow *root;
  gulong     bytes_after_ret = 0;
  gulong     nitems_ret = 0;
  guint     *prop_ret = NULL;
  Atom       _NET_CURRENT_DESKTOP;
  Atom       _WIN_WORKSPACE;
  Atom       type_ret = None;
  gint       format_ret;
  gint       ws_num = 0;

  gdk_x11_display_error_trap_push (gdk_display_get_default ());

  root = gdk_screen_get_root_window (screen);

  /* determine the X atom values */
  _NET_CURRENT_DESKTOP = XInternAtom (GDK_WINDOW_XDISPLAY (root), 
"_NET_CURRENT_DESKTOP", False);
  _WIN_WORKSPACE = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_WIN_WORKSPACE", 
False);

  if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
                          gdk_x11_get_default_root_xwindow(),
                          _NET_CURRENT_DESKTOP, 0, 32, False, XA_CARDINAL,
                          &type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
                          (gpointer) &prop_ret) != Success)
    {
      if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
                              gdk_x11_get_default_root_xwindow(),
                              _WIN_WORKSPACE, 0, 32, False, XA_CARDINAL,
                              &type_ret, &format_ret, &nitems_ret, 
&bytes_after_ret,
                              (gpointer) &prop_ret) != Success)
        {
          if (G_UNLIKELY (prop_ret != NULL))
            {
              XFree (prop_ret);
              prop_ret = NULL;
            }
        }
    }

  if (G_LIKELY (prop_ret != NULL))
    {
      if (G_LIKELY (type_ret != None && format_ret != 0))
        ws_num = *prop_ret;
      XFree (prop_ret);
    }

  gdk_x11_display_error_trap_pop_ignored (gdk_display_get_default ());

  return ws_num;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]