Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 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 Wed 17 Sep 2014, 05:33
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
ROX-Filer: Superfast bookmarks
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [41 Posts]   Goto page: 1, 2, 3 Next
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 393
Location: Japan

PostPosted: Fri 06 Jun 2014, 03:18    Post subject:  ROX-Filer: Superfast bookmarks
Subject description: Using speeddial keys
 

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

The new SpeedDials script




Code:
#!/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
speeddials.png
 Description   
 Filesize   27.62 KB
 Viewed   450 Time(s)

speeddials.png


Last edited by MochiMoppel on Sun 14 Sep 2014, 21:24; edited 2 times in total
Back to top
View user's profile Send private message 
Keef


Joined: 20 Dec 2007
Posts: 628
Location: Staffordshire

PostPosted: Fri 06 Jun 2014, 16:27    Post subject:  

I'd always wondered what that meant, and yes, I never really read what it said either. Thanks.
Screenshot_2014-06-06_212424.png
 Description   
 Filesize   24.42 KB
 Viewed   391 Time(s)

Screenshot_2014-06-06_212424.png

Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 564
Location: nyc

PostPosted: Fri 06 Jun 2014, 18:47    Post subject:  

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.
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Fri 06 Jun 2014, 19:36    Post subject:  

Quote:
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.

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 564
Location: nyc

PostPosted: Fri 06 Jun 2014, 19:42    Post subject:  

RSH wrote:
Quote:
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.
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Fri 06 Jun 2014, 20:02    Post subject:  

The latest gtkdialog4.
The script should definitely run with this version installed.

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 564
Location: nyc

PostPosted: Fri 06 Jun 2014, 20:09    Post subject:  

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).
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 393
Location: Japan

PostPosted: Fri 06 Jun 2014, 20:15    Post subject:  

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?
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Fri 06 Jun 2014, 20:16    Post subject:  

Tested and didn't work here also.

The cause is:
Code:
       <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:
        <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
screenshot.jpg
 Description   
 Filesize   31.43 KB
 Viewed   346 Time(s)

screenshot.jpg


_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 393
Location: Japan

PostPosted: Fri 06 Jun 2014, 20:29    Post subject:  

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

Anyway, I edited the code.
Back to top
View user's profile Send private message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 564
Location: nyc

PostPosted: Fri 06 Jun 2014, 22:46    Post subject:  

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.

Smile

[now confirmed for 5.5]
Back to top
View user's profile Send private message 
musher0


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

PostPosted: Sat 07 Jun 2014, 00:17    Post subject:  

Hello, mochimoppel.

Before I "officially" thank you Wink, 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! Smile

"Un-official" Wink thanks in advance.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 393
Location: Japan

PostPosted: Sat 07 Jun 2014, 00:43    Post subject:  

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
Back to top
View user's profile Send private message 
musher0


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

PostPosted: Sat 07 Jun 2014, 01:14    Post subject:  

I can now issue "official" thanks! Wink
capture16170.jpg
 Description   
 Filesize   42.91 KB
 Viewed   299 Time(s)

capture16170.jpg


_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 393
Location: Japan

PostPosted: Sat 07 Jun 2014, 03:06    Post subject:  

I humbly offer my official "You're welcome". But please stop editing Groups.xml manually. Look closely at your screenshot and find the mistake...
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [41 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic 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.1071s ][ Queries: 12 (0.0040s) ][ GZIP on ]