I wrote a bash script that will save and load icon positions. Usage is
./icons.sh save [name]
./icons.sh load [name]
The name argument is optional, in case you want to save different configurations. You may have to adjust the lines under #config info to accommodate your OS.
#!/bin/bash
#config info
desktop=~/Desktop/*
metastr="metadata::caja-icon-position"
metafile=~/.config/caja/desktop-metadata
saveicon=~/.icon.txt
savemeta=~/.iconmeta.txt
file_manager=caja
saveinfo(){
cat /dev/null > "$saveicon"
for f in $desktop;do
p=$(gio info -a "$metastr" "$f"|grep "$metastr"|awk '{print $2}')
echo "$f;$p">>"$saveicon"
done
#save metafile
cp "$metafile" "$savemeta"
zenity --notification --window-icon="/usr/share/icons/gnome/48x48/categories/applications-other.png" --text "Icon Positions Saved"
}
loadinfo(){
str=$(cat "$saveicon")
if [ -z "$str" ];then
echo "$saveicon not found"
exit
fi
for fl in $str;do
f=$(echo "$fl"|cut -d';' -f1)
p=$(echo "$fl"|cut -d';' -f2)
gio set -t string "$f" "$metastr" "$p"
done
#load metafile
cp "$savemeta" "$metafile"
#restart file manager
pkill "$file_manager"
}
if [ -z "$1" ];then
echo "Saves or loads icon positions"
echo " Usage:"
echo "$0 save [name]"
echo "$0 load [name]"
exit
fi
if [ -n "$2" ];then
saveicon="$2"
savemeta="$2_meta"
fi
if [ "$1" = "save" ];then
saveinfo
fi
if [ "$1" = "load" ];then
loadinfo
fi