ROX-Filer: Superfast bookmarks

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

ROX-Filer: Superfast bookmarks

#1 Post by MochiMoppel »

Very odd: ROX has a nice feature, but makes great efforts to hide it under the rug.

To start with, ROX hasn't even a proper name for it ("group selection"?). I call them speeddials. The user stumbles on them when he accidentally hits a single number key. Dressed-up as an error message he sees a short explanation how to use this feature. I assume most users close such messages before reading them.

The user manual hides the information in Chapter 4. ("Saving and restoring the selection"), after a somewhat unrelated explanation how to copy path names. What I regard as the main purpose is mentioned as a kind of side-effect:" Saving is also useful even if there is no selection, since it still saves the current directory." In other words: They are bookmarks. Shouldn't be confused though with the "official" slow and clumsy ROX bookmarks. These max. 10 bookmarks assigned to speeddial keys 0-9 are bookmarks on steroid. One keystroke is all it takes to open a bookmarked directory - can't get any faster than that. And as a bonus file selections in the directories are preserved.

However there is one thing that makes them hard to use: How to remember which key is assigned to which directory? There is no hint or list in the GUI. What good is it to be able access a directory in a split second when it takes half a minute to try all keys to find the right one?

To solve this problem I've created a little script that opens a list showing all key assignments. Though the list is clickable and can be used without ROX running, it is not meant as a replacement for the "real" thing used from within ROX.

Features:
- Script can be opened/closed with same desktop/keyboard shortcut. This makes it easy to shortly take a glimpse.
- Can be closed with Esc key or with Close button
- Can be used like a menu ("Keep window open" unchecked). Window will close after selecting a speeddial link.
- Can be used as launchpad ("Keep window open" checked). Window will stay open
- Links always open in new ROX window (vs. in ROX speeddial keys open directories always in current window)
- State of the "Keep window open" checkbox will be remembered (script updates itself. No extra config file needed)

Dependencies:
Requires gtkdialog4

Issues:
Let's see...
EDIT1: Changed <tree> attributes format to conventional syntax (see discussion below)
EDIT2: Now, 3 months later, the script has changed quite a bit and and progressed far beyond ROX speeddials. It now supports 5 different bookmark sources and goes beyond what I consider a HOWTO topic. I therefore moved the script to the Additional Software forum: http://www.murga-linux.com/puppy/viewtopic.php?t=95656
Image
The new SpeedDials script



Code: Select all

#!/bin/sh
# PURPOSE:          List all bookmarks currently assigned to keys 0~9 ("speeddials") in ROX
# PUPPY FORUM:      http://www.murga-linux.com/puppy/viewtopic.php?p=781563#781563        
# ROX Manual:       http://rox.sourceforge.net/Manual/Manual/Manual.html#id2502365
#============================================================
######## TOGGLE SCRIPT ON/OFF AND CHECK DEPENDENCIES
[ "`pidof $(basename $0)`" != "$$" ] && { pkill -f ROXKEY_DIALOG;exit; }
[ "`which gtkdialog4`" ]|| yaf-splash -text "This script requires gtkdialog4! May not work..." -close box -icon gtk-dialog-error
######## VARIABLES
WIN_HEIGHT=305 # <= Adjust this until vertical scrollbars vanish. 280 OK for Slacko, Precise 56 needs 300, Prec 57 305
WIN_WIDTH=600
CHECKBOXSTATUS=true
INPUT="/root/.config/rox.sourceforge.net/ROX-Filer/Groups.xml"
ICON='stock-id="gtk-jump-to"'
######## CREATE LIST OF ASSIGNED KEYS
TREE_ITEMS=$( 
tr -d "\n" < "$INPUT" |                             # Remove all linefeeds
sed 's/>[ \t]*</></g                                # Remove white space between tags
     s/<group name="/\n<item '$ICON'>/g' |          # Let all "<group name" tags start on new line, replace then with  <item...
sed '/^<item/!d                                     # Delete all lines that do not start with "<item"
/<\/item>/  s/"><directory>/ |[S]|/                 # Mark all lines with [S] containing </item> (=selection)
/<\/item>/! s/"><directory>/ |   |/                 # Mark all lines with blanks containing no </item> tag
            s/<\/directory>.*$/<\/item>/            # Replace everything after dir path with </item>
')
######## CREATE TOOLTIP IF ANY ITEM CONTAINS SELECTION GROUP
(( `grep -c "\[S\]" <<< "$TREE_ITEMS"` )) && TOOLTIP=$'[S]= Target contains file selection\nWhile in ROX press num.key to activate selection'
######## ADD LIST OF UNASSIGNED  KEYS
for c in {0..9};do ((`grep -c "^<item.*>$c" <<< "$TREE_ITEMS"`))||TREE_ITEMS="$TREE_ITEMS"$'\n'"<item>$c||--FREE--</item>" ;done
######## THE MEAT
export ROXKEY_DIALOG='
<window title="ROX speeddial keys 0-9" height-request="'$WIN_HEIGHT'" width-request="'$WIN_WIDTH'">
    <vbox>
        <tree exported-column="2" column-sizing="0|0|2" auto-sort="true" headers-visible="false" hover-selection="true" tooltip-text="'$TOOLTIP'" rules-hint="true" enable-search="false">
            <variable>vDIR</variable>
            <label>"Key|Selection|Directory"</label>
            '$TREE_ITEMS'
            <action>[ -d "$vDIR" ] && { rox -d "$vDIR"; [ $vCBOX = "false" ] && pkill -f ROXKEY_DIALOG ;}</action>
            <action signal="button-release-event">[ -d "$vDIR" ] && { rox -d "$vDIR"; [ $vCBOX = "false" ] && pkill -f ROXKEY_DIALOG ;}</action>
        </tree>
        <hbox>
            <checkbox>
                <label>"Keep window open"</label>
                <default>'$CHECKBOXSTATUS'</default>
                <variable>vCBOX</variable>
                <action>sed -i "0,/CHECKBOXSTATUS=.*/  s//CHECKBOXSTATUS=$vCBOX/" '"$0"'</action>
            </checkbox>
            <hbox space-expand="true" space-fill="true"><text><label>"                                                    "</label></text></hbox>
            <button><input file stock="gtk-close"></input><label>"    Close    "</label></button>
        </hbox>
    </vbox>
    <action signal="key-press-event">[ $KEY_VAL = "0xff1b" ]    && pkill -f ROXKEY_DIALOG</action>
</window>
'
export ROXKEY_DIALOG=$(echo "$ROXKEY_DIALOG" | sed 's/#[#~].*$//') # Strip comments
gtkdialog  --class=ROXKEY_DIALOG --program=ROXKEY_DIALOG
Attachments
speeddials.png
(27.62 KiB) Downloaded 1200 times
Last edited by MochiMoppel on Mon 15 Sep 2014, 01:24, edited 2 times in total.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#2 Post by Keef »

I'd always wondered what that meant, and yes, I never really read what it said either. Thanks.
Attachments
Screenshot_2014-06-06_212424.png
(24.42 KiB) Downloaded 1360 times

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#3 Post by Puppus Dogfellow »

i have gtdialog version 0.8.3 (a long way away from 4 it seems) so no surprise the script didn't work for me, but this is a cool feature. i've never come across that error box before and was completely unaware this even existed. thanks for the heads up, Mochi. very convenient.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#4 Post by RSH »

i have gtdialog version 0.8.3 (a long way away from 4 it seems)
No.

Everything from gtkdialog 0.8.0 is gtkdialog 4 (gtkdialog4)

Search the forum for "gtkdialog version 0.8.4 r514" to get the newest version.

Note: there are different versions for Lucid, Precise and Slacko.

If you are using an older puppy, gtkdialog might be a symbolic link to gtkdialog3 - check this.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#5 Post by Puppus Dogfellow »

RSH wrote:
i have gtdialog version 0.8.3 (a long way away from 4 it seems)
No.

Everything from gtkdialog 0.8.0 is gtkdialog 4 (gtkdialog4)

Search the forum for "gtkdialog version 0.8.4 r514" to get the newest version.

Note: there are different versions for Lucid, Precise and Slacko.

If you are using an older puppy, gtkdialog might be a symbolic link to gtkdialog3 - check this.
so the script should have run?

(it was cool to get to its location with a number press...)


RSH, how do i check? i typed "which gtkdialog" and the terminal just kind of ignored it. (gave me a new # line).

...

on a side note, a weird glitch i cannot now reproduce: the search results for "gtkdialog version 0.8.4 r514" gave me three pages for topic, 68 for posts, but when i tried to move off page one, i got sent back to the search box page. didn't matter if i pressed next or page number. never happened before and is not happening now, but figured i'd mention it.

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#6 Post by RSH »

The latest gtkdialog4.
The script should definitely run with this version installed.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#7 Post by Puppus Dogfellow »

RSH wrote:The latest gtkdialog4.
The script should definitely run with this version installed.
nope, but thanks for finding it for me.

(installed the precise pet on a 5.5. frugal on an SD card).

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#8 Post by MochiMoppel »

Puppus Dogfellow wrote:so the script should have run?
Yes. I tested with Precise 5.6 (uses 0.8.3, located in /usr/bin) and Slacko 5.6 (uses 0.8.4, located in /usr/sbin).
Did you copy correctly?

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#9 Post by RSH »

Tested and didn't work here also.

The cause is:

Code: Select all

       <tree
            exported-column="2"
            column-sizing="0|0|2"
            auto-sort="true"
            headers-visible="false"
            hover-selection="true" 
            tooltip-text="'$TOOLTIP'"
            rules-hint="true"
            enable-search="false"
        >
 
This needs to be a single line:

Code: Select all

        <tree exported-column="2" column-sizing="0|0|2" auto-sort="true" headers-visible="false" hover-selection="true" tooltip-text="'$TOOLTIP'" rules-hint="true" enable-search="false">
Then it works
Attachments
screenshot.jpg
(31.43 KiB) Downloaded 1370 times
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#10 Post by MochiMoppel »

That's funny. I know it should be a single line, so I was surprised to find that splitting the line into multiline chunks, which makes the code much more readable and maintainable, also works - at least for me. I just did this on a pristine Precise 5.6. Copied the code from the post into a new script template...and it worked! What do I have that others don't ? :lol:

Anyway, I edited the code.

User avatar
Puppus Dogfellow
Posts: 1667
Joined: Tue 08 Jan 2013, 01:39
Location: nyc

#11 Post by Puppus Dogfellow »

edited code works (confirmed in precise 5.6.1; the earlier version failed to run on 5.5 and 5.7 as well as this installation).

thanks for this--it'll help proliferate windows for the other script to close.

:)

[now confirmed for 5.5]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

Hello, mochimoppel.

Before I "officially" thank you ;), I need to know where and how to populate the entries of this
"speed dial". As it is, it is a good piece of code, no doubt, but it is useless! :)

"Un-official" ;) thanks in advance.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#13 Post by MochiMoppel »

If you've never used "groups" before, i.e. you never pushed Ctrl+<number>, then ROX hasn't yet created a file /root/.config/rox.sourceforge.net/ROX-Filer/Groups.xml. If you run the script before Groups.xml exists, all the slots will show --FREE--. Create some speeddials and run the script again. :wink:

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#14 Post by musher0 »

I can now issue "official" thanks! ;)
Attachments
capture16170.jpg
(42.91 KiB) Downloaded 1079 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#15 Post by MochiMoppel »

I humbly offer my official "You're welcome". But please stop editing Groups.xml manually. Look closely at your screenshot and find the mistake...

User avatar
neerajkolte
Posts: 516
Joined: Mon 10 Feb 2014, 07:05
Location: Pune, India.

Re: ROX-Filer: Superfast bookmarks

#16 Post by neerajkolte »

Many many Thanks MochiMoppel.

Any one has an idea or theory about why this was hidden by ROX.
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson

“We tend to overestimate the effect of a technology in the short run and underestimate the effect in the long run.â€￾
- Amara’s Law.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#17 Post by musher0 »

MochiMoppel wrote:I humbly offer my official "You're welcome". But please stop editing Groups.xml manually. Look closely at your screenshot and find the mistake...
Ah, yes, a typo! :) Sorry about that!
But please tell me how can I edit Groups.xml other than manually?
Thanks in advance.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#18 Post by MochiMoppel »

Groups.xml is created and managed by ROX. You shouldn't edit it.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#19 Post by musher0 »

MochiMoppel wrote:Groups.xml is created and managed by ROX. You shouldn't edit it.
Hello, MochiMoppel.

That's not an answer. Or it is, an ethical or normative, answer. But not a practical one.
You're telling me what not to do, not how to do it properly.

Ok. In communications theory, if you get the wrong answer, it's that you asked the
wrong question.

So I'll put my question another way: could you please tell me how you,
not somebody else, insert the folders in the Groups.xml file?

Thanks in advance.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#20 Post by Keef »

See my screenshot. Couldn't be much simpler.

Post Reply