Add A JWM Bookmarks Menu or Submenu/Messing Around With JWM

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#16 Post by greengeek »

OK, I got your suggestion working thanks saintless - tried it with my usb music stick instead of docs: Easier than I thought. Now to try the other mods..
Attachments
music-on-flash.jpg
(162.77 KiB) Downloaded 749 times

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

#17 Post by musher0 »

MochiMoppel wrote:Girls, I'm lost! What is the topic? First JWM Bookmarks Menu, then keyboard shortcuts, then "Places" sub-menu and now it's about mounting devices to fixed address based on a list?

The latter seems tricky and close to impossible, but the idea to do it the other way round, to create a menu item that calls a specific USB stick (identified by its UUID), no matter if Puppy calls it sdd1 or sdt1, should be no problem. The real problem: JWM menus are pretty static. Unlike the drive icons, which appear and disappear depending on what's hooked to the machine, a menu would not change. This means you would have a menu entry for "MyMusicStick" even when the stick is not plugged in. Sure, it's possible to recreate and reload the menu, but this requires an external script and is not a nice solution. Using a dynamic menu built with Gtkdialog or some other tools would be much easier, but this wouldn't be a JWM menu...

If you still want to use JWM, try following menu code (I sorted it after dinner :wink: ):

Code: Select all

		<Program label="MyMusicStick">
			UUID="8346-747C"
			DRIVE=$(echo `blkid` | sed /"$UUID"/'s/:.*$//;s/dev/mnt/')
			rox $DRIVE
		</Program>
Adjust the UUID to your needs. The code runs the blkid command to find the UUIDs of all devices and feeds the result to sed. sed searches for the specified UUID and puts the result (/mnt/sd...) into variable DRIVE. Finally ROX runs DRIVE.
This is quite slow, blkid needs some time. I'm sure this can be improved, but it should suffice to give you an idea.
What is important here: JWM menus have the teriffic ability to process bash commands. No external scripts needed.
Another example? This calls Puppy's boot partition:

Code: Select all

		<Program label="BOOTPARTITION"	icon="usb16.xpm">
			. /etc/rc.d/PUPSTATE
			rox /mnt/$PDEV1
		</Program>
Right on the ball, MochiMoppel ! :) Important breakthrough, too ! :) I, for one, didn't
know that "JWM menus have the teriffic ability to process bash commands."

I need to study your first example a little more, but your second one "speaks" by
itself. Brilliant !

BFN.

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

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

#18 Post by musher0 »

Here's a partial screen capture for those of you who wouldn't know what the gnome
desktop looks like. The "Places" sub-menu is typical -- and super handy.
Attachments
Zorin_OS_gnome_desktop(part).jpg
(11.3 KiB) Downloaded 680 times
Last edited by musher0 on Sun 18 May 2014, 18:42, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#19 Post by Puppus Dogfellow »

musher0 wrote:..
Zorin_OS_gnome_desktop(part).jpg
Description Here's a partial screen capture for those of you who wouldn't know what the gnome desktop looks like. The "Places" sub-menu is typical -- and super handy.
Filesize 11.3 KB
Viewed 9 Time(s)

Zorin_OS_gnome_desktop(part).jpg

applications, places, and system are three popup bookmark menus?


if so, that's really cool (and i'm pretty sure Mochi knows how to make those as well...).

User avatar
saintless
Posts: 3862
Joined: Sat 11 Jun 2011, 13:43
Location: Bulgaria

#20 Post by saintless »

MochiMoppel wrote:... JWM menus have the teriffic ability to process bash commands. No external scripts needed.
Another example? This calls Puppy's boot partition:

Code: Select all

		<Program label="BOOTPARTITION"	icon="usb16.xpm">
			. /etc/rc.d/PUPSTATE
			rox /mnt/$PDEV1
		</Program>
Thanks, I also did not know this.
I think rox /mnt/$PDEV1 will not work because the boot partition is mounted as /mnt/home after you create save file but it is not /mnt/home in /etc/rc.d/PUPSTATE. It is sdX and this mount point is missing in /mnt

Edit: If I do not mistake the boot partition is /initrd/mnt/dev_save with link to /mnt/home if there is save file in use and /initrd/mnt/dev_ro2 if there is no save file in use. I do not see information about this mount points in PUPSTATE in DPup at least.
Puppus Dogfellow wrote:if so, that's really cool (and i'm pretty sure Mochi knows how to make those as well...)
It will save you some time and questions just to download the example gnome lookalike jwmrc file from my previous post but it is your choice of course.
Last edited by saintless on Sun 18 May 2014, 15:58, edited 1 time in total.

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

#21 Post by Puppus Dogfellow »

saintless wrote:
Puppus Dogfellow wrote:if so, that's really cool (and i'm pretty sure Mochi knows how to make those as well...)
It will save you some time and questions just to download the example gnome lookalike jwmrc file from my previous post but it is your choice of course.
saintless wrote:Just for example:

Create directory /mnt/docs.

Create executable script /usr/bin/docs-on-flash

Code: Select all

#!/bin/bash

mount UUID=74B1-AB6F /mnt/docs
rox /mnt/docs
and add this line in .jwmrc

Code: Select all

<Program label="Docs on Flash" icon="docs.png">docs-on-flash</Program>
Docs on Flash menu entry will mount and open this flashdrive with UUID=74B1-AB6F if it is plugged in. It can be sdb1, sdc2, sde3 but it always will be mounted in /mnt/docs
If it is not plugged in Rox opens empty /mnt/docs

And one jwmrc example that might be interested for this thread - Gnome lookalike JWM:
http://murga-linux.com/puppy/viewtopic. ... d4f2427f5c

Toni
Thanks for that, Toni. it looks really cool and i think i get what i'm looking at (there's no need for a separate jwmrc-tray file your way?). thing is, until i saw musher's pic i wasn't really interested in the file--i may not have seen it at all as i figured you were addressing greengeek's issue, which is somewhat beyond me.

where in puppy is the best place to put those additional root menus?

thanks again.

User avatar
saintless
Posts: 3862
Joined: Sat 11 Jun 2011, 13:43
Location: Bulgaria

#22 Post by saintless »

Puppus Dogfellow wrote:(there's no need for a separate jwmrc-tray file your way?)
The original file is made from kerry_s for old Ubuntu version with JWM on low RAM machine. This way jwmrc includes all in one file. It is not easy to be found in google so I posted the file in this forum few years ago. His post is here:
http://ubuntuforums.org/showthread.php? ... ost6913820
I think it will be best and safe just to separate the file for use with Puppy, otherwise refresh-menus will not work. Or to use only the part with Places, System and Applications with your current theme and settings.
Always run jwm -p to check for errors after the changes.
I will check out this thread if I can help with some answers.

Toni

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

#23 Post by Puppus Dogfellow »

saintless wrote:
Puppus Dogfellow wrote:(there's no need for a separate jwmrc-tray file your way?)
The original file is made from kerry_s for old Ubuntu version with JWM on low RAM machine. This way jwmrc includes all in one file. It is not easy to be found in google so I posted the file in this forum few years ago. His post is here:
http://ubuntuforums.org/showthread.php? ... ost6913820
I think it will be best and safe just to separate the file for use with Puppy, otherwise refresh-menus will not work. Or to use only the part with Places, System and Applications with your current theme and settings.
Always run jwm -p to check for errors after the changes.
I will check out this thread if I can help with some answers.

Toni
Awesome. Thanks and welcome to the thread.
:D

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

#24 Post by musher0 »

Puppus Dogfellow wrote:
musher0 wrote:..
Zorin_OS_gnome_desktop(part).jpg
Description Here's a partial screen capture for those of you who wouldn't know what the gnome desktop looks like. The "Places" sub-menu is typical -- and super handy.
Filesize 11.3 KB
Viewed 9 Time(s)

Zorin_OS_gnome_desktop(part).jpg

applications, places, and system are three popup bookmark menus?

if so, that's really cool (and i'm pretty sure Mochi knows how to make those as well...).
Hi, Puppus_D.

They are roll-down menus, but not all "bookmarks" menu. The "applications" menu
does the same thing as ours -from the graphics sub-menu down to the fun section.
Except it's glued to the gnome panel.

The "places" menu opens pcman file manager or equivalent program in various
important folders such as top, root, my-documents. This one could qualify as a
"bookmarks" menu as you understand it.

The "systems" menu is reserved for system applications -- similar to the first part of
our jwm menu in Puppy: utilities, parameters and the like.

I hope this helps.

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

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#25 Post by greengeek »

MochiMoppel wrote:

Code: Select all

		<Program label="MyMusicStick">
			UUID="8346-747C"
			DRIVE=$(echo `blkid` | sed /"$UUID"/'s/:.*$//;s/dev/mnt/')
			rox $DRIVE
		</Program>
Hi Mochi - I was not able to get this to work - I applied the correct UUID but it returns the following error for me:

Code: Select all

File doesn't exist, or I can't access it: /mnt/loop1
(using upup Raring 3.9.9.2). Any thoughts?

@Puppus... I hope my questions are not detracting from your original concept - I'm heading back to the point of using your bookmark method shortly - I just wanted to find a way to incorporate a link to a usb stick that I know is plugged into the machine but without knowing which sdx number it is. Sometimes I may have 7 or 8 partitions showing on the desktop and no idea which one is the music stick - so I am aiming at using your bookmark method, combined with the UUID identifier of the music partition to ensure I can go straight to my music without having any idea which stick is which (ie: I know longer have to care about sdb1, sdb2, sdb3, sdc1, scd2, sdd1, sdd2, sde1 - the numbers become irrelevant to me finding my way around the machine).

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

#26 Post by musher0 »

Hi, everyone.

This is my take on the procedure that Puppus' explained in his first post.

Code: Select all

<Menu label=" Places" icon="/root/my-documents/clipart/oxywhite-folder-open.png" height="16">
<Program label="Top (/)" icon="mini-filemgr.xpm">exec rox /</Program>
<Program label="root (~)" icon="/root/home.png">exec rox /root</Program>
<Program label="My Documents" icon="/root/my-documents/clipart/Dossiers.png">exec rox /root/my-documents</Program>
<Program label="My Applications" icon="mini-filemgr.xpm">exec rox /root/my-applications</Program>
<Program label="usr/share" icon="mini-filemgr.xpm">exec rox /usr/share</Program>
</Menu>
It goes in file /etc/xdg/templates/_root_.jwmrc, between the fun menu and the help program. Save, then open a console and type

Code: Select all

fixmenus
jwm -restart
You may have to find some equivalent icons. I mean: if you don't have them on your system somewhere, the icons above won't show. You'll have to find equivalents.

Also, I've changed the default jwm menu template. So my jwm menu won't look like your traditional Puppy menu. This is bad, I know, but it should cure itself! ;)

BFN.

musher0
Attachments
jwm-places.jpg
(19.28 KiB) Downloaded 601 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#27 Post by Puppus Dogfellow »

greengeek wrote:
MochiMoppel wrote:

Code: Select all

		<Program label="MyMusicStick">
			UUID="8346-747C"
			DRIVE=$(echo `blkid` | sed /"$UUID"/'s/:.*$//;s/dev/mnt/')
			rox $DRIVE
		</Program>
Hi Mochi - I was not able to get this to work - I applied the correct UUID but it returns the following error for me:

Code: Select all

File doesn't exist, or I can't access it: /mnt/loop1
(using upup Raring 3.9.9.2). Any thoughts?

@Puppus... I hope my questions are not detracting from your original concept - I'm heading back to the point of using your bookmark method shortly - I just wanted to find a way to incorporate a link to a usb stick that I know is plugged into the machine but without knowing which sdx number it is. Sometimes I may have 7 or 8 partitions showing on the desktop and no idea which one is the music stick - so I am aiming at using your bookmark method, combined with the UUID identifier of the music partition to ensure I can go straight to my music without having any idea which stick is which (ie: I know longer have to care about sdb1, sdb2, sdb3, sdc1, scd2, sdd1, sdd2, sde1 - the numbers become irrelevant to me finding my way around the machine).
you're just expanding on what i had in mind in the first place--get the main menu and button system (some call it a "windows manager") to do as much as we can get it to do as quickly and smoothly as possible. no need to apologize--i think it's great. now that the competent and skilled have taken an interest, this thread could really be something (i wanted it to be helpful to others, but it was in part just a cheat sheet for (if i ever get around to) moving to a new puppy--copy and paste the menu bits, download some stuff from the repo--a back up of some of my system files in an easily accessible form...). JWM seems as flexible as it is fast and How To Completely Bend JWM To Your Whims is a nice goal for the next thread title adjustment.

as far as i'm concerned, the more stuff we can get the menus, buttons, and keys to do the better.

:twisted:


...i'd like the various rox right click menus to be parts of at least some of the jwm menus...

8)

...it would also be nice to have a list of all the open windows at a click or key press...as a menu or a popup, perhaps each with its own menu (such as the stock jwm windows menu) at right click, activated/moved to with left...
Last edited by Puppus Dogfellow on Sun 18 May 2014, 21:34, edited 1 time in total.

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

#28 Post by Puppus Dogfellow »

musher0 wrote:Hi, everyone.

This is my take on the procedure that Puppus' explained in his first post.

Code: Select all

<Menu label=" Places" icon="/root/my-documents/clipart/oxywhite-folder-open.png" height="16">
<Program label="Top (/)" icon="mini-filemgr.xpm">exec rox /</Program>
<Program label="root (~)" icon="/root/home.png">exec rox /root</Program>
<Program label="My Documents" icon="/root/my-documents/clipart/Dossiers.png">exec rox /root/my-documents</Program>
<Program label="My Applications" icon="mini-filemgr.xpm">exec rox /root/my-applications</Program>
<Program label="usr/share" icon="mini-filemgr.xpm">exec rox /usr/share</Program>
</Menu>
It goes in file /etc/xdg/templates/_root_.jwmrc, between the fun menu and the help program. Save, then open a console and type

Code: Select all

fixmenus
jwm -restart
You may have to find some equivalent icons. I mean: if you don't have them on your system somewhere, the icons above won't show. You'll have to find equivalents.

Also, I've changed the default jwm menu template. So my jwm menu won't look like your traditional Puppy menu. This is bad, I know, but it should cure itself! ;)

BFN.

musher0
yup, that's pretty much exactly what i had in mind.

as to the icons, people don't really need to worry about it too much. random selections copied from other menu entries work, as does just leaving it blank--that can be fiddled with at a later time if the mismatch or empty space starts to get to you.

you can also just change or repurpose some of what's already there--who really ever uses that help entry? (i think i made it a webpage before it ended up buried five menus deep somewhere). also, unless i'm mistaken, any jpg or svg or png file works as an icon--i never resize them, or at best only half of mine are anywhere near real icon size, and it never seems to have mattered--they display regardless so long as the path is entered correctly.

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

#29 Post by Puppus Dogfellow »

here's a template for getting six shortcuts from the spacebar:

Code: Select all

<Key mask="A" key="space">exec:rox /mnt</Key>
<Key mask="C" key="space">root:3</Key>
<Key mask="S" key="space">window</Key>
<Key mask="CA" key="space">exec:urxvt</Key>
<Key mask="CS" key="space">exec:geany</Key>
<Key mask="AS" key="space">exec:partview</Key>

the above reflects what i think of as generally helpful choices. one of them was a failed attempt at getting a secondary root menu going. i had a root menu on 6 placed in jwmrc-personal, but when i clicked it, it just cycled weirdly through the entries(at an enormous size, i might add; maybe what i wrote earlier about icon choice size not mattering actually depends on the particular set up...)

anyway, i've never run jwm -p and am kind of fearful of it telling me it finds my setup unacceptably fkd up...

***

here's a template for getting another six from the escape button:

Code: Select all

<Key mask="A" key="Escape">exec:rox /usr/share/applications</Key>
<Key mask="C" key="Escape">minimize</Key>
<Key mask="S" key="Escape">maximize</Key>
<Key mask="CA" key="Escape">move</Key>
<Key mask="CS" key="Escape">resize</Key>
<Key mask="AS" key="Escape">exec:/root/.Pup-Shots/.PupShots</Key>
Last edited by Puppus Dogfellow on Mon 19 May 2014, 02:43, edited 1 time in total.

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

#30 Post by MochiMoppel »

greengeek wrote:Hi Mochi - I was not able to get this to work
Me too :lol: Worked here , but I remember some funny leftover characters after pasting the code .... I'll fix it when I have time.

This works for me:

Code: Select all

      <Program label="MyMusicStick"> 
          UUID="84F8-9DFA"
          DRIVE=$(echo "`blkid`" | sed -n /"$UUID"/'s/:.*$//p' | sed 's/dev/mnt/') 
          rox $DRIVE 
       </Program>
Last edited by MochiMoppel on Mon 19 May 2014, 08:15, edited 3 times in total.

User avatar
saintless
Posts: 3862
Joined: Sat 11 Jun 2011, 13:43
Location: Bulgaria

#31 Post by saintless »

Hi, MochiMoppel.

I think the problem is the mounting does not happen and if there is no already created mount point directory in /mnt it will error but I might be wrong.
It is too complicated for me to make it simpler but like this it should work in any case.

Code: Select all

<Program label="MyMusicStick"> 
MYUUID="8346-747C"
DRIVE=$(echo `blkid -o device -t UUID="$MYUUID"` | sed /"$MYUUID"/'s/:.*$//;s/dev/mnt/')
mkdir $DRIVE
mount UUID="8346-747C" $DRIVE
rox $DRIVE
</Program>
Edit. Typo error in blkid line corrected.
Last edited by saintless on Mon 19 May 2014, 09:58, edited 1 time in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#32 Post by greengeek »

saintless wrote:

Code: Select all

<Program label="MyMusicStick"> 
MYUUID="45B6-2F7F"
DRIVE=$(echo `blkid -l -o device -t UUID="$MYUUID"` | sed /"$MYUUID"/'s/:.*$//;s/dev/mnt/')
mkdir $DRIVE
mount UUID="45B6-2F7F" $DRIVE
rox $DRIVE
</Program>
This seems to open my root directory rather than the stick referred to by UUID. Should I have created a mnt point first or something? I will try a couple of other variations...

EDIT :What mount point would this be looking for? /mnt/music? or /mnt/sdx something?
Last edited by greengeek on Mon 19 May 2014, 09:21, edited 1 time in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#33 Post by greengeek »

As long as I create the /mnt/music directory first then this works:

Code: Select all

<Program label="Music on Flash" icon="music24.png">
	mount UUID=45B6-2F7F /mnt/music
	rox /mnt/music
</Program>
I'm pretty happy with that, I think I could now set up a Places or Bookmarks entry in the menu and link straight to my external usb sticks in a more organised fashion. Thanks!

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

#34 Post by MochiMoppel »

Saintless' code doesn't work for me either. No mounting :cry:

I have a better idea (keep fingers crossed!). Let's search for the device name (e.g. sdb1) of a given UUID and then run the same script as the desktop drive icons would run. If you click a drive icon of an unmouted device, the device gets mounted and ROX will run. Let's do the same:

Code: Select all

<Program label="MyMusicStick"> 
UUID="F620E" 
DRIVE=$(echo "`blkid`" | sed -n /"$UUID"/'s/:.*$//p' | sed 's|/dev/||') 
/root/.pup_event/drive_$DRIVE/AppRun
</Program>
The drive icons also pass parameters (usbdrv vfat), which should be added to the last line if known, but things seem to be fine without them.

EDIT: @greengeek: Seeing you happy makes me happy :lol: By all means go for a simple solution and forget my cryptic stuff.
Last edited by MochiMoppel on Mon 19 May 2014, 09:44, edited 1 time in total.

User avatar
saintless
Posts: 3862
Joined: Sat 11 Jun 2011, 13:43
Location: Bulgaria

#35 Post by saintless »

Sorry, guys :( Typo error while copying blkid line:

Code: Select all

       <Program label="Music on Flash"   icon="usb16.xpm">
MYUUID="45B6-2F7F"
DRIVE=$(echo `blkid -o device -t UUID="$MYUUID"` | sed /"$MYUUID"/'s/:.*$//;s/dev/mnt/')
mkdir $DRIVE
mount UUID="45B6-2F7F" $DRIVE
rox $DRIVE
      </Program>

Post Reply