SimplePuppyMenu

Stuff that has yet to be sorted into a category.
Message
Author
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]

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

#21 Post by musher0 »

Hello, bunch!

Here's a nice and useful little line you can add at the top or bottom of the spm to poke for what's on your desktop:

Code: Select all

cmd "What's running here" "aemenu --switch"
Simple, eh? :D
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

#22 Post by musher0 »

Hello, technosaurus!
technosaurus wrote:@dejan
[...]

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
[...]
Well... that's a matter of opinion / conviction, I suppose. Once you get the knack of it, you'll want to create aemenus to have very easy access to your files / groupings / programs / directories / disks.

I use it in jwm too. I have added this line in my jwmrc-personal file:

Code: Select all

<Key mask="C" key="Escape">exec:/root/my-applications/ae/aemenu.sh</Key>
You need a pianist's touch on the Ctrl-Escape key combination, but it does the job without having to change the root:n configuration, an alternate menu pops up on screen. (For the record, my particular aemenu script above doesn't duplicate the jwm puppy menu.)
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

#23 Post by musher0 »

@aragon
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...
Actually, I was only half serious. :twisted: I have a bash script for that, so if you feel it's not essential, do not do it for me? Meaning: I have come up with a solution for myself. But if others think there is a need....

My solution is essentially based on parsing fstab (dynamic part), plus a static part that is concatenated to add rox /mnt and pmount, and various disk utilities, etc. as you mentioned.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#24 Post by aragon »

musher0 wrote:Actually, I was only half serious. :twisted:
:lol: this is a common problem with us non-natives. we could interpret subtext only by keywords, so jokes, sarcasm and irony often get lost. and if we interpret by keywords, it's mostly wrong.

but i take those things not too seriously, they just happen ...

aragon

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

#25 Post by aragon »

dejan555 wrote:Simple Puppy Menu is great aragon, and now customizable too, you did great job with it, well done,
no offense intended no eulogy needed, there was just a 'missing link' (for me) between the thread and the posts...
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=//') &
now i see the missing link :D
have to investigate your example now...

aragon

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

#26 Post by aragon »

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=//') & 
whow, in 2 lines, very nice :D

aragon

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

#27 Post by dejan555 »

Yeah, well it's not categorized or anything, real menu would need more work, but it's nice as a simple launcher with all programs on one pile :P
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

#28 Post by aragon »

musher0 wrote: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.
only half-serious meant but nevertheless here are possible solutions you might try

Code: Select all

#!/bin/sh
## show filesystems that are mounted on /mnt with aemenu
## aragon, 2010.01.14

## variables
mntmenu="/tmp/aemenu-drives" #name of menu-file

## some possibilities to look for mounted filesystems in /mnt
##
## 1. looks for non empty directories under /mnt
##    fast but fails if drive is mounted but empty
##    shows all directories either it is a mounted filesystem or not
## mounts=`find /mnt -mindepth 1 -maxdepth 1 -type d -follow ! -empty`
#
## 2. use mount to show filesystems that are mounted on /mnt
##    seems correct but is lame. 
##    shows only mounted filesystems
## mounts=`mount -l | cut -d " " -f3 | grep ^\/mnt\/`
#
## 3. use df to look for filesystems that are mounted on /mnt
##    seems correct but is lame (not as lame as 2)
##    shows only mounted filesystems
## mounts=`df | tr -s " " | cut -d " " -f6 | grep ^\/mnt\/`
#
## 4. use /etc/mtab to look for filesystems that are mounted on /mnt
##    seems correct and is not as lame as 2 and 3
##    shows only mounted filesystems
mounts=`cat /etc/mtab | cut -d " " -f2 | grep ^\/mnt\/`

## create the menu-file
echo "menu "Drives"" > $mntmenu
for i in $mounts
do
        echo "cmd "$i" "rox $i"" >> $mntmenu
done
echo "end" >> $mntmenu

## launch the aemenu with the menu-file
aemenu -rc $mntmenu &
if anyone knows other/faster methods to look for mounts on /mnt, please let me know.

NOTE: Only tested in Virtualbox, results may vary on normal run.

aragon

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

#29 Post by musher0 »

Says aragon
this is a common problem with us non-natives.
But we're all natives, to some particular land, are we not?

In any case, thanks for the code for disks. I'll try it.
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

#30 Post by musher0 »

@aragon:

Please forgive me if I ruffled some feathers earlier. I'm a "non-native" too...

In any case, we can attenuate the "lameness" by putting

Code: Select all

mount -a 
at the top of the script, no?

In any case, I've opted for your solution #1, because it allows to show all disks. With the > mount -a < at the beginning and the "puppyevent" hot-plug manager, I find it acceptable for my needs.

Here's what I've decided to use:

Code: Select all

#!/bin/sh 

# ajouts de musher0 :
mount -a
cd /root/my-applications/ae
# Ajouté aussi "|sort" à la fin des commandes et 
# modifié ancienne destination dans /tmp à la présente
# (musher0)

## show filesystems that are mounted on /mnt with aemenu 
## aragon, 2010.01.14 

## variables 
mntmenu="/root/my-applications/ae/aemenu-drives" #name of menu-file 

## some possibilities to look for mounted filesystems in /mnt 
## 
## 1. looks for non empty directories under /mnt 
##    fast but fails if drive is mounted but empty 
##    shows all directories either it is a mounted filesystem or not 
mounts=`find /mnt -mindepth 1 -maxdepth 1 -type d -follow ! -empty |sort`
#
## Trois autres solutions non probantes, selon moi, retirées

## create the menu-file 
# echo "menu \"Drives\"" > $mntmenu 
echo menu "\""-=-Lecteurs/Drives-=-"\"" > $mntmenu
echo cmd "\""-=-=-=-=-=-"\"" "\"" "\"" >> $mntmenu
# disques30
for i in $mounts 
do 
        echo "cmd \"$i\" \"rox $i\"" >> $mntmenu 
done 
# echo "end" >> $mntmenu (retrait par musher0)

# concaténation par musher0
echo cmd "\"""\("Si montés / If mounted"\)" "\"" "\"" "\"" >disques30
echo "end" >>disques30
sleep 1s
cd /root/my-applications/ae
more aemenu-drives >disques3
# $mounts 
more disques30 >> disques3
more disques3-statique.txt >>disques3
echo "#""#""#" fin "#""#""#" >>disques3

## launch the aemenu with the menu-file 
aemenu -rc disques3 &
Since the parsing takes a little more time with the sort, I've also created an additional little script containing separately the last line, to call the aemenu-disks in regular usage. Simply,

Code: Select all

#!/bin/sh
# menu "disques"
# script disques3.sh pour aemenu
# musher0, 26 déc. 2009 et 14 janv. 2010

# killall aemenu & # parfois nécessaire / sometimes necessary
cd ~/my-applications/ae/
aemenu -rc disques3
Many thanks for your contribution, aragon.

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

#31 Post by dejan555 »

Screenie of karmen wm /w simple menu:
http://murga-linux.com/puppy/viewtopic. ... 504#382504
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]

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

#32 Post by musher0 »

Nice! :)

Q.: I believe the karmen wm allows for only one desktop?
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:

#33 Post by dejan555 »

Hmm, I think so, didn't find any configuration options, it's really basic wm, has no taskbar/tray/menu or anything, only two buttons on titlebar for minimize/close, plus double clicking titlebar maximizes window. right click on titlebar gives list of running windows though so you can raise another window even if one is already maximized.
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

#34 Post by aragon »

dejan, nice screenie.

how did you call the menu within karmen? i know i've used it before, but cannot remember...

aragon

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

#35 Post by dejan555 »

i put command in script and place it in rox panel (first icon)
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