Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

READ-ONLY-MODE: PLEASE DO NOT POST NEW STUFF!
  New Forum: http://forum.puppylinux.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 13 Aug 2020, 00:03
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Bookmark Twins
Moderators: Flash, Ian, JohnMurga
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
musher0

Joined: 04 Jan 2009
Posts: 15041
Location: Gatineau (Qc), Canada

PostPosted: Tue 27 May 2014, 15:46    Post subject:  Bookmark Twins
Subject description: Make .gtk-bookmarks and ROX Bookmarks mirror each other
 

Hello, people.

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:
#!/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:
#!/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.
bookmark-twins.zip
Description 
zip

 Download 
Filename  bookmark-twins.zip 
Filesize  1.83 KB 
Downloaded  139 Time(s) 

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 13653
Location: Arizona USA

PostPosted: Tue 27 May 2014, 16:14    Post subject:  

What does this do? What would I use it for? Confused
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 1669
Location: nyc

PostPosted: Tue 27 May 2014, 19:04    Post subject:  

so this replaces your Rox bookmarks with your GTK bookmarks and vice versa? i'm not sure i would want that unless i have an unpopulated list (like on a relatively new installation). i always fill in the rox stuff first chance i get (add to bookmarks from any filer window is simply a more common encounter than when the program happens to be using gtk and gives you the + - in the popup that occurs at saves and openings) and the gtk stuff when the opportunity presents itself. because of the bookmarks script i use (from disciple, which gives both lists at the same time), i pared it down for less redundancy somewhat, though some are still essential to have on both, i think...

my name is sort of in the comments, but i'm not sure i'd want to overwrite one with the other. on a fresh install, i think rox over to gtk isn't a bad idea though.

am i off on what it does? is this a separate thing that pops up or just an easy way to populate the lists?

can it be modded to make a gtk bookmarks list on the jwm menu? (sorry, i know you are moving away from JWM dependency in your projects, but i figured i'd ask).
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 15041
Location: Gatineau (Qc), Canada

PostPosted: Tue 27 May 2014, 21:52    Post subject:  

Hello, guys.

These scripts harmonize the ROX-Filer bookmarks list with gtk-bookmarks list.
In the attached picture, I have drawn lines for the correspondences.
The ROX-filer bookmarks are on the left, and the gtk bookmarks are on the right.

~~~~~~~~~~
@Flash
The gtk bookmarks are those that appear in the panel when you want to open or save
a file, in geany, for example. You can add some bookmarks in that panel by
highlighting a folder in the right part, and clicking on the + icon at the bottom left.

The ROX-Filer bookmarks are those that you can define in ROX (the arrow-golden_
globe icon) as you browse through your directory tree.

Let's say you go to a folder and you want to bookmark it for easy access later. How
can you do that? You click on the arrow-globe icon at the top of the ROX-Filer window,
then you click "add". The name of the folder is added automatically at the bottom of the list.

~~~~~~~~~~
@ Puppus_D.
I'm sorry if this not what you meant by "making the bookmarks available" in the
other thread.

But if you take a minute to think about it, this is the logical complement to adding
bookmarks in the jwm menu. With these scripts and mochimopel's contribution in
the other thread, you have the possibility to have identical bookmarks in the ROX
window, in the GTK panel and in the jwm menu.

As to your other comment, I also find it more natural to mirror the ROX-Filer
bookmarks to the gtk bookmarks. But some people may think or be accusomed to
doing things the other way around, so I created a second script that mirrors the gtk
bookmarks to the ROX bookmarks. Choice is good, no?! Smile

~~~~~~~~~~
In conclusion, those bookmarks are what's known as "accelerators" or "facilitators".
They speed up your access to your desired folders.

I created these scripts because having both of them refer to the same folders was less
confusing for me. It is my hope that some other users will find these mirroring scripts
useful as well.

I hope this post clarifies the subject a bit. Don't be afraid to ask more questions if it
doesn't!

BFN.

musher0
ROX_and_gtk_bookmarks_are_harmonized.jpg
 Description   ROX bookmarks are at the left, gtk bookmarks are at the left.
 Filesize   46.18 KB
 Viewed   161 Time(s)

ROX_and_gtk_bookmarks_are_harmonized.jpg


_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 1669
Location: nyc

PostPosted: Tue 27 May 2014, 22:00    Post subject:  

musher, it adds one to the other or it overwrites one with the other?

if the former, then of course it's good--gain with no loss, which is what i (mistakenly) feared it did.

Very Happy
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 15041
Location: Gatineau (Qc), Canada

PostPosted: Tue 27 May 2014, 22:19    Post subject:  

Hello again, Puppus.

Well, the scripts make backups of the target files. So no worries.

The script doesn't add anything to the existing file, it replaces it. Boom. Replace.
Hence the backups: if you don't like the results, just squish the file that has just been
created with the old file (the old file has the extension .bckp). And you're back with
the file you're used to.

The adding is done manually by you, the user, as you browse through your folders,
either while you are in the ROX-Filer, or while you are in the gtk Save / Open panel.


For example, say that you have added ten folders that you use a lot, to the folders
list in ROX-Filer. Now you want to have the same folders in your gtk bookmarks. Use
the rox-bkmrks2gtk-bkmrks.sh script and it's done: your gtk bookmarks are now
aligned with the ROX bookmarks.

The scripts do not invent any new locations for you. They use the bookmarks that you
yourself have already put in the lists manually.

(Maybe my example is confusing because, as a developer, I use a lot of bookmarks to
go here and there quickly in the folder tree. I realize that the ordinary user will have
just a few bookmarks, if any.)

I hope this helps.

BFN.

musher0

_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 1669
Location: nyc

PostPosted: Tue 27 May 2014, 22:56    Post subject:  

musher0 wrote:

[...]

(Maybe my example is confusing because, as a developer, I use a lot of bookmarks to
go here and there quickly in the folder tree. I realize that the ordinary user will have
just a few bookmarks, if any.)

I hope this helps.

BFN.

musher0



i've my share, too, musher:





Rolling Eyes Laughing

(to be fair to disciple and his script, the screen shot, because i dragged my feet about the desktop, registered just before the path popup appeared.)

while a useful script, yours may render some other things i find useful less so, which is why i asked about a separate jwm menu entry for the gtk stuff...
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 15041
Location: Gatineau (Qc), Canada

PostPosted: Wed 28 May 2014, 04:49    Post subject:  

My, you've got more bookmarks than I do! Shocked Cool Very Happy
_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 15041
Location: Gatineau (Qc), Canada

PostPosted: Wed 28 May 2014, 05:08    Post subject:  

Besides, I find disciple's approach visually cumbersome. And I hate buttons!
_________________
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 1669
Location: nyc

PostPosted: Wed 28 May 2014, 10:22    Post subject:  

musher0 wrote:
Besides, I find disciple's approach visually cumbersome. And I hate buttons!


to each his own but it is only on the screen for as long as you stare at it wondering where to go (unless you have it set to stay on after an entry is selected).

musher0 wrote:
My, you've got more bookmarks than I do! Shocked Cool Very Happy


yeah, i tend to have them pile up. i do do some gardening from time to time, though it does seem that i plant more than i prune.

since my gtk version is too old for scroll bars (apparently and from what i gleaned), i should probably change the font size to fit more of those objectionable rectangles on the screen--it's a 26 inch tv i sit 18 inches from when at that machine...they're some unnecessarily big buttons.

Smile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0613s ][ Queries: 12 (0.0162s) ][ GZIP on ]