0

Using xfce4-panel in openbox, I managed to add a shell and changed the picture's background with nitrogen.

When I try to add a select dialog box to choose between two methods, random and classic (the first one chooses pic randomly, while the second chooses pic by order)
everything works fine.

Just the terminal still keeps open, which looks weird. I would like that the terminal closes automatically without exiting the script.

I saw a lot of topics like: nohup and disown don't work, because after an exit command everything is killed and not going to background.

Code : nature.sh
#!/bin/bash
x=0
nu=$(ls ~/Images/Wallpapers/nature/*.jpg | wc -l)
cd /home/badr/Images/Wallpapers/nature
number=0

while [ $x -ne 1 ];
        do
        if [ $number -eq $nu ];then 
        number=0
        fi
        #number=$(( $((RANDOM)) % nu ))
        number=$((number + 1))
        nitrogen --set-scaled --save nature$number.jpg
        sleep 10
done

Code: nature2.sh
#!/bin/bash
x=0
nu=$(ls ~/Images/Wallpapers/nature/*.jpg | wc -l)
cd /home/badr/Images/Wallpapers/nature
number=0

while [ $x -ne 1 ];
        do
        #if [ $number -eq $nu ];then 
        #number=0
        #echo $number
        #fi
        number=$(( $((RANDOM)) % nu ))
        number=$((number + 1))
        nitrogen --set-scaled --save nature$number.jpg
        sleep 10
done
Code : choose.sh
#!/bin/bash
echo "Veuillez choisir le mode de rotation des images?"
select yn in "Random" "Recurcive"; do
    case $yn in
        Random )nohup '/home/badr/Images/Wallpapers/nature/nature2.sh'& 
        bash /home/badr/Images/Wallpapers/nature/nature2.sh; break;;
        Recurcive )nohup '/home/badr/Images/Wallpapers/nature/nature.sh'&
         bash /home/badr/Images/Wallpapers/nature/nature.sh;exit;;
    esac
done
  • Are you putting an & after your gdialog command – rhubarbdog Dec 1 '18 at 7:58
  • sorry i made mistake it's a select dialog box (not a gdialog box) , i update question with codes i used – Fatine badr Dec 1 '18 at 15:19
0

Actualy after a long search i found that almost no possibilty to do what i want with just the shell, so i conbined the force of shell with another programming langage that work fine with him C langage.

And i use SDL with C to build what i want . Now, i added a lot of features in my programme like time control , and using personnalized directory . I'm happy with what i done . Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.