I believe this has been asked here:
http://murga-linux.com/puppy/viewtopic.php?t=93637
I created this separate thread because this function is not per se related to jwm.
The two scripts do the reverse of each other. They go in /root/my-applications/bin.
You may want to drop a link of one in your ~/Startup folder, so your gtk and ROX
bookmarks are always "twinned". Use only one link in Startup, or they will cancel
each other out.
For the rest, I think the scripts are pretty well commented.
Any comments? Drop a line here! I'll see what I can do.
BFN.
musher0
~~~~~~~~~~~~
Code: Select all
#!/bin/sh
# $MBINS/rox-Bkmrks2gtk-bkmrks.sh
# Purpose: have ~/.gtk-bookmarks mirror
# /root/.config/rox.sourceforge.net/ROX-Filer/Bookmarks.xml.
#
# Companion file to $MBINS/gtk-bkmrks2rox-Bkmrks.sh
# For Puppy_Dogfellow and all fine Puppyists out there!
#
# # (c) Christian L'Écuyer (alias / aka musher0), Gatineau (Qc), Canada,
# 27 mai / May 27, 2014. Tous droits réservés / All rights reserved.
####
# Backup
cp -f --backup ~/.gtk-bookmarks ~/.gtk-bookmarks.bckp
# Action
awk -F">" '{print $2}' ~/.config/rox.sourceforge.net/ROX-Filer/Bookmarks.xml | sort -t "/" -k 2 | awk -F"<" '$1 != "" {print "file:\/\/"$1}' > ~/.gtk-bookmarks
# Notes
# - The < --backup > setting creates a 2nd backup after the 1st run.
# - The result is sorted according to the first-level folder name
# ( sort -t "/" -k 2 ), but you may have repetitions in the gtk window
# when opening or saving a file because gtk reads from the last field.
Code: Select all
#!/bin/sh
# $MBINS/gtk-bkmrks2rox-Bkmrks.sh
# Purpose: have ~/.config/rox.sourceforge.net/ROX-Filer/Bookmarks.xml
# mirror ~/.gtk-bookmarks.
#
# Companion file to $MBINS/rox-Bkmrks2gtk-bkmrks.sh
# Dependency: replaceit.
#
# For Puppy_Dogfellow and all fine Puppyists out there!
#
# # (c) Christian L'Écuyer (alias / aka musher0), Gatineau (Qc), Canada,
# 27 mai / May 27, 2014. Tous droits réservés / All rights reserved.
####
# Preparation
cd /root/.config/rox.sourceforge.net/ROX-Filer/
# Backups
cp -f --backup Bookmarks.xml Bookmarks.xml.bckp
cp -f ~/.gtk-bookmarks ~/gtk-temp
# Action
replaceit --input=/root/gtk-temp "file:///" "/"
sleep 0.5
for i in `cat /root/gtk-temp`
do
echo " <bookmark title=\"$i\">$i</bookmark>" >> Bookmarks.temp
done
#
# Of course, this only repeats the folder name twice...
# It'll be up to you to personalize the names in the ROX-Filer.
#
# To do so, click on the "arrow-goldenball" icon, and then on "Edit
# bookmarks". You edit the 2nd column, marked "Title", by double-
# clicking in the desired field, and then writing something.)
#
echo "<?xml version=\"1.0\"?>" > Bookmarks.tmp
echo "<bookmarks>" >> Bookmarks.tmp
cat Bookmarks.temp >> Bookmarks.tmp
echo "</bookmarks>" >> Bookmarks.tmp
sleep 0.1s
# Clean-up
rm -f Bookmarks.temp
rm -f ~/gtk-temp
mv -f Bookmarks.tmp Bookmarks.xml
# Note
# - The < --backup > setting creates a 2nd backup after the 1st run.