miércoles, 5 de enero de 2011

ROTAR TEMAS CON UBUNTU GNOME

INTRODUCCIÖN

Si queremos rotar los temas de forma rápida podemos
crear un icono que permita hacer esto rápido.

Si el script se pone en el arranque permitirá
tener un tema diferente cada vez que se arranque.

Una vez crear el archivo debemos ejetutarlo con:
bash rotartema.sh

EL SCRIPT

cat temarotar.sh
ultimo=ultimo.txt
icono="$HOME/Escritorio/Tema.desktop"

function icono
{
echo "#!/usr/bin/env xdg-open" > $icono
echo "[Desktop Entry]">> $icono
echo "Version=1.0">> $icono
echo "Type=Application">> $icono
echo "Terminal=false">> $icono
echo "Icon[es_ES]=gparted">> $icono
echo "Exec=bash /home/paco/temarotar.sh">> $icono
echo "Name[es_ES]=Tema $1">> $icono
echo "Icon=gparted">> $icono
echo "Name=Tema $1">> $icono

}

function cambia
{

gconftool-2 --type string --set /apps/metacity/general/theme $1
gconftool-2 --type string --set /desktop/gnome/interface/gtk_theme $1
if [ -f /usr/share/backgrounds/$1.jpg ];then
gconftool-2 --type string --set /desktop/gnome/background/picture_filename /usr/share/backgrounds/$1.jpg
fi
gconftool-2 --type string --set /desktop/gnome/interface/icon_theme $1
}

function numero
{
num=$1
c=1
for i in $(ls /usr/share/themes/);do
if [ $c -eq $num ];then
tema=$i
valido=$(echo $tema | grep -v "Contrast")
if [ $valido ];then
break
fi
fi


let c=c+1
done

echo "Tema $num $tema"
cambia $tema
icono $tema
}


### MAIN

tot=$(ls /usr/share/themes/ | wc -w)
if [ ! -f $ultimo ];then
echo 1 > $ultimo
fi

num=$(cat $ultimo)

if [ $num -gt $tot ];then
num=1
fi

let num=num+1
echo $num > $ultimo
numero $num

No hay comentarios:

Publicar un comentario