Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-05-19 18:41:52

mastro
Member
From: Germany
Registered: 2020-11-22
Posts: 19
Website

4.16 xfce4-desktop.xml and backdrop settings

Hello everyone,

xubuntu have under /etc/xdg-ubuntu a default xfce4-desktop.xml which will be copied to the userhome-dir at first login.

The XML-Structure is "backdrop" -> "screen" -> "monitor" -> background-settings

Here is the Sample:

<property name="backdrop" type="empty">
    <property name="screen0" type="empty">
      <property name="monitor0" type="empty">
          <property name="last-image" type="string" value="/usr/share/backgrounds/sample.png"/>
          <property name="backdrop-cycle-enable" type="bool" value="true"/>
          <property name="backdrop-cycle-timer" type="uint" value="1"/>
          <property name="backdrop-cycle-random-order" type="bool" value="true"/>
      </property>
      <property name="monitor1" type="empty">
          <property name="last-image" type="string" value="/usr/share/backgrounds/sample.png"/>
          <property name="backdrop-cycle-enable" type="bool" value="true"/>
          <property name="backdrop-cycle-timer" type="uint" value="1"/>
          <property name="backdrop-cycle-random-order" type="bool" value="true"/>
      </property>
    </property>
  </property>


But it doesn't work correctly.

xfdesktop 4.16 doesn't use "monitor0", "monitor1" ....
at first Login will be a structure generated with "monitorVirtual1" on oracle virtualbox.
On a hardware of me, it will be generated with "monitorDisplayport-0".

Finally will be the settings of the default xfce4-desktop.xml ignored because xfconf/xfdesktop generate
the XML-section with with Port auf the montor.

Question:
How must i define the Monitor-Section in /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml to set the backdrop for all desktops independed of the Port which will be used on Hardware.

I think, one solution is to copy the settings for all possible Monitor-Strings.
monitor0, monitor1, monitor2, monitor3, monitor4, monitorVirtual-0, monitorVirtual-1, monitorVirtual-2, monitorVGA-0, monitorVGA-1, monitorVGA-2, monitorVGA-3, monitorHDMI-0, monitorHDMI-1, monitorHDMI-2, monitorHDMI-3, monitorDisplayport-0, monitorDisplayport-1,  monitorDisplayport-2, monitorDisplayport-3, monitorDVI-0, monitorDVI-1, monitorDVI-2 and monitorDVI-3

But this solution is ugly!!!!

Better would be a Wildcard-Setting, sample:

<property name="backdrop" type="empty">
    <property name="screen*" type="empty">
      <property name="monitor*" type="empty">
          <property name="last-image" type="string" value="/usr/share/backgrounds/sample.png"/>
          <property name="backdrop-cycle-enable" type="bool" value="true"/>
          <property name="backdrop-cycle-timer" type="uint" value="1"/>
          <property name="backdrop-cycle-random-order" type="bool" value="true"/>
      </property>
    </property>
  </property>

So can be simple defined Default-Settings without knowing the final Names.

Is where a Solution?

Offline

#2 2021-05-20 00:33:14

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,949

Re: 4.16 xfce4-desktop.xml and backdrop settings

What I'm seeing in the code is this:

On initial startup, xfdesktop will try to read xfconf values (which will be populated initially with the xml file from /etc/xdg.....)

    buf[pp_len] = 0;
    g_strlcat(buf, "last-image", sizeof(buf));
    if(!xfconf_channel_has_property(channel, buf)) {
        xfce_workspace_migrate_backdrop_image(workspace, backdrop, monitor);
    }
    xfconf_g_property_bind(channel, buf, G_TYPE_STRING,
                           G_OBJECT(backdrop), "image-filename");

...if a "last-image" property doesn't exist, it will execute xfce_workspace_migrate_backdrop_image. In that function:

    /* Use the old property format */
    g_snprintf(buf, sizeof(buf), "%smonitor%d/image-path",
               workspace->priv->property_prefix, monitor);

...it will use the old "screen0/monitor0" format and grab the "image-path" value.

If you look at xubuntu's (from the xubuntu-default-settings package) xfce4-desktop.xml file, you will see that it contains entries for 4 monitors and image-path values for each:

<?xml version="1.0" encoding="UTF-8"?>

<channel name="xfce4-desktop" version="1.0">
  <property name="desktop-icons" type="empty">
    <property name="style" type="int" value="2"/>
    <property name="file-icons" type="empty">
      <property name="show-home" type="bool" value="true"/>
      <property name="show-filesystem" type="bool" value="false"/>
      <property name="show-removable" type="bool" value="false"/>
      <property name="show-trash" type="bool" value="true"/>
    </property>
    <property name="icon-size" type="uint" value="48"/>
    <property name="tooltip-size" type="double" value="64.000000"/>
  </property>
  <property name="backdrop" type="empty">
    <property name="screen0" type="empty">
      <property name="monitor0" type="empty">
        <property name="image-path" type="string" value="/usr/share/xfce4/backdrops/xubuntu-wallpaper.png"/>
        <property name="image-style" type="int" value="5"/>
        <property name="image-show" type="bool" value="true"/>
      </property>
      <property name="monitor1" type="empty">
        <property name="image-path" type="string" value="/usr/share/xfce4/backdrops/xubuntu-wallpaper.png"/>
        <property name="image-style" type="int" value="5"/>
        <property name="image-show" type="bool" value="true"/>
      </property>
      <property name="monitor2" type="empty">
        <property name="image-path" type="string" value="/usr/share/xfce4/backdrops/xubuntu-wallpaper.png"/>
        <property name="image-style" type="int" value="5"/>
        <property name="image-show" type="bool" value="true"/>
      </property>
      <property name="monitor3" type="empty">
        <property name="image-path" type="string" value="/usr/share/xfce4/backdrops/xubuntu-wallpaper.png"/>
        <property name="image-style" type="int" value="5"/>
        <property name="image-show" type="bool" value="true"/>
      </property>
    </property>
  </property>
  <property name="desktop-menu" type="empty">
    <property name="show" type="bool" value="false"/>
  </property>
</channel>

...of course, if you have a 5th monitor, you are out of luck. Basically, what should happen is that on first start, it won't find the new monitor name, use the migrate function and grab the old monitor0 format and image-path values, and use those for the new naming scheme.

Note: the content of this file is different from the one you posted. I got this one from 21.04's http://archive.ubuntu.com/ubuntu/pool/u … t-settings package.

I tested this xml file by changing the image-path value for all 4 monitors and creating a new user, and sure enough, the new user got the new wallpaper as default.

Hope this is helpful.


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

#3 2021-05-20 23:19:24

mastro
Member
From: Germany
Registered: 2020-11-22
Posts: 19
Website

Re: 4.16 xfce4-desktop.xml and backdrop settings

Hey ToZ,

thank you!

I have tried with following xfce4-desktop.xml

<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-desktop" version="1.0">
 <property name="backdrop" type="empty">
    <property name="screen0" type="empty">
      <property name="monitor0" type="empty">
          <property name="last-image" type="string" value="/usr/share/backgrounds/pexels-abbas-mohammed-3680912.jpeg"/>
          <property name="image-path" type="string" value="/usr/share/backgrounds/pexels-abbas-mohammed-3680912.jpeg"/>
          <property name="color-style" type="int" value="0"/>
          <property name="image-style" type="int" value="5"/>
          <property name="backdrop-cycle-enable" type="bool" value="true"/>
          <property name="backdrop-cycle-timer" type="uint" value="5"/>
          <property name="backdrop-cycle-random-order" type="bool" value="true"/>
      </property>
    </property>
    <property name="single-workspace-mode" type="bool" value="true"/>
  </property>
  <property name="desktop-icons" type="empty">
    <property name="icon-size" type="uint" value="48"/>
    <property name="file-icons" type="empty">
      <property name="show-filesystem" type="bool" value="false"/>
      <property name="show-removable" type="bool" value="false"/>
    </property>
  </property>
</channel>

I see an your code in 4.16 "last-image" changed to "image-path". That is the reason!
Since I have changed "last-image" to "image-path" will be "monitor0" correct migrated to "monitorVirtual1" on my VirtualBox-Debain.
On my Test-Tablet with Debian 11 will be "monitor0" migrated to "monitorDP-1".

Funny:
If I look to the file /home/user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml after the user has changed the desktop-settings, is the current backdrop image stored in "last-image" not in "image-path".

But one error is still present:
Following lines will be not migrated:

          <property name="backdrop-cycle-enable" type="bool" value="true"/>
          <property name="backdrop-cycle-timer" type="uint" value="5"/>
          <property name="backdrop-cycle-random-order" type="bool" value="true"/>

I want on default a change of backdrop every 5 minutes.

What is the solution to migrate these settings?

Offline

#4 2021-05-21 01:07:31

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,949

Re: 4.16 xfce4-desktop.xml and backdrop settings

Yeah, unfortunately there is no code to migrate those settings.

You could create a script and run it on autostart that sets those settings. For example, something like:

#!/bin/bash

# exit if the script has been run before
[[ -f ~/.cache/.xfdesktop-post.run ]] && exit 1

# get list of screens/monitors in an array (in case more that one monitor)
mapfile -t SCREENS < <(xfconf-query -c xfce4-desktop -lv | grep last-image | awk -F'/' '{print $3}')
mapfile -t MONITORS < <(xfconf-query -c xfce4-desktop -lv | grep last-image | awk -F'/' '{print $4}')

# cycle through array creating entries
for (( x=0; x <= ${#SCREENS[@]}; x++ ))
do
   xfconf-query -c xfce4-desktop -p /backdrop/${SCREENS[x]}/${MONITORS[x]}/workspace0/backdrop-cycle-enable -t bool -s true --create
   xfconf-query -c xfce4-desktop -p /backdrop/${SCREENS[x]}/${MONITORS[x]}/workspace0/backdrop-cycle-timer -t uint -s 5 --create
   xfconf-query -c xfce4-desktop -p /backdrop/${SCREENS[x]}/${MONITORS[x]}/workspace0/backdrop-cycle-random-order -t bool -s true --create
done

# leave marker that script has been run
touch ~/.cache/.xfdesktop-post.run

exit 0

Caveats:

  • This script requires bash 4.0 or greater

  • I only tested it in a VM with one monitor

  • sets only for workspace0 - which is the default setup using the migration code anyways

Please test this on a non-production environment first.


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

#5 2021-05-21 08:59:55

mastro
Member
From: Germany
Registered: 2020-11-22
Posts: 19
Website

Re: 4.16 xfce4-desktop.xml and backdrop settings

By my logic, your script must work. I will test it.

Unfortunately is your solution a script that must be run after start von xfconf.
At this time I copy my Default-Files before start of xfconf.
So I have two first-run-startup processes.

Sure I can set all changed settings of xfconf in your script, many work....

But nevertheless thank you!

Offline

#6 2021-05-21 14:13:53

mastro
Member
From: Germany
Registered: 2020-11-22
Posts: 19
Website

Re: 4.16 xfce4-desktop.xml and backdrop settings

Hi ToZ,

Tested. Your script works well.

Know you why xfconf use this (sorry!) stupid migration-solution?
Now I have to define "image-path" for migration, but xfconf store this in "last-image"....


Feature-Request for Development:
If no "monitorXXX" defined, copy whole tree from "monitor0" to "monitorXXX".
It's would be very easy and simple to copy a working xfce4-desktop.xml-monitor-section to /etc/xdg default-settings monitor0.
This would be easy to understand for all administrators!

Marcus

Offline

#7 2021-05-21 18:19:29

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,949

Re: 4.16 xfce4-desktop.xml and backdrop settings

mastro wrote:

Feature-Request for Development:
If no "monitorXXX" defined, copy whole tree from "monitor0" to "monitorXXX".
It's would be very easy and simple to copy a working xfce4-desktop.xml-monitor-section to /etc/xdg default-settings monitor0.
This would be easy to understand for all administrators!

The best place for this would be a bug report/enhancement request here.


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

Board footer

Powered by FluxBB