How to call a repetitive script in .profile

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Stewbond

How to call a repetitive script in .profile

Post by Stewbond »

I have written a script to change my wallpaper every 10 min.

wallppr.sh:

Code: Select all

#!/bin/bash
pic=(/home/user/Pictures/Wallpapers/*)
gsettings set org.gnome.desktop.background picture-uri \
         "file://${pic[RANDOM % ${#pic[@]}]}"
Then to call it repetitively:
wallChanger.sh:

Code: Select all

#!/bin/bash
watch -n 10 wallppr.sh
Calling wallChanger.sh from a terminal is no problem. However, when I put it into ~/.profile I don't see the effects of the script when I log in. I assume that I need to run this in a new thread or something, but how?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18155
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: How to call a repetitive script in .profile

Post by karlchen »

Hello, Stewbond.

I guess you will hve to make your script wallChanger.sh another startup application so that it gets loaded after you have logged on to the graphical user environment (Mate, Cinnamon, xfce, KDE, whichever you are using).

You can do so by launching "Startup Programmes" from the menu (Menu => Preferences => Startup Progams on Cinnamon e.g.), clicking on [Add], selecting your script and clicking [Apply].

As you want to change your wallpaper periodically, however, I would rather check whether the desktop environment which you are using does offer a built-in function to change wallpapers periodically out of the box.

HTH,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 750 days now.
Lifeline
Stewbond

Re: How to call a repetitive script in .profile

Post by Stewbond »

karlchen wrote:Hello, Stewbond.

I guess you will hve to make your script wallChanger.sh another startup application so that it gets loaded after you have logged on to the graphical user environment (Mate, Cinnamon, xfce, KDE, whichever you are using).

You can do so by launching "Startup Programmes" from the menu (Menu => Preferences => Startup Progams on Cinnamon e.g.), clicking on [Add], selecting your script and clicking [Apply].

As you want to change your wallpaper periodically, however, I would rather check whether the desktop environment which you are using does offer a built-in function to change wallpapers periodically out of the box.

HTH,
Karl
Great idea Karl. I'm playing with it now. Hopefully I'll get some good results.

Cheers
Locked

Return to “Scripts & Bash”