You are not logged in.

#1 2020-07-14 19:58:47

Aldebaraan
Member
Registered: 2020-07-14
Posts: 12

Autostart script

I have a script that changes the background using feh every x seconds/minutes and i'm trying to make it run when the system boots. So far i tried adding this line to the autostart file in $HOME/.config/openbox:

$HOME/.config/openbox/wallchange/timechange.sh &

but it doesn't work. When i run it in the console it works.

Offline

#2 2020-07-14 20:19:37

damo
....moderator....
Registered: 2015-08-20
Posts: 6,124

Re: Autostart script

Is the script executable?

Does the script only run once, or do you have a loop in it? Maybe post it here...

Last edited by damo (2020-07-14 20:23:02)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2020-07-14 21:19:43

Aldebaraan
Member
Registered: 2020-07-14
Posts: 12

Re: Autostart script

damo wrote:

Is the script executable?

Does the script only run once, or do you have a loop in it? Maybe post it here...

Yes it is. It runs every x seconds/minutes

#!/bin/sh
WALLPAPERS=~/Pictures/Wallpapers
TIME=10m
while true;
do
    feh --bg-scale "$(find $WALLPAPERS -type f -name '*.jpg' -o -name '*.png' | shuf -n 1)"
    sleep $TIME
done &

Offline

#4 2020-07-14 22:31:51

damo
....moderator....
Registered: 2015-08-20
Posts: 6,124

Re: Autostart script

The first thing I'd try is to remove the unnecessary ampersand after the do loop, which is forking it off into the background.

When you run the script in the terminal, does it change the wallpaper after ${TIME}, or just set it the first time?

As a general point it is safer to quote paths:

WALLPAPERS="${HOME}/Pictures/Wallpapers"

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2020-07-14 22:40:25

Aldebaraan
Member
Registered: 2020-07-14
Posts: 12

Re: Autostart script

damo wrote:

The first thing I'd try is to remove the unnecessary ampersand after the do loop, which is forking it off into the background.

When you run the script in the terminal, does it change the wallpaper after ${TIME}, or just set it the first time?

As a general point it is safer to quote paths:

WALLPAPERS="${HOME}/Pictures/Wallpapers"

If i set to 5s, it changes every 5 seconds as it supposed to so it's not a problem with the script.

Offline

#6 2020-07-14 23:40:44

damo
....moderator....
Registered: 2015-08-20
Posts: 6,124

Re: Autostart script

If your Wallpaper directory isn't in your ${PATH}, the command in autostart should be

./$HOME/.config/openbox/wallchange/timechange.sh &

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#7 2020-07-15 01:06:38

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,146
Website

Re: Autostart script

This is BunsenLabs Helium?
If it's Lithium, then the file to edit is $HOME/.config/bunsen/autostart


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#8 2020-07-15 15:56:11

ohnonot
...again
Registered: 2015-09-29
Posts: 4,782
Website

Re: Autostart script

There's no reason why the script shouldn't work when started from autostart.
Do other commands in autostart work as expected?
Please show us the whole file.


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#9 2020-07-15 17:17:32

Aldebaraan
Member
Registered: 2020-07-14
Posts: 12

Re: Autostart script

damo wrote:

If your Wallpaper directory isn't in your ${PATH}, the command in autostart should be

./$HOME/.config/openbox/wallchange/timechange.sh &

Tried that. Didn't work.

johnraff wrote:

This is BunsenLabs Helium?
If it's Lithium, then the file to edit is $HOME/.config/bunsen/autostart

ohnonot wrote:

There's no reason why the script shouldn't work when started from autostart.
Do other commands in autostart work as expected?
Please show us the whole file.

Yes things like planky and picom autostart when placed there.

I decided to use conky to execute the script.

Conkyrc:

TEXT
${execpi 180 bash ~/.config/openbox/wallchange/wallchange.sh}
${execpi 5 cat ~/.config/openbox/wallchange/color.txt}

wallchange.sh:

#!/bin/bash
WPCURRENT="$(shuf -n1 -e ~/Pictures/Wallpapers/*)"

feh --randomize --bg-fill "${WPCURRENT}"

color=`convert "${WPCURRENT}" -gravity east -crop 20%x100% -resize 1x1 -negate txt:- | tail -n1 |cut -d' ' -f4`

echo -n '${color '$color'}' > ~/.config/openbox/wallchange/color.txt

cat ~/.config/openbox/wallchange/color.txt

I got the code from here and edited to my needs:
https://github.com/khodges42/Openbox-Wallchanger

The only thing that is needed is to start conky after boot.

Last edited by Aldebaraan (2020-07-15 17:26:11)

Offline

#10 2020-07-17 06:57:07

ohnonot
...again
Registered: 2015-09-29
Posts: 4,782
Website

Re: Autostart script

I feared you would misunderstand.
If the script works otherwise,but not when started from autostart, the reason could be in the autostart file and not in the script.
Please show us that file.


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

Board footer

Powered by FluxBB