Ubuntu

Comment 28 for bug 574296

Sanjeev Sharma (swtbase) wrote :

EDIT to comment #23:

Please excuse my newbieness with Linux systems but the shell script that I was intending had to be (and also if someone didn't know its executable bit must also be enabled by using chmod):

----------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
# gsettingsdaemonfix.sh

pid=$(pgrep gnome-settings-)

# if [ -n "$pid" ]
# then
# ps $pid &> /home/sanjeev/Desktop/gnomesettingsdebug1.txt
# else
# echo "No previous instance of gnome-settings-daemon running!" &> /home/sanjeev/Desktop/gnomesettingsdaemondebug.txt
# fi

while [ -n "$pid" ];
do
        pid=$(pgrep gnome-settings-)
        sleep 0
done

exit 0

----------------------------------------------------------------------------------------------------------------------------------
Turns out 'wait' only works for child processes. I wonder why.

Enabling the 'if' comments will output some useful information about previously running instance (be sure to change the path as according to your system). I also changed the name of the script from 'gnome-settings-daemon-fix.sh' to 'gnomesettingsdaemonfix.sh' as pgrep couldn't distinguish between process name of the running script and process name of the daemon as it compares only 15 characters of process names (Again, I cannot explain this). Hence, the edited 'gnome-settings-daemon.desktop' should be:

----------------------------------------------------------------------------------------------------------------------------------
[Desktop Entry]
Type=Application
Name=GNOME Settings Daemon
Exec=bash -c 'bash /etc/xdg/autostart/gnomesettingsdaemonfix.sh ;/usr/lib/gnome-settings-daemon/gnome-settings-daemon'
OnlyShowIn=GNOME;
NoDisplay=false
X-GNOME-Autostart-Phase=Initialization
X-GNOME-Autostart-Notify=true
X-GNOME-AutoRestart=true
X-Ubuntu-Gettext-Domain=gnome-settings-daemon
----------------------------------------------------------------------------------------------------------------------------------

I captured the following about the previously running instance of settings daemon:
  PID TTY STAT TIME COMMAND
 1514 ? Ds 0:00 [gnome-settings-]

Collision between this instance and the instance run by '.desktop' file may be the cause of the theme problem in my system. This solution seems to be working for me.