SimplePuppyMenu

Stuff that has yet to be sorted into a category.
Message
Author
aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

SimplePuppyMenu

#1 Post by aragon »

Plaese see here for SimplePuppyMenu2: http://www.murga-linux.com/puppy/viewtopic.php?p=602434

SimplePuppyMenu (spm) is a menu system for 'menuless' wm like echinus. the menu is similar to the jwm-menu, but no icons and no differentiated subcategories. the menu itself is run via aemenu.

spm consists of two scripts:
1. spm-parser
a perl script that parses the desktop-files in /usr/share/applications and writes them to a rc-file for aemenu.

2. spm
a wrapper for all actions:
spm -m launch the menu
spm -u update the menu-file
spm -h display help
spm -v display version

to make use of spm, you should assign a keyboard-shortcut to 'spm -m'. how to do that depends on your wm.

if you want to update on every startup, make a script with 'spm -u &' in /root/Startup.

Dependencies are aemenu (attached) and perl (puppy-version is sufficient).

------------
Version 0.4 2010/01/19
------------
- apps are now sorted case-insensitive.
------------
Version 0.3 2010/01/18
------------
- changed fixed path /root to $HOME to support multiuser-environments.
- moved SAMPLEspm-bottom and SAMPLEspm-top from /root/.config/spm to /usr/share/doc/spm.
------------
Version 0.2 2010/01/11
------------
The rcdir has changed to /root/.config/spm as this seems to be the correct place.
But you won't feel a difference. As /root/.spm is no longer needed, you could delete
it after you've run 'spm -u' once.

The spm-parser now only generates the items from the desktop-files. Additional
(user-generated) items at top and/or bottom of the menu are now handled by spm
using the 2 template files

/root/.config/spm/spm-top
/root/.config/spm/spm-bottom

i've included samples for each in the named dir. So if you want a menu with
help and Poweroff-Submenu simple rename the SAMPLEspm-bottom.

I've also added a html-help /usr/share/doc/spm.html and a changelog
/usr/share/doc/spm/changelog. Help (spm -h) is also updated.
------------

Tested in Puppy 4.31.

My thanks go to Christian (musher0) who pointed me at aemenu and Chris Rouch who is the author of the original parser-script i've modified for spm.

aragon
Attachments
spm-0.4.pet
(4.85 KiB) Downloaded 991 times
spm-0.3.pet
only for documentation, please use the actual release
(4.79 KiB) Downloaded 904 times
spm-0.2.pet
only for documentation, please use the actual release
(4.78 KiB) Downloaded 946 times
spm.png
(34.7 KiB) Downloaded 2560 times
spm-0.1.pet
only for documentation, please use the actual release
(3.72 KiB) Downloaded 942 times
aemenu-1.2.12.pet
(7.91 KiB) Downloaded 1012 times
Last edited by aragon on Mon 06 Feb 2012, 17:36, edited 4 times in total.

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#2 Post by trapster »

Hmm, this might go nice with wmii. I will have to give it a try!
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#3 Post by amigo »

aemenu is nice, I use it in a couple of ROX AppDirs to provide pop-up menu items.
aragon, have you figured out how to get it to display icons -IIRC it is supposed to bt I never figured out the right syntax -or perhaps it is broken and waiting to be fixed....

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#4 Post by aragon »

@trapster
yes, go for it. on my trials to do such a base menu system i have some tests with other apps (ratmenu,...) but aemenu is a definite winner (if you like 'straight' solutions).

@amigo
never heard of that aemenu could display icons (and never had thought that it might could). but that's ok for me. i've the feeling that it often gets complicated if you want to display menu-icons, i've had problems with that in much wm.

@all
what i've forgotten to mention:
the psm-parser could be easy adapted for all kind of menu-systems also if your wm has a menu system e.g. you could generate a root-menu for pekwm.

aragon

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#5 Post by dejan555 »

This is cool aragon, works here in dpup, I'm using it /w karmen wm and rox panel/pinboard combination. Also this aemenu rc syntax seems good for making this kind of stuff, practically similar to most other menu rc.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#6 Post by dejan555 »

Is there some template or script to edit to make it remember som changes like for example, I don't want it to make Shutdown submenu but to launch pshutdown dialog, so I edit /root/.spm/spm-rc:

Code: Select all

cmd "Shutdown" "exec /usr/bin/shutdownjwm"
But if I update spm it rolls back to shutdown submenu.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#7 Post by aragon »

dejan,

the generation of the help-item and the shutdown-submenu are coded into spm-parser. look at the last lines, i think you'll get the syntax.

aragon

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#8 Post by dejan555 »

K, thanks
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#9 Post by aragon »

dejan made a valid point about user-items for the menu. i will update the package (i think tomorrow).

the implemented changes will be:
1. psm-parser will only create the menu-items from the desktop-file.
2. there will be user-changeable rc-files for top- and bottom where users can put 'their' own commands and submenus. these will be added to the top/bottom of the menu-file if the user runs 'psm -u' to update the menu.

aragon

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#10 Post by aragon »

Version 0.2 uploaded. See main post for changelog and pet.

aragon

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

#11 Post by musher0 »

Hello, aragon.

Nice job, as far as I can see. I haven't tried your adaptation but I'm familiar enough with aemenu since I've incorporated it in my compiles of echinus and wmx.

I'll just say this: good job, but this is only the surface of possibilities with aemenu. For one thing, it has the possibility to call itself, therefore you can have a metamenu with a chain of aemenus calling each other not only to launch programs but to group them in the way you yourself use your computer. Regroup the programs you use the most often in thematic menus, for example. Shut the rox-panel, reopen it, control wmctrl for ready-made window sizes, access your disks and other parts of the linux hierarchy (/ and down).

One important menu entry that is missing, I think, is "edit this menu". It's amazing what a little recursivity can do, and how much time it can save you.

If you choose to edit it and you're a non-Anglophone, you will need leafpad, because it is easier to save the menu in ISO or UTF-8 with leafpad.

For the time being, here is my bookmarks.xml for rox. I think it is general enough. It could complete your spm nicely. Adapt it for your own needs /computer. (Icon to the right of the house in the rox-filer bar.) It goes in
~/.config/rox.sourceforge.net/ROX-Filer. Save your old one first. This will remove the need for an aemenu to access the linux hierarchy / directory structure. Advantage: it's ready-made!

And this is as good a place as any to post it, since no puppy user or developer seems to have noticed this possiblity in ROX in any thread. (AFAIK). It will be a good complement to your spm.

Enjoy. BFN.

bookmarks.xml

Code: Select all

<?xml version="1.0"?>
<bookmarks>
  <bookmark title="/">/</bookmark>
  <bookmark title="/etc">/etc</bookmark>
  <bookmark title="/etc/rc.d">/etc/rc.d</bookmark>
  <bookmark title="/opt">/opt</bookmark>
  <bookmark title="/usr">/usr</bookmark>
  <bookmark title="/usr/bin">/usr/bin</bookmark>
  <bookmark title="/usr/lib">/usr/lib</bookmark>
  <bookmark title="/usr/sbin">/usr/sbin</bookmark>
  <bookmark title="/usr/share">/usr/share</bookmark>
  <bookmark title="/usr/share/applications">/usr/share/applications</bookmark>
  <bookmark title="/usr/share/backgrounds">/usr/share/backgrounds</bookmark>
  <bookmark title="/usr/share/themes">/usr/share/themes</bookmark>
  <bookmark title="/usr/X11R7/bin">/usr/X11R7/bin</bookmark>
  <bookmark title="/usr/local">/usr/local</bookmark>
  <bookmark title="/usr/local/bin">/usr/local/bin</bookmark>
  <bookmark title="/usr/local/lib">/usr/local/lib</bookmark>
  <bookmark title="/usr/local/lib/X11">/usr/local/lib/X11</bookmark>
  <bookmark title="/usr/local/share">/usr/local/share</bookmark>
  <bookmark title="/mnt">/mnt</bookmark>
  <bookmark title="/mnt/home">/mnt/home</bookmark>
  <bookmark title="/mnt/sda6">/mnt/sda6</bookmark>
  <bookmark title="/mnt/sda7">/mnt/sda7</bookmark>
  <bookmark title="/mnt/sdb5">/mnt/sdb5</bookmark>
  <bookmark title="/mnt/sdb5/Windows">/mnt/sdb5/Windows</bookmark>
  <bookmark title="/mnt/sdb6">/mnt/sdb6</bookmark>
  <bookmark title="/mnt/sdc1">/mnt/sdc1</bookmark>
  <bookmark title="/root">/root</bookmark>
  <bookmark title="/root/Bureau">/root/Bureau</bookmark>
  <bookmark title="/root/Choices">/root/Choices</bookmark>
  <bookmark title="/root/.config">/root/.config</bookmark>
  <bookmark title="/root/Downloads">/root/Downloads</bookmark>
  <bookmark title="/root/Mes-dossiers">/root/Mes-dossiers</bookmark>
  <bookmark title="/root/my-applications">/root/my-applications</bookmark>
  <bookmark title="/root/my-applications/ae">/root/my-applications/ae</bookmark>
  <bookmark title="/root/my-applications/bin">/root/my-applications/bin</bookmark>
  <bookmark title="/root/my-documents">/root/my-documents</bookmark>
  <bookmark title="/root/my-documents/icones">/root/my-documents/icones</bookmark>
  <bookmark title="/root/puppy-reference">/root/puppy-reference</bookmark>
  <bookmark title="/root/Startup">/root/Startup</bookmark>
  <bookmark title="/root/Startup-non">/root/Startup-non</bookmark>
  <bookmark title="/root/.wmx">/root/.wmx</bookmark>
</bookmarks>
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

#12 Post by musher0 »

This is my script for an spm. It's derived from jemimah's gen_menu_wmx and a little display bit adapted from MU's fixmenus. It takes the input from the jwm menu, rather than from the *.desktop files.

It has two parts. This is the dynamic part, which creates and refreshes the Puppy menu The static part is below this one.

Code: Select all

#!/bin/bash
# gen_aemenu.sh # Pour générer le aemenu de Puppy
# Dérivé du gen_menu_wmx.sh de jemimah, sur le forum murga-Puppy. "wmx"
# Remanié par musher0, 26 décembre 2009.

# Activer débogage
# set -xv
fixmenus &
# [...]
# message avec "xmessage" remplacé par
    /usr/X11R7/bin/yaf-splash -text " |\ Building aemenu for Puppy /|\  Construction du menu ae pour Puppy /|" -outline 0 -fg AntiqueWhite1 -bg firebrick4 -timeout 3 -margin 30 -bd AntiqueWhite1 &
#  (musher0)

cd /root/my-applications/ae
# 
rm -rf /root/my-applications/ae/menuPuppy0
echo -wide config file "for" aewm clients >menuPuppy0
# echo cmd "\""-=- menu Puppy -=-"\"" "\"" "\"" >>menuPuppy00
echo menu "\""-=- menu Puppy -=-"\"" >>menuPuppy0
echo cmd "\""-=-=-=-=-=-=-=-=-=-=-"\"" "\"""\"" >>menuPuppy0
# next 19 lines adapted from jemimah's gen_menu_wmx.sh
cat /root/.jwmrc | while read LINE ; do
#echo $LINE
if [[ "$LINE" =~ "<Menu label*" ]] ; then
    sousmenu=`echo $LINE | cut -f2 -d\"`
    echo menu "\""$sousmenu"\"">>menuPuppy0
    echo cmd "\""=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="\"" "\"" "\"" >>menuPuppy0
fi
if [[ "$LINE" =~ "</Menu*" ]] ; then
   echo end >>menuPuppy0
fi
if [[ "$LINE" =~ "<Program label*" ]] ; then
    nomprog=`echo $LINE | cut -f2 -d\" |sed -e 's/\//_/g' -e 's/^-//'`
    prog=`echo $LINE | cut -f2 -d\> | cut -f1 -d\<`
    echo cmd "\""$nomprog"\"" "\""$prog"\"">>menuPuppy0
# echo cmd a $nomprog a a $prog a >>menuPuppy0
fi
done
# end of code adapted from jemimah
echo cmd "\""Regen. menu Puppy"\"" "\""/usr/sbin/gen_aemenu.sh"\"" >>menuPuppy0
echo cmd "\""Éditer ce menu"\"" "\""leafpad ~/my-applications/ae/menuPuppy"\"" >>menuPuppy0

# fin du menu dynamique
# Maintenant, concaténation du menu statique
sleep 1s
cd /root/my-applications/ae
more menuPuppy0 >menuPuppy
more menuPuppy-statique.txt >>menuPuppy
echo "#""#""#" fin "#""#""#" >>menuPuppy

# Désactiver débogage
set +xv
#
### fin ###
Static part:

Code: Select all

# le menu dynamique vient ici (musher0, 26 déc. 2009)
cmd "-=-=-=-=-=-=-=-=-=-=-" ""
cmd "Centre de contrôle" "pcp2 || pcp3-wrapper"
# cmd "Control Centre" "pcp2 || pcp3-wrapper"
cmd "Console" "rxvt -geometry 78x28+300+300 -bg MidnightBlue -fg cornsilk
# -menu /root/.rxvt2.menu"
cmd "-=-=-=-=-=-=-=-=-=-=-" ""
cmd "Aller -=> " "~/my-applications/ae/Aller.sh"
cmd "<=- Retour" "~/my-applications/ae/Retour.sh"
cmd "<=- Barres" "/usr/X11R7/bin/barres.sh"
cmd "<=- Redimensionner" "/usr/X11R7/bin/redimensionner.sh"
cmd "-=-=-=-=-=-=-=-=-=-=-" ""
cmd "<=-<=- Boussole" "~/my-applications/ae/boussole.sh"
# cmd "<=-<=- Compass" "~/my-applications/ae/compass.sh"
cmd "<=-<=- Disques" "~/my-applications/ae/disques3.sh"
cmd "<=-<=- Fichiers" "aemenu -rc /etc/X11/aewm/fichiers"
# cmd "<=-<=- Disques / Disks" "~/my-applications/ae/disques3.sh"
cmd "<=-<=- Bureautique" "/usr/X11R7/bin/Bureautique.sh"
# cmd "<=-<=- Metamenu" "~/my-applications/ae/aemenu.sh"
cmd "-=-=-=-=-=-=-=-=-=-=-" ""
cmd "<=-<=- Méta-menu" "aemenu"
cmd "-=-=-=-=-=-=-=-=-=-=-" ""
cmd "Exit" "/usr/bin/shutdownjwm"
### fin ###
Actually, the latter is not code per se, it is a simple txt file.

The result is this, with much more potential than the usual puppy menu:
Attachments
menuPuppy.png
(56.39 KiB) Downloaded 2409 times
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

#13 Post by musher0 »

dejan555 wrote:Is there some template or script to edit to make it remember som changes like for example, I don't want it to make Shutdown submenu but to launch pshutdown dialog, so I edit /root/.spm/spm-rc:

Code: Select all

cmd "Shutdown" "exec /usr/bin/shutdownjwm"
But if I update spm it rolls back to shutdown submenu.
Hi, dejan.

the syntax for aemenu is:

aemenu -rc [somefile]

the syntax for a command in aemenu is:
cmd "name of program" "program"

for submenus it is
menu "title of submenu"
cmd "name of program 1" "program1"
cmd "name of program 2" "program2"
end

It does not have to have a "rc" ending.

this will be recognized

aemenu -rc /root/my-applications/ae/filemanagers

To have it "remember", as you say, simply use a text editor. leafpad is better because from it, it is simpler to change the character set from iso to utf at saving time, if you need to.

(Make a backup of your old menu file first, of course.)

You do not need the "exec" command. You save a few bytes this way. You can call a bash script (/usr/local/bin/babebibobu.sh, for example) as a program.

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

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#14 Post by aragon »

Hi Christian,

thanks for your posts. Yes aemenu can do lots of fancy things, but my focus had been another:

i wanted to have an (xdg-)menu that is automatically build from the desktop-files. spm does that in a very nice way (my opinion :D ) as it does not need another menu-file or something like that it only needs the desktop-files (and puppys cutdown perl).

to be flexible, the user could add own items to the top and the bottom the will be merged into the menu-file for aemenu and will not be overwritten by an update of the (generated) menu.

so it's only a part of your solution (the one you're using jemimahs snippet for) with the flexibility for the user to add own items if she/he whiches.

aragon

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

#15 Post by musher0 »

Hello, aragon.

Ahh... We see the master's hand in the elegant coding! :D

Also, spm is a "liberation" in the sense that the aemenu can be constructed by spm from the *.desktop files directly rather than from the menu of another wm.

Out of curiosity,
1) I wonder how the original author of aewm did it? I gather that his recipe was lost like an old Egyptian papyrus? Maybe I was not looking in the right places, but I could not find on the Web any menu creator for aemenu or aewm++ (aka sapphire).
2) would your spm work in another distro which uses aemenu?

Finally, would it be much trouble to come up with an "spdm" (simple puppy disk menu) to show / access the mounted disks ? Then, one could reduce the number of puppy disk icons at the bottom left of the screen to one (the essential minimum). Users of smaller screens (eee computers, etc.) may find this handy.

Again, well done, aragon! :)
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#16 Post by dejan555 »

I'm not familiar with xdg menu specification but I think extracting and building menu from desktop files shouldn't be hard for experienced coder, all the info is in desktop txt files like category, execute command, program name, you just reorganize it to suit your wm's specific menu format or a standalone menu like this one.

I don't know bash much, but I think this could be even done with bash and maybe some graphical dialog
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#17 Post by aragon »

musher0 wrote:Hello, aragon.

Ahh... We see the master's hand in the elegant coding! :D
:shock:
if so (and i can't say if it's elegant) this goes to Chris Rouch who is the original author of the parser scrip i modified for my needs.
Also, spm is a "liberation" in the sense that the aemenu can be constructed by spm from the *.desktop files directly rather than from the menu of another wm.
yes.
Out of curiosity,
1) I wonder how the original author of aewm did it? I gather that his recipe was lost like an old Egyptian papyrus? Maybe I was not looking in the right places, but I could not find on the Web any menu creator for aemenu or aewm++ (aka sapphire).
the simple answer (afaik): you do it yourself with a text-editor. you'll find that concept on most wm, the user has full control (and i like that very much). but i always wanted to be able to have both...
2) would your spm work in another distro which uses aemenu?
yes, buuttt... (there always has to be a but and the following is a typical puppy-but): the package and the spm-script is configured wrong for 'the outer world'. it used /root instead of $HOME, what is ok for puppy but not for the others... but maybe i'm able to correct this for an update...
Finally, would it be much trouble to come up with an "spdm" (simple puppy disk menu) to show / access the mounted disks ? Then, one could reduce the number of puppy disk icons at the bottom left of the screen to one (the essential minimum). Users of smaller screens (eee computers, etc.) may find this handy.
this should be possible, but wouldn't one of the following 2 very simple solutions also work
a) make an item for "rox /mnt"
b) make an item for pmount

but i will look into it, it seems to be a nice exercise...

aragon

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#18 Post by technosaurus »

@dejan
If you want to look at some code that does this - see Barry's dir2pet script. It parses desktop files and does most of this (except for adding the markup/xml)... see fixmenus for the rest

btw jwm can have separate menus for left, middle and right click (root id of 1,2,3) in most Puppies it is set to 3 (right click) - and is also the one in the tray
if you set the one in the tray to 0 or 4-9 that would allow you to use all 3 others however you want - and set it up in /etc/xdg/templates so that it gets rebuilt with fixmenus - you don't really need aemenu if you already have jwm


I have posted several other jwm tricks here:
http://www.murga-linux.com/puppy/viewtopic.php?t=51200
Last edited by technosaurus on Wed 13 Jan 2010, 22:21, edited 1 time in total.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#19 Post by aragon »

@dejan & technosaurus

i don't know exactly what you want to say... i'm not searching for that code, i've already found it (at least for my needs).

aragon

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#20 Post by dejan555 »

Simple Puppy Menu is great aragon, and now customizable too, you did great job with it, well done, I'm just thinkering of different ways to parse desktop files, here's a really simple two liner launcher-like Xdialog combobox I've come up with :P

Code: Select all

#!/bin/sh
PROGRAM=$(Xdialog --combobox Run 0 0 `ls /usr/share/applications/ | grep ".desktop"` 2>&1)
exec $(cat /usr/share/applications/$PROGRAM | grep "Exec" | grep -v "TryExec=" | sed 's/Exec=//') &
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

Post Reply