Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

As I pointed out in my question nautilus theme problem in 12.04 I have to type 4 commands after every logon as workaround for a theming problem. Since I didn't find a real solution I decided to put the commands into a script and my plan ist to make this script autostart once it works properly. The commands are:

nautilus -q
nautilus -n &
gsettings set org.gnome.desktop.background show-desktop-icons false
gsettings set org.gnome.desktop.background show-desktop-icons true

And this is my script:

#!/bin/bash
nautilus -q
pid0=$(pgrep 'nautilus')
while [ -n "$pid" ];
do
  pid=$(pgrep 'nautilus')
  sleep 0
done
nautilus -n
gsettings set org.gnome.desktop.background show-desktop-icons false
gsettings set org.gnome.desktop.background show-desktop-icons true
exit 0

I had to use the loop and testing since otherwise nautilus is restarted before it has finished to quit itself. But my script never ends. While pgrep nautilus entered manually in a terminal doesn't return any value after nautilus -q, runing the script returns endless a pid so the script isn't executed.

What is my mistake? Where does the pid come from when the command is run within the script?

And how can I restart nautilus from within the script avoiding nautilus to block the script forever from further execution? The line nautilus -n starts nautilus and the script hangs from there on. Using nautilus -n & instetead makes the script run, but the follwing commands are executed before nautilus has completely started so they dont't work as intended, desktop settings are not applied.

Are there any other ideas to cope with this annoying command-typing at every logon?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.