You are not logged in.

Announcement

Due to heavy spamming of forums registration is going in stages. If you wish to register as a new user with ArchBang Forums, first register and then send an e-mail to: archbangforums at gmail dot com. It should contain the problem you want to discuss or some other AB related content. You will be promoted from registering member with no posting rights to new member with posting rights after that. If your mail is ignored you haven't fulfilled the requirements.

#1 2012-01-28 20:23:35

mike4ca
Happy (Arch|Manjaro)[B,b]ang User
From: Iowa, USA
Registered: 2011-10-17
Posts: 429

[SOLVED] Automatically Change Wallpaper

With all of the good wallpapers out there it is a shame to be stuck with manually changing them.  I have seen distros with a rotating wallpaper.  I could not find anything I liked.  In AUR, there are some GNOME and KDE based solutions, but I did not want to go there.  DesktopNova (https://sites.google.com/site/haliner/desktopnova) says it only works with GNOME and XFCE based systems as well.  Not sure if anyone tried to get it working on a *box system.  In the Arch wiki I found some info on perl scripts and read to the point of it wanting me to install ImageMagicK.  I did not want to install a new image program. 

I would be ok with the wallpaper changing when I log in or better yet, when I wake from sleep.  Nitrogen restores from ~/.config/bg-saved.cfg.  I could see a script that would pick a wallpaper from /usr/share/wallpapers and cat it into the bg-saved.cfg. Then placing that script into the autostart for  Openbox and/or having a cron task setup to run that and then restart nitrogen.

I am not very good with scripts yet, if someone can point me in the right direction or recommend a product that already works I would appreciate it.

P.S. I know this section is for showing your Artwork, I thought it would be a good place to list how to do this.  If not, feel free to move it to a more appropriate section of the forum.

Last edited by mike4ca (2012-01-29 22:29:08)


Free Software Foundation member 10865

Offline

#2 2012-01-29 05:05:12

Mr Green
Iso Developer
Registered: 2010-11-07
Posts: 3,754

Re: [SOLVED] Automatically Change Wallpaper

I am sure there are plenty of rotation scripts out there. Would not be that difficult to write one, you need to know what you want to do first.

Some I have seen even work related to time of day [sunrise] [day] [evening] [night]

The sky is the limit..

Good excuse to learn some code smile

Offline

#3 2012-01-29 05:46:32

WASD
Member
Registered: 2012-01-17
Posts: 26

Re: [SOLVED] Automatically Change Wallpaper

Feh can be used to change wallpaper. https://wiki.archlinux.org/index.php/Fe … er_manager


I am active in the IRC.
#archbang on irc.freenode.net

Offline

#4 2012-01-29 08:39:29

pablokal
Administrator
From: Nijmegen, Holland
Registered: 2010-10-12
Posts: 2,627
Website

Re: [SOLVED] Automatically Change Wallpaper

See his post and thread: http://crunchbanglinux.org/forums/post/19893/#p19893

Or the original: http://crunchbanglinux.org/pastebin/235

Save as rotate-wallpaper.sh save in usr/bin and make executable.

Simple example of Tawan if you have nitrogen installed:

#! /bin/bash
WALLPAPERS="/your/path/to/backgrounds"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
nitrogen --set-scaled --save $WALLPAPERS/${ALIST[$number]}

source: http://crunchbanglinux.org/forums/post/37849/#p37849
Comment: This script just changes the wallpaper. You need to call it from conky or cron or something and set the frequency there.
example of a cronjob every 5 minutes

*/5 * * * * ~/.chgwall/rotate-wallpaper.sh.

in /home/user/.cron

With image changer desklet you can let rotate almost the entire desktop: http://crunchbanglinux.org/forums/post/55575/#p55575
if you edit the code for the image as to cover almost your screen entirely.


Getting your questions answered here at ArchBang Forums
Please! Always give hardware info, if there is a chance that 's relevant: #lspci -vnn
Quote: What I have learnt from Linux is to minimize dependencies and functionalities for greater independence.
On Arch(bang) and Openbox: http://stillstup.blogspot.com/

Offline

#5 2012-01-29 22:28:22

mike4ca
Happy (Arch|Manjaro)[B,b]ang User
From: Iowa, USA
Registered: 2011-10-17
Posts: 429

Re: [SOLVED] Automatically Change Wallpaper

Thanks everyone.  I modified the script from pablokal since it utilized the existing nitrogen.  I don't need it change while I am working and put my computer to sleep nightly so I added the pm-suspend and saved as mfsuspend.sh in /usr/bin (and made executable).  I have a keybinding for super-z that I set to execute my new script.  So now when I go to suspend, the wallpaper changes just before it goes to sleep.  Here is the modified script.

#! /bin/bash
WALLPAPERS="/usr/share/wallpapers"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
nitrogen --set-scaled --save $WALLPAPERS/${ALIST[$number]}
sudo pm-suspend

One thing I noticed was the script does not like files that have a space in the name.  So the quick fix was to go and rename the files.

Last edited by mike4ca (2012-01-29 22:34:37)


Free Software Foundation member 10865

Offline

#6 2012-01-30 08:31:30

oliver
Administrator
Registered: 2010-11-04
Posts: 1,516

Re: [SOLVED] Automatically Change Wallpaper

mike4ca wrote:

One thing I noticed was the script does not like files that have a space in the name.  So the quick fix was to go and rename the files.

Untested. but adding the following to the script should resolve that

export IFS="
"

Welly, welly, welly, welly, welly, welly, well. To what do I owe the extreme pleasure of this surprising visit?

Offline

#7 2012-01-30 17:44:30

WASD
Member
Registered: 2012-01-17
Posts: 26

Re: [SOLVED] Automatically Change Wallpaper

Yeah, spaces in filenames just tend to cause troubles. I make sure to safe files i get without spaces and if I find one with spaces I may fix it.


I am active in the IRC.
#archbang on irc.freenode.net

Offline

Board footer

Powered by FluxBB