Peppermint OS Community Forum

Support => Software & Applications => Topic started by: DenW on May 02, 2017, 07:44:55 pm

Title: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: DenW on May 02, 2017, 07:44:55 pm
Although Variety wallpaper changer works well with Peppermint I have been looking for something light and easy to use that just changes my collection of wallpapers on the desktop at regular intervals.  In the latest version of LXLE (I like to Live test all the latest distros!) I came across a program called Paper Changer which is actually XL-wallpaper. If you go to their website http://www.batraciens.net/xl-wallpaper/xl-wallpaper-en.htm there are full instructions for downloading the very small xl-wallpaper.deb file (22.6kb).  Use GDebi to install and then open from Accessories in Peppermint menu.  Then just follow the instructions to select the time between changes (1 - 120 mins), autostart or not, and select directory with wallpapers (subdirectories automatically included).  I put all my wallpapers in ~/Pictures/Wallpapers (including copying the Peppermint collection from  ~/.usr/shares/peppermint/wallpapers).
Works like a charm and recommended.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce (SOLVED)
Post by: MrGizmo on July 09, 2019, 05:47:58 pm
The program works OK but resizes the images to fit the screen. I would prefer to have the images centered.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 09, 2019, 06:15:23 pm
Try running:
Code: [Select]
gksudo xed /usr/bin/xl-wallpa-run.sh
find the section
Code: [Select]
	if [ -f "/usr/bin/nitrogen" ] 			# Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-zoom-fill "$LIGNE" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else
and change it to
Code: [Select]
	if [ -f "/usr/bin/nitrogen" ] 			# Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-centered "$LIGNE" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else
SAVE the file.

Try it now
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: clatterfordslim on July 09, 2019, 09:08:52 pm
Try running:
Code: [Select]
gksudo xed /usr/bin/xl-wallpa-run.sh
find the section
Code: [Select]
	if [ -f "/usr/bin/nitrogen" ] 			# Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-zoom-fill "$LIGNE" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else
and change it to
Code: [Select]
	if [ -f "/usr/bin/nitrogen" ] 			# Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-centered "$LIGNE" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else
SAVE the file.

Try it now

On my screen as I'm on my Lenovo Yoga 500 Laptop at work, this works if I change it to scaled, it fits the whole of the screen, rather than a cheap BBC wide screen effect, with black masking tape across the top and bottom of the screen. Remember that sketch from Alas Smith And Jones? Must be on YouTube? Just spent two or so hours trying to find said sketch, but to no avail.  :( But to cheer you up here is what my desktop looks like, with above setting changed to scaled.
(https://imgur.com/RYKntyhl.png)
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 10, 2019, 11:58:30 am
Maybe, but MrGizmo said:-

Quote
I would prefer to have the images centered

Instructions for centered were requested, so instructions for centered was what I responded with :)
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: clatterfordslim on July 14, 2019, 05:57:20 pm
Maybe, but MrGizmo said:-

Quote
I would prefer to have the images centered

Instructions for centered were requested, so instructions for centered was what I responded with :)

Yeah I know but I was just saying, that you have the choice of scaled too. Which looks better on my Lenovo, maybe not for everyone, but on my Lenovo, did I mention my Lenovo?  ;D
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 23, 2019, 03:56:08 pm
This is what I get with a picture centered. Note that it is expanded to use the whole screen, which makes it very pixelated. The original picture is not of high enough resolution for that. On my other computer with Peppermint 8 and an older version of Variety, this picture is shown in the original size (much smaller). I also prefer the black borders so I can better see the desktop icons.

(http://www.slantsix.org/photos/Screenshot_2019-07-23_12:47:22.png)
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 23, 2019, 04:15:57 pm
so if you run:
Code: [Select]
nitrogen --set-centered /path/to/picture.jpg
(replacing /path/to/picture.jpg with the actual path to your image)

when the wallpaper changes, it's still scaled and not centered (original size) ?
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 23, 2019, 05:01:19 pm
Actually, centered did not work well in my tests, although that is what I would call what I want. I have to use scaled or the picture is expanded beyond the screen. I tried all of the different settings in that file, but no matter what is picked, the image will NOT display "untouched". It is always adjusted in some way.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 23, 2019, 06:53:21 pm
That didn't answer my question .. 'centered' should NOT scale the image at all, it should display it unscaled and postitioned in the center of screen

so does
Code: [Select]
nitrogen --set-centered /path/to/picture.jpg
do that ?
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 28, 2019, 12:41:05 pm
OK, I made the change as stated above. When the picture changed, it was not displayed in the original size. Checking the xl-wallpa-run.sh file still shows nitrogen --set-centered "$LIGNE", but when I look at the /org/gnome/desktop/background setting in dconf, it is reset to "spanned", so something is changing that file. I can change dconf back to centered, which works correctly without changing the picture size, but the setting reverts to spanned when the picture changes.

NOTE: Variety was removed.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 28, 2019, 01:31:38 pm
I discovered that I can run the following command to reset the picture option:

gsettings set org.gnome.desktop.background picture-options "centered"

Now, can I put this somewhere in the xl-wallpa-run.sh file or do I need to create a cron job?

Thanks for the help so far.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 28, 2019, 05:43:40 pm
Try running:
Code: [Select]
gksudo xed /usr/bin/xl-wallpa-run.sh
find the section
Code: [Select]
	if [ -f "/usr/bin/nitrogen" ] 			# Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-centered "$LIGNE" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else
and change it to
Code: [Select]
	if [ -f "/usr/bin/nitrogen" ] 			# Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-centered "$LIGNE" && gsettings set org.gnome.desktop.background picture-options "centered" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else
SAVE the file.

Try it now.



I'll get around to Variety as soon as I have time .. it shouldn't be too hard to fix.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 29, 2019, 12:24:39 am
OK, I added the line but image is still resized, picture option still gets reset to spanned. Maybe another location for the gsettings line?
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 29, 2019, 10:04:29 am
The entire file should read
Code: [Select]
#!/bin/bash

pkill xl-wallpap-co #arrête le programme de configuration, s'il vient de lancer le présent script (ce script peut être lancé par le programme de config ou par /autostart/ )
sleep 5 #attend que la session ait démarré pour changer le 1er papier peint (accélère le démarrage de la session sans la parasiter).

pgrep pcmanfm && SYS=lxde || SYS=other #défini si le système actif est LXDE

#====================================================================================================================
#Défini le ratio largeur / hauteur de l'écran de l'utilisateur (ne sert que pour LXDE)
#====================================================================================================================
if [ $SYS = "lxde" ]
  then # n'éxécute les commandes suivantes que si le système est LXDE
DEF1=$(xrandr --verbose | grep *current) #récupérer la définition courante de l'écran
DEF2=${DEF1:2:9} #la variable DEF2 est égale au contenu de "DEF1" entre les caractères N°2 et N°2+7 (9). Le 1er caractère de DEF1 a le N°0
POSIX=`expr index "$DEF2" x` #Extrait la position de la lettre 'x' dans DEF2 (DEF2 renvoit quelque chose comme 1920x1200)
LARGEURECRAN=${DEF2:$POSIX-5:4}         #Récupère la largeur (4 caractères à partir de 5 caractères avant le x)
HAUTEURECRAN=${DEF2:$POSIX:4} #Récupère la hauteur (4 caractères à partir du x)
RATIOECRAN=`echo $LARGEURECRAN / $HAUTEURECRAN | bc -l` #Défini ratio largeur / hauteur. Par ex, pour 1 écran de 1920x1200, le ratio est de 1,6. "bc -l" traite les virgules flottantes
  else # n'éxécute les commandes suivantes que si le système n'est PAS LXDE, pour tester la version de xfce (la gestion des fonds d'écran change après la version 4.10)
CHAINEXFCE=$(xfdesktop --version | grep " 4.") # récupère dans les lignes renvoyées par la commande xfdesktop --version celle ou se trouve le N° de version
POS4=`expr index "$CHAINEXFCE" 4` # récupère la position du caractère "4", qui indique le début du N° de version
VERSIONXFCE=${CHAINEXFCE:$POS4+1:2} # récupère le sous-N° de version (par exemple "11" dans "4.11")
fi



#====================================================================================================================
#Boucle sans fin - reprend quand tous les papier-peints ont été affichés
#====================================================================================================================
while : #début de la boucle sans fin
  do

source ~/.config/xl-wallpaper/xl-wallpaper-data.txt

while read LIGNE            #La fonction read crée la variable "ligne", puis la remplis ligne par ligne grace à l'instruction   done /repertoirexxx/images
  do                      #tant que la boucle trouve une nouvelle ligne, elle s'éxécute. Arrivé au bout des lignes, elle s'interromp.
    #--------------------------------------------------------------------------------------------------------------------
    #Défini le ratio largeur / hauteur de l'image et déforme l'image (ne sert que pour LXDE)
    #--------------------------------------------------------------------------------------------------------------------
    if [ $SYS = "lxde" ] # n'éxécute les commandes suivantes que si le système est LXDE
      then
VAR=$(python -c "from PIL import Image; print('%s %s' % Image.open('$ligne').size)")
VAR=0$VAR #Ajoute 0 devant VAR pour avoir au moins 4 caractères dans les largeurs de 3 caractères (800 px, par ex)
POSIESPACE=`expr index "$VAR" ' '` #Extrait la position du caractère espace ' ' dans VAR (VAR renvoit quelque chose comme 800 600)
LARGEURIMAGE=${VAR:$POSIESPACE-5:4} #Récupère la largeur (4 caractères à partir de 5 caractères avant l'espace ' ')
HAUTEURIMAGE=${VAR:$POSIESPACE-1:5} #Récupère la hauteur (4 caractères à partir de 1 caractères avant l'espace ' ')
RATIOIMAGE=`echo $LARGEURIMAGE / $HAUTEURIMAGE | bc -l`
#-------------
#Décide si on déforme l'image (ne sert que pour LXDE)
#-------------
ECART=`echo $RATIOECRAN/$RATIOIMAGE*100 - 100 | bc -l` #Défini l'écart en % entre les ratio de l'écran et de l'image, au format -23.5646547841 (par exemple)
ECART=${ECART#-}        #l'opérande "#-" enlève le 1er "-" trouvé en partant de la gauche, si ce signe existe. Donc passe ECART en valeur absolue.
ECART=${ECART%.*}       #l'opérande "%.*" enlève le 1er "." trouvé en partant de la droite, si ce signe existe, et tout ("*") ce qui est derrière. Donc fait une troncature.
ECART=$((ECART+1)) #compensation d'une règle d'arrondi trop brutale
if [ "$ECART" -lt 22 ]; then WALLMODE=stretch; else WALLMODE=fit; fi #Décide si on déforme ou non
#-------------
#Affiche le papier-peint dans LXDE
#-------------
        pcmanfm -w "$LIGNE" --wallpaper-mode=$WALLMODE #change papier-peint LXDE. Guillemets indispensables si nom du fichier contient des espaces
    fi
    #-------------
    #Affiche le papier-peint dans XFCE en le redimensionnant
    #-------------
    if [ $SYS = "other" ]
then
if [ -f "/usr/bin/nitrogen" ] # Si l'application NITROGEN est installée sur le disque, on l'utilise en priorité.
            then
nitrogen --set-centered "$LIGNE" && gsettings set org.gnome.desktop.background picture-options "centered" # redimensionne automatiquement l'image - voir nitrogen --help pour les autres possibilités
    else # Si NITROGEN n'est pas installé, alors le changement de fonds d'ecran via XFCE prend la main.
if [ "$VERSIONXFCE" -ge 11 ] # vérifie si la version de xfce >= 11 (la gestion des fonds d'écran change après la version 4.10)
    then xfconf-query -c xfce4-desktop -p "/backdrop/screen0/monitorVGA1/workspace0/last-image" -s "$LIGNE" && xfconf-query -c xfce4-desktop -p "/backdrop/screen0/monitorVGA1/workspace0/image-style" -s "3"  # XFCE >= 4.11
    else xfconf-query -c xfce4-desktop -p "/backdrop/screen0/monitor0/image-path" -s "$LIGNE" && xfconf-query -c xfce4-desktop -p "/backdrop/screen0/monitor0/image-style" -s "0" #change papier-peint Xfce # XFCE < 4.11
fi
fi
    fi
   
    if (( $CHANGE == 2 )); then pkill xl-wallp; fi #si le paramétrage est un changement uniquement au démarrage du PC, tue le script après le 1er changement.
    sleep $DUREE #Attend le temps défini entre 2 changements d'image
done < <(find "$REP/" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" \) | sort -R)  #liste le répertoire et ses sous-rep de papier-peints et les envoie dans la boucle

done #fin de la boucle sans fin

#sort -R -> trie aléatoirement ; sort -> trie par ordre alphanumérique ; sort -r -> trie par ordre alphanumérique inversé
#dans LXDE  --wallpaper-mode a plusieurs possibilités : color|stretch|fit|center|tile
#dans XFCE /backdrop/screen0/monitor0/image-style a des valeurs de 0 à 4. 0=auto (inexistant dans LXDE) ; 1=center dans LXDE ; 2=tile (mosaïque) dans LXDE ; 3=Stretch dans LXDE ; 4=adapté (agrandi sans déformé ni coupé) ; 5=zoomé
if that doesn't work you've made some other weird change to your system because that works perfectly for me
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 29, 2019, 11:58:12 am
I got it working by putting the gsettings line after the nitrogen line like this:

            then
      nitrogen --set-centered "$LIGNE"
               gsettings set org.gnome.desktop.background picture-options "centered"   
       else    

Thanks for pointing me in the right direction!
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 29, 2019, 01:32:59 pm
Yeah that'll do it too .. glad you got it working :)

Can you please remember to mark the topic (SOLVED) .. TIA :)
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on July 29, 2019, 10:47:17 pm
Yeah that'll do it too .. glad you got it working :)

Can you please remember to mark the topic (SOLVED) .. TIA :)

Did I mark it correctly?
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: murraymint on July 30, 2019, 06:13:15 am
No, edit the subject line of your first post.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: PCNetSpec on July 30, 2019, 09:48:10 am
Edit the FIRST posting in this topic, and append (SOLVED) to the subject line .. as in:-

Subject: Simple Light Wallpaper Changer for LXDE and Xfce (SOLVED)

[EDIT]

Okay ignore that, you cannot mark this topic (SOLVED) because the topic wasn't started by you...

When adding to an already existing topic your issue may be solved without the original posting being solved, if it were then markable it wouldn't be fair to the original poster who's specific issue may still not be fully resolved .. the problem then is it becomes much harder for people with the exact same issue as you finding it harder to find your working solution .. this is precisely why we ask people to always start their own support topic (rather than adding to someone else's).

[EDIT]

Damn I used the word "solved" in there a lot .. one more now :))
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: MrGizmo on August 13, 2019, 02:30:36 pm
Perhaps a moderator can split off my thread to a separate post.
Title: Re: Simple Light Wallpaper Changer for LXDE and Xfce
Post by: Slim.Fatz on August 13, 2019, 03:37:00 pm
Hi MrGizmo,

Of course a moderator could do this, but that is not the point! All of the moderators here work without pay (i.e. they are volunteering their own valuable time for free). And that is exactly why PCNetSpec emphatically said that
Code: [Select]
this is precisely why we ask people to always start their own support topic
Nevertheless, we are all glad that your issue has been solved.  ;)

Regards,

-- Slim