[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[K12OSN] pushing new icons to user's desktops



I've had a few people ask me about pushing new icons to user's desktops.

Neither KDE nor GNOME will automatically add new global icons to existing
user's desktops.

Fortunately this is a pretty easy problem to solve, it is a simple matter
of copying the files to each user's home directory.

For KDE, a user's desktop icons are found in /home/<username>/Desktop/
For GNOME, they are found in /home/<username>/.gnome-desktop/

Attached are two scripts that automate the process, push-desktop-icon-to-all
and push-desktop-icon-to-user. As the names imply, one pushes an icon to
all users, the other to one specific user.

As for where to find the desktop icons, you can either make one on your
own desktop (which the file will be stored in your Desktop or .gnome-desktop
directory, depending on if you are using KDE or GNOME), or you can use
one of the existing ones.

KDE stores the default ones in /usr/share/apps/kdesktop/DesktopLinks/ and
/usr/share/applnk/. GNOME stores the default ones in /usr/share/gnome/apps/

-Eric
#!/bin/sh

if [ ! -f "$1" ] 
then
	echo 
	echo "usage: $0 <icon to push>"
	echo
	exit
fi 

cd /home
USERS=`ls`
FILE=`basename "$1"`

for USER in $USERS
do
	U=`id -u $USER`
	G=`id -g $USER`
	if [ $U -a $G ] 
	then
		if [ -d /home/$USER/Desktop -a ! -e "/home/$USER/Desktop/$FILE" ]
		then
			cp "$1" "/home/$USER/Desktop/$FILE"
			chown $U.$G "/home/$USER/Desktop/$FILE"
			echo "done: /home/$USER/Desktop/$FILE"
		else	
			echo exists: /home/$USER/Desktop/$FILE
		fi
		if [ -d /home/$USER/.gnome-desktop -a ! -e "/home/$USER/.gnome-desktop/$FILE" ]
		then
			cp "$1" "/home/$USER/.gnome-desktop/$FILE"
			chown $U.$G "/home/$USER/.gnome-desktop/$FILE"
			echo done: /home/$USER/.gnome-desktop/$FILE
		else	
			echo exists: /home/$USER/.gnome-desktop/$FILE
		fi
	fi
done
#!/bin/sh

if [ ! -f "$2" ] 
then
	echo 
	echo "usage: $0 <user> <icon to push>"
	echo
	exit
fi 

FILE=`basename "$2"`

U=`id -u $1`
G=`id -g $1`
if [ $U -a $G ] 
then
	if [ -d /home/$1/Desktop -a ! -e "/home/$1/Desktop/$FILE" ]
	then
		cp "$2" "/home/$1/Desktop/$FILE"
		chown $U.$G "/home/$1/Desktop/$FILE"
		echo "done: /home/$1/Desktop/$FILE"
	else	
		echo exists: /home/$1/Desktop/$FILE
	fi
	if [ -d /home/$1/.gnome-desktop -a ! -e "/home/$1/.gnome-desktop/$FILE" ]
	then
		cp "$2" "/home/$1/.gnome-desktop/$FILE"
		chown $U.$G "/home/$1/.gnome-desktop/$FILE"
		echo done: /home/$1/.gnome-desktop/$FILE
	else	
		echo exists: /home/$1/.gnome-desktop/$FILE
	fi
fi

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]