Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 20/02/2015, à 16:51

Wizix

Changer de fond d'écran à chaque démarrage

Bonjour
Je ne sais pas si c'est possible, je n'ai pas trouvé de logiciel pour le faire. Donc j'imagine qu'un script peu le faire. Seulement je n'y connais absolument rien... J'ai un dossier contenant des fonds d'écran (une vingtaine), j'aimerais que quand je boot mon ordi, il choisisse un fond d'écran, aléatoirement et différent au dernier... Est-ce que c'est possible ?
Merci beaucoup !


Nombre de PC convertis : 6

Hors ligne

#2 Le 20/02/2015, à 17:15

Hizoka

Re : Changer de fond d'écran à chaque démarrage

Il y a des logiciels pour ça t pas mal de topic qui en parlent...

tu es sous quel environnement ? (kde, gnome, unity...)


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#3 Le 20/02/2015, à 17:47

Wizix

Re : Changer de fond d'écran à chaque démarrage

Mmm j'ai vu des logiciels pour changer de fond d'écran tout les X temps mais pas à chaque boot...

Sous Ubuntu 14.04.2, Unity !


Nombre de PC convertis : 6

Hors ligne

#4 Le 20/02/2015, à 18:11

Hizoka

Re : Changer de fond d'écran à chaque démarrage

il faut trouver la commande qui permet de changer l'image de fond pour unity et la mettre dans cron avec @reboot


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#5 Le 21/02/2015, à 00:38

Wizix

Re : Changer de fond d'écran à chaque démarrage

Oui mais comment je fais pour lui demander de prendre une image aléatoirement dans mon dossier ?

Autrement j'ai trouvé ce script :

#!/bin/bash

#modified by Ruja
#original script by kennethadammiller
#http://ubuntuforums.org/showthread.php?t=1378108

#option "t" sets the timeout time between changing wallpapers
#option "s" sets the setting for when the image is applied as wallpaper
#after these options, place the locations for each of your folders that you
#want to be scanned for wallpapers to be cycled through

#you can save the code to ~/.wallpaperChanger, then open
#"Startup Applications" and add a task with the command:
#
#  /home/userName/.wallpaperChanger -t 3600 -s stretched "/path/to/wallpapers1"
#  "/path/to/wallpapers2" "/path/to/wallpapers3" ...

#if launched with -t 0, changes wallpaper once, then exits

a=1
b=1

while getopts ":t:s:" opt;      #get the command line arguments so that 
do                              #it can set the amount of time to sleep for
  case $opt in
        t)
        time=$OPTARG
        a=0
        ;;
        s)
        setting=$OPTARG
        b=0
        ;;
  esac
done

if [ $a = 0 ];  #so yea i guess i couldn't figure out how to get it to work 
  then          #in the opt-while loop above. oh well. it works now.
  shift 2
fi
if [ $b = 0 ];
  then
  shift 2
fi

time=${time:=3600}              #set time to default if the user didn't specify
setting=${setting:=stretch}     #set setting to default of stretched if user doesn't specify
newline='
'                               #$newline variable is easier :)

##change to each of the directories that contain wallpapers
#and add what's in those directories 
##to a newline delimited list
wallpapers=""
while [ "$1" != "" ];
do
	cd "$1"
		for var in {*.jpg,*.png,*.JPG,*.PNG}     #match jpg and png extensions
		do
			if [ -f "$1/$var" ] && [ -r "$1/$var" ];
			then
				if [ "$var" != '*.jpg' ] && #if there is no match for the file type 
				   [ "$var" != '*.png' ] && #in the directory, skip it so that it doesn't
				   [ "$var" != '*.JPG' ] && #cause problems when it goes to change to them
				   [ "$var" != '*.PNG' ];
				then
					wallpapers="$wallpapers$1/$var$newline"
				fi
			fi
		done
	shift
done
count=$(echo "$wallpapers" | wc -l)
#finished adding wallpapers up into newline delimited variable

#get a random $current to select from $wallpapers
repeat=1
while [ $repeat = 1 ];
do
	current=$(($RANDOM % $count)) #random number between 0 and $count-1
	if [ $current -gt 0 ];        #number cannot be 0, if it is just try again
	then
		tempwallpaper="$(echo "$wallpapers" | head -n $current | tail -n 1)"
		gsettings set org.gnome.desktop.background picture-uri file://"$tempwallpaper"
		
		if [ $time != 0 ];
		then
			sleep $time
		else
			repeat=0
		fi
	fi
done
#end

Le problème c'est qu'il faut passer tout les fonds d'écran un par un en paramètre...


Nombre de PC convertis : 6

Hors ligne

#6 Le 21/02/2015, à 10:36

ArchLinux

Re : Changer de fond d'écran à chaque démarrage

Sur le pc de ma mère j'ai mis Linux Mint avec Cinnamon et pour info tu as le changement de wallpaper et de façon aléatoire exactement comme tu demande de base dans le système.

Hors ligne

#7 Le 21/02/2015, à 11:36

Hizoka

Re : Changer de fond d'écran à chaque démarrage

le truc intéressant c'est

gsettings set org.gnome.desktop.background picture-uri file://"$tempwallpaper"

du coup on peut faire un truc du genre :

#!/bin/bash

# Dossier des images, sans / au bout
folder="/home/Wizix/Images"

# Création d'une liste des images, il ne faut rien d'autre que tes images à utiliser
img_list=("${folder}/"*)

# Nombre d'image
img_nb=${#img_list[@]}

# Selection aléatoire d'une image
random_nb=$((${RANDOM} % ${img_nb}))

# Changement de l'image
gsettings set org.gnome.desktop.background picture-uri file://"${img_list[${random_nb}]}"

On rend exécutable le fichier (clic droit) ou

chmod +x LeFichier

J'ai pas pu tester vu que je n'ai pas gnome.

Si cela fonctionne quand tu le lances, il te reste plus qu'a appeler la commande via cron au démarrage.

Alors c'est un code minimum, il ne verifie rien, ne teste rien... mais devrait faire ce que tu veux.

Dernière modification par Hizoka (Le 21/02/2015, à 11:37)


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#8 Le 21/02/2015, à 14:26

Wizix

Re : Changer de fond d'écran à chaque démarrage

Le script fonctionne nickel ! Quand je l'exécute le fond d'écran change parfaitement ! Merciii !
J'ai donc ajouté la ligne dans mon "cron" comme ça :

# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command
@reboot /home/louis/.wallpaperChanger

Je redémarre.. Et bah nan pas nouveau fond d'écran sad Pourquoi ??


Nombre de PC convertis : 6

Hors ligne

#9 Le 21/02/2015, à 15:03

Hizoka

Re : Changer de fond d'écran à chaque démarrage

cron ne marche pas tjrs avec reboot, essaie anacron.

Mais sinon :
https://doc.ubuntu-fr.org/tutoriel/appl … _demarrage


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne