====== Systemd - feh ====== * Objet : mettre ne place une image de fond aléatoire à l'aide de systemd et feh * Niveau requis : {{tag>avisé}} * Commentaires : //système linux utilisant systemd// * Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) ===== Introduction ===== ===== Installation ===== les prérequis : un dossier **~/.wallpaper** contenant vos fonds d'écrans\\ le paquet **[[https://packages.debian.org/jessie/feh|feh]]** apt-get install feh ===création du script de changement de fond d'écran=== le script bash est à placer le dossier **bin** utilisateur (~/bin ou ~/.bin ou ~/.local/bin suivant votre configuration) #! /bin/bash DISPLAY=:0 /usr/bin/feh --bg-max "$(find ~/.wallpaper/|shuf|head -n 1)" et le rendre exécutable chmod ug+x ~/.bin/cchange-fond ===création du service feh-wallpaper.service=== à placer dans le dossier ~/.config/systemd/user/ [Unit] Description=Random wallpaper with feh [Service] Type=oneshot ExecStart=/home/**votre-user**/.bin/cchange-fond [Install] WantedBy=default.target ===création du service feh-wallpaper.timer=== à placer dans le dossier ~/.config/systemd/user/ [Unit] Description=Random wallpaper with feh [Timer] OnUnitActiveSec=30m Unit=feh-wallpaper.service [Install] WantedBy=default.target **OnUnitActiveSec=30m** pour un changement toutes les 30 minutes. Se référer à [[https://www.freedesktop.org/software/systemd/man/systemd.time.html|systemd.time(7)]] pour adapter à vos envies ===démarrage du service=== activation : systemctl --user enable feh-wallpaper.timer démarrage systemctl --user start feh-wallpaper.timer vérification du status systemctl --user status feh-wallpaper.timer le service étant configuré pour fonctionner pour un utilisateur (user) les commandes **systemctl** sont lancé en console normale.\\ L'usage dans ce cas de l'option **- -user** doit être utilisé À noté que seul le .timer est activé et démarré, c'est lui qui appellera le service feh.wallpaper.service ===== Références ===== [[https://wiki.archlinux.org/index.php/Feh#Using_systemd_user_session|wiki Archlinux : feh]] se reporter aussi aux manuels systemd\\ [[https://www.freedesktop.org/software/systemd/man/systemd.html|systemd(1)]], [[https://www.freedesktop.org/software/systemd/man/systemd.service.html|systemd.service(5)]], [[https://www.freedesktop.org/software/systemd/man/systemd.unit.html|systemd.unit(5)]], [[https://www.freedesktop.org/software/systemd/man/systemd.timer.html|systemd.timer(5)]], [[https://www.freedesktop.org/software/systemd/man/systemd.time.html|systemd.time(7)]],