Saving and restoring an old panel state



I'm afraid that the panel is still not completely stable (particularly if you do
stupid stuff that crashes X or uses up all the memory). Because of the way
the panel saves its session, sometimes you can end up with your settings
lost.

So, I wrote a couple of trivial scripts to save a good panel state, and
then restore it if necessary:

wainwright$ cat ~/bin/backup_panel
#!/bin/sh
cd ~/.gnome/panel.d
set `ls -1dt Session-* | grep -v backup`
dir=$1
echo "Backing up $dir"
rm -f backup/*
cp -p $dir/* backup
for f in backup/*; do
	sed -e "s/$dir/backup/g" $f > temp_file
	if ! diff temp_file $f; then mv -f temp_file $f; fi
done


wainwright$ cat `which restore_panel`
#! /bin/sh
cd ~
killall panel
sleep 10
xprop -root -remove GNOME_PANEL
if [ "$1" != "" ]; then
smid="$1"
else
smid=backup
fi
nohup panel --sm-config-prefix /panel.d/"$smid"/ </dev/null >/dev/null 2>&1 &



Peter Wainwright
Home: prw@wainpr.demon.co.uk     Work: peter.wainwright@nrpb.org.uk
http://www.wainpr.demon.co.uk    Fax: +44-870-052-3185
Visit the Opera Exchange Homepage at http://www.treda.co.uk/opex/




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