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
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