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 Tue 20 Aug 2019, 07:47
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to show Recently Used Documents on JWM's Start Menu
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [32 Posts]   Goto page: 1, 2, 3 Next
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1879
Location: Japan

PostPosted: Fri 23 Sep 2016, 23:13    Post subject:  How to show Recently Used Documents on JWM's Start Menu
Subject description: Using JWM's <dynamic> tag
 

This is in response to this 5 years old post asking "is there a way to display my most recently used files on my Puppy menu?".

For JWM certainly a case of "mission impossible" at the time of the post, but JWM has evolved and now it's fairly easy and a good excuse to play with the new <dynamic> feature.

For this demo I read the content of the file recently-used.xbel. Many, but not all gtk applications use this file. It may not even exist. If it exists then the content is also visible in the "Open File" dialog (see screenshot)

Requirements: JWM version 2.3 or newer. How do you know which version you are running? You may try the command jwm -v, but most Puppybuilders don't ship final versions and the command might output a cryptic number like vgit-871. A simple workaround: Press Alt+F1. This should open the main menu. If the menu opens under the mouse pointer, it's v2.3. If the menu opens in the top left corner, you'll have to upgrade JWM to make below solution work.

Step 1: Create a script:
Code:
#!/bin/sh
XBEL_PATH=/root/.local/share/recently-used.xbel
MAX_ITEMS=20

if [[ -e $XBEL_PATH ]];then
   ITEMS=$(sed -rn 's_.*file://([^"]*).*_<Program label="\1">rox -s "\1"</Program>_ p' "$XBEL_PATH")
else
   ITEMS="<Program label=\"File ${XBEL_PATH##*/} not found!\"></Program>"
fi
echo    "<JWM>"
echo -e "${ITEMS//%/\\x}" | tail -n $MAX_ITEMS
echo    "</JWM>"


Step2: Save the script with any name and make it executable. For the purpose of this demo I named it dynamicmenu_recent.sh and saved it to folder /root/.jwm (any other folder would also be fine but this script makes only sense in the context of JWM, so I add it to the other JWM config files).

Step3. Edit /etc/xdg/templates/_root_.jwmrc and add 1 line:
    <?xml version="1.0"?>
    <JWM>
    <!-- IMPORTANT, ONLY EDIT /etc/xdg/templates/_root_.jwmrc -->
    <!-- jwm menu for puppy Linux -->
    <RootMenu label="Menu" labeled="false" height="24" onroot="3">
    <Dynamic label="Recently used">exec: /root/.jwm/dynamicmenu_recent.sh</Dynamic>
    PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-desktop.menu


Step3: Save and then in console run
fixmenus
jwm -reload

That's it. Your Puppy menu should have a new menu item "Recently used".
Clicking on a menu item will show the location in a ROX-Filer window.

Technical notes:
JWM expects the script referenced in the <dynamic> tag to output a string in the same format as would be used for an <include> tag. The only difference is that in case of <include> JWM keeps the whole menu in memory and refreshes it only when it receives a jwm -reload command while in case of <dynamic> JWM always performs a reload of the <dynamic> submenu when the user opens the main (!) menu (i.e. even if you place the <dynamic> submenu at the end of the main menu and don't open it, the script will be executed in any case)

Older Puppies may use a different path for the xbel file: /root/.recently-used.xbel
In this case adapt the code or - if in doubt - use
XBEL_PATH=$(find /root -name *recently-used.xbel)

Adapt the value of MAX_ITEMS if you require more/less menu items displayed. There also seems to exist a gtk option 'gtk-recent-files-limit' to control the line numbers but I couldn't get it to work.

Edit1: Changed echo command to avoid JWM crash when no. of items in xbel file greater than MAX_ITEMS
recently_menu_opendialog.png
 Description   Composite of 2 screenshots taken at different time, so content slightly differs
 Filesize   53.37 KB
 Viewed   1175 Time(s)

recently_menu_opendialog.png


Last edited by MochiMoppel on Sun 25 Sep 2016, 10:22; edited 1 time in total
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 6587
Location: Valåmoen, Norway

PostPosted: Sat 24 Sep 2016, 03:11    Post subject:  

Great stuff!
I have integrated into jwm_config.
https://github.com/puppylinux-woof-CE/woof-CE/commit/fb628e65177e5d89767989ed3d49b53617124b3a

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
musher0

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

PostPosted: Sat 24 Sep 2016, 06:34    Post subject:  

@zigbert:
Indeed MM did a great job on this little script, but Puppy does not have a
policy of giving credit to a member for preparatory research on a subject, eh?

MM had the intellectual honesty of mentioning where his script evolved
from, but the github Puppy people are not going to, right? He also had the
consideration of asking on the original thread if someone else would do it
before he started work on it.

That policy of yours, if it is a policy, is frankly insulting, and will be a
detriment to Puppy should it get known in the general Linuxian community
and / or publicly.

I have given credit to Mochi Moppei and others for their comments and
suggestions about my MRUF script inside the script itself and on the thread.

Why can't you from the github Puppy development team have the
generosity of mind to recognize the preliminary research and achievements
that I have done on that subject for non-jwm window managers?

Viewed from here, that attitude coming from one of the Woof-CE majors
looks a lot like a type of chauvinism against non-jwm development.

Regards.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1879
Location: Japan

PostPosted: Sun 25 Sep 2016, 10:42    Post subject:  

I edited my initial post to fix a bug in the script (see Edit 1).

Regarding the origin of the script : It didn't have to evolve from anywhere. It already existed. I simply copied it (not worth any credits Laughing ) from my earlier application SpeedDials 2.0 and adapted it to the JWM syntax. SpeedDials can also show Recent Used files and is also dynamic, but it is not integrated into the menu and has a different purpose.
SpeedDialvsDynamicMenu.png
 Description   
 Filesize   58.16 KB
 Viewed   1049 Time(s)

SpeedDialvsDynamicMenu.png

Back to top
View user's profile Send private message 
mfb

Joined: 22 Mar 2016
Posts: 80

PostPosted: Sun 25 Sep 2016, 10:48    Post subject:  

Thank you MochiMoppel.

Re: post immediately below - here is a pet of the latest version of jwm - it works for me - but, for safety, backup before trying it.
jwm-1553.pet
Description 
pet

 Download 
Filename  jwm-1553.pet 
Filesize  143.24 KB 
Downloaded  238 Time(s) 

Last edited by mfb on Sun 25 Sep 2016, 18:47; edited 1 time in total
Back to top
View user's profile Send private message 
LazY Puppy


Joined: 21 Nov 2014
Posts: 2007
Location: Germany

PostPosted: Sun 25 Sep 2016, 18:25    Post subject:  

Quote:
...you'll have to upgrade JWM to make below solution work.

How to do this update of jwm to 2.3?

PPM doesn't have a newer version than 2.1 (tahr puppy).

One needs to compile for oneself?

_________________
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) Laughing

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! Wink
Back to top
View user's profile Send private message 
musher0

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

PostPosted: Sun 25 Sep 2016, 19:45    Post subject:  

mfb wrote:
Thank you MochiMoppel.

Re: post immediately below - here is a pet of the latest version of jwm - it works for me - but, for safety, backup before trying it.
Hello.

Please mention the URL where you found that exec (on the Internet or on
this forum) if you did not compile it yourself?

If you compiled it yourself, please state where does the source code
come from? The jwm site? Also, the ./config formula: it is important to
know if all functions of the app have been enabled at compile time to
prevent head-scratching later.

Finally, on which Puppy and what glibc library that Puppy had? As you
know, compiling an app on a Pup that has C library 2.19 (Dpup-4.87 or
Librepup, for example) will prevent that app from running on a Puppy
that runs with a lower version of the C library.

TIA.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

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

PostPosted: Sun 25 Sep 2016, 20:16    Post subject:  

Hello all.

I just tested the jwm-1553 offered above on the Puduan-6 Pup.

Using it I am sent back to the no X console whenever I try to get the
menu (right-click). I never got a chance to see MM's dynamic script in
action.

Considering that the jwm 2.3.5 that came with the woof-CE does not
decorate the windows correctly (no square buttons to the right for close,
iconify and expand), I'd venture to say that these new jwm's still need
work before being officially released.

By comparison, when Chris Cannam, the author of wmx, puts out a
new version, the user never experiences such frustrations: when a new
version of wmx is released, it is really ready to be presented to the
public.

The jwm version that works well on the Puduan is v. 2.2.2. Period.

Put that in your pipe and smoke it. BFN.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
LazY Puppy


Joined: 21 Nov 2014
Posts: 2007
Location: Germany

PostPosted: Sun 25 Sep 2016, 22:20    Post subject:  

Hi.

Compiled JWM 2.3.6 in tahr 602 and tahr64 605.

Options used for compiling.

_________________
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) Laughing

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! Wink
Back to top
View user's profile Send private message 
Sailor Enceladus

Joined: 22 Feb 2016
Posts: 1561

PostPosted: Sun 25 Sep 2016, 22:21    Post subject:  

@LazY Puppy: I think Tahrpup already has 2.3? It has the flat look of it with no borders anyway.
Back to top
View user's profile Send private message 
LazY Puppy


Joined: 21 Nov 2014
Posts: 2007
Location: Germany

PostPosted: Sun 25 Sep 2016, 22:36    Post subject:  

Sailor Enceladus wrote:
@LazY Puppy: I think Tahrpup already has 2.3? It has the flat look of it with no borders anyway.

In tahr 602 at Alt F1 or F12 the JWM menu appears at left/top corner, so regarding MochiMoppels description it says: it is below 2.3. Also it returns a version number 971 git something (or similar). Surely I don't have time to waste, so I wouldn't had tried to compile JWM for tahr 602 if there were alread 2.3 installed. Need to check tahr 605 though.

Edit: checked tahr 605. The JWM menu appears at left/top corner. Returns version vgit 976.

Edit2: checked xenial 704 binary. It returns version 2.3.5, mentioned by musher0 for its issues to not to decorate the windows correctly.

Edit3: Tested the 32bit package in Unicorn 6.0 and Vivid beta2. Works!

Anyway, thanks for that info. Assuming an equal version in tahr64 605 I can't recall ever trying Alt F1 or F12, so I can't say how it works.

Though currently running thar64 605 with the compiled 2.3.6 binary the menu appears under the mouse pointer position.

Checked the jwm binary in /initrd/pup_ro2/usr/bin/jwm returns 2.3.4.

Code:
root# /initrd/pup_ro2/usr/bin/jwm -version
unrecognized option: -version
JWM v2.3.4 by Joe Wingbermuehle
compiled options: confirm fribidi icons jpeg nls png shape svg xbm xft xinerama xpm xrender
system configuration: /etc/system.jwmrc
usage: jwm [ options ]
  -display X  Set the X display to use
  -exit       Exit JWM (send _JWM_EXIT to the root)
  -f file     Use specified configuration file
  -h          Display this help message
  -p          Parse the configuration file and exit
  -reload     Reload menu (send _JWM_RELOAD to the root)
  -restart    Restart JWM (send _JWM_RESTART to the root)
  -v          Display version information
root#

I think I can keep the .pet packages attached, for named reasons and its new version number, though.

_________________
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) Laughing

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! Wink
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1879
Location: Japan

PostPosted: Mon 26 Sep 2016, 01:45    Post subject:  

mfb wrote:
here is a pet of the latest version of jwm - it works for me
Thanks, works for me too (Slacko 5.6). I didn't install the pet, I only extracted the jwm binary. That's all we need Laughing

LazY Puppy wrote:
How to do this update of jwm to 2.3?
Maybe I shouldn't have mentioned upgrading at all. JWM 2.3 comes with some syntax changes which may require changes in the user's JWM config files, so upgrading only JWM would only be for experienced users. The safest bet is to stay with the version that came with the Puppy.

LazY Puppy wrote:
One needs to compile for oneself?
That's what I did because I wanted a final version and not a snapshot. The manual refers to version numbers, not to -vgit numbers. I consider snapshots experimental.

LazY Puppy wrote:
checked tahr 605. The JWM menu appears at left/top corner. Returns version vgit 976.
Confirmed. JWM in Tahrpup stays at vgit 976 since 2 years. <Dynamic> is not yet implemented.

musher0 wrote:
Using it I am sent back to the no X console whenever I try to get the menu
Looks like you used the original script and not the bugfixed version (see Edit 1)
Back to top
View user's profile Send private message 
musher0

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

PostPosted: Mon 26 Sep 2016, 04:47    Post subject:  

@MM
Ah. Thanks for the info. Your edited version works fine now with jwm-2.3.5.

BFN.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
B.K. Johnson

Joined: 12 Oct 2009
Posts: 755

PostPosted: Mon 26 Sep 2016, 13:39    Post subject:  

Hey guys
You should be aware that the offering by mfb, though MochiMoppel got it to work and is not recommended for people like me is a snapshot as shown by this excerpt from Joe's website

Quote:
Download

Current release: JWM v2.3.6 (sig, release notes, older releases)
Latest development snapshot: JWM snapshot 1553 (sig, release notes, older snapshots)
See the ChangeLog for details on what has changed (releases and snapshots are tagged).

_________________
B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM

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


Joined: 07 Jan 2013
Posts: 1613
Location: nyc

PostPosted: Tue 27 Sep 2016, 00:30    Post subject:  

thanks, Mochi. (also thanks to LazyPupy--32 bit jwm 236 pet didn't work in precise (5.7.2), but 64bit worked in tahr64 without a reboot or x restart (precise showed 2.3.6 in response to jwm -v, but it didn't show any traces of the new syntax (my trays should've needed adjusting) or the mouse pointer change that Mochi mentions in the opening post. -reload, -restart --no change. x restart gave me a black screen. reboot gave me a black screen. i removed the dynamic line by accessing the file with another installation. rebooted into the precise install--black screen. anyway, i don't recommend the 32 bit pet in precise, or i am here to say i can't get it to work and seem to have killed that installation)).

Cool Razz Confused
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [32 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.1433s ][ Queries: 13 (0.0334s) ][ GZIP on ]