In order to avoid a conflict between two scripts, I want to change any value in one line of the file ~/.ideskrc with a zero. This is the line with the desired value:
Background.Delay: 0
I have a manual solution that handles the problem for now:
STRING="Background.Delay: 0"
if ! grep -q "$STRING" $HOME/.ideskrc;
then
yad --geometry 300x300 --text="Rotate Backgrounds and Separate Backgrounds can not be run at the same time. \n
Run Rotate Backgrounds and set that Delay to zero."
exit 0
fi
It would be nice to just change it and not require user intervention. I have tried a number of variations using sed without success. The most recent example:
sed -i -r 's/Background.Delay:[[:space:]]+1/Background.Delay: 0/' ~/.ideskrc
I'm only a basic-level script writer, so definitely could use some help. Thanks.
Final version now with yad formatting and revised message for anyone interested:
if ! grep -q "$STRING" $HOME/.ideskrc;
then
sed -i 's/^\([[:blank:]]*Background\.Delay:\).*/\1 0/' "$HOME/.ideskrc"
yad --timeout=3 --no-buttons --geometry 500x100 --text-align=center --text="
<b>Rotate Backgrounds has been disabled to avoid conflict.</b>
"
fi