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 Sat 25 Oct 2014, 21:52
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
SimplePuppyMenu2 (spm2)
Post_new_topic   Topic_locked View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
aragon

Joined: 15 Oct 2007
Posts: 1698
Location: Germany

PostPosted: Mon 06 Feb 2012, 13:32    Post_subject:  SimplePuppyMenu2 (spm2)
Sub_title: Light xdg-menu system
 

SimplePuppyMenu2 (spm2) 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.

spm2 is the successor of spm (see here: http://www.murga-linux.com/puppy/viewtopic.php?t=51138).
spm2 consists of only one ash-script to parse the desktop-files and generate the menu-file, thus no perl-dependency any more.

It is based on the famous jwm-tools by technosaurus (many thanks). See here for more details: http://www.murga-linux.com/puppy/viewtopic.php?t=70804

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

If you want automatically recreate on every startup, make a script with 'spm2 -c &' in /root/Startup.

Update Menu and help for spm2 could also be reached from the menu itself.

Some Notes:
- spm2 checks only the first category of the desktop-file.
- spm2 will use the text in your $LANG if available in the desktop-file.

Dependency is aemenu (attached).

Changelog:
0.3:
- Added support for /usr/local/share/applications
- Added support for user-entries at top/bottom of the menu

Tested in Puppy 4.31.

aragon
spm2-0.3.pet
Description 
pet

 Download 
Filename  spm2-0.3.pet 
Filesize  3.26 KB 
Downloaded  387 Time(s) 
aemenu-1.2.12.pet
Description 
pet

 Download 
Filename  aemenu-1.2.12.pet 
Filesize  7.91 KB 
Downloaded  387 Time(s) 
spm2.png
 Description   
 Filesize   226.65 KB
 Viewed   1156 Time(s)

spm2.png

spm2-0.2.pet
Description  OLD VERSION
pet

 Download 
Filename  spm2-0.2.pet 
Filesize  3.04 KB 
Downloaded  358 Time(s) 

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html

Edited_time_total
Back to top
View user's profile Send_private_message 
musher0


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

PostPosted: Mon 06 Feb 2012, 13:46    Post_subject:  

Hello, aragon.

Glad that you could find some time to produce this second edition.
I'll check it out pronto.

When you say:
> - spm2 checks only the first category of the desktop-file.

do you mean that your utility it checks only
/usr/share/applications/*.desktop ?

Not

/usr/local/share/applications/*.desktop

and not

/root/.local/share/applications ?

TWYL.

_________________
"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_website 
musher0


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

PostPosted: Mon 06 Feb 2012, 14:05    Post_subject:  

Hm...

> [/mnt/sdb6/lo....2/usr/bin]> spm2 -c
> Failure: You need to use one and only one option

_________________
"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_website 
aragon

Joined: 15 Oct 2007
Posts: 1698
Location: Germany

PostPosted: Mon 06 Feb 2012, 16:04    Post_subject:  

hi christian,

> do you mean that your utility it checks only /usr/share/applications/*.desktop ?

no that was not meant (although it's correct). I wanted to say, that it only checks the first category-entry inside of a desktop-file.

> [/mnt/sdb6/lo....2/usr/bin]> spm2 -c
> Failure: You need to use one and only one option

interesting... this is a failure-message of spm, not spm2??? could you please rename /usr/local/bin/spm to spm.BAK and try it again?

tia
aragon

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send_private_message 
musher0


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

PostPosted: Mon 06 Feb 2012, 17:23    Post_subject:  

Hello, aragon.

Finally got it to work. But what a strange place to store the resulting menu file : /tmp/spmaerc ? Smile It will get clobbered at each shutdown!

In any case, the important thing is that users of small wm's (echinus, oroborus, wmx, etc.) that do not have a decent menu by default now have something to work with and optionally flesh out.

Thanks much for your trouble.
TWYL.

_________________
"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_website 
musher0


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

PostPosted: Mon 06 Feb 2012, 17:25    Post_subject:  

Afterthought: maybe provide an hyperlink to the previous spm thread? It contained info on how to flesh out the resulting file, add a top and a bottom, etc.
_________________
"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_website 
aragon

Joined: 15 Oct 2007
Posts: 1698
Location: Germany

PostPosted: Tue 07 Feb 2012, 02:44    Post_subject:  

Hi christian,

The strange place for the rc is intended. It's the simplest mechanism to be sure to have an up-to-date menu on every boot. As the parsing is very fast no one will notice the short delay.

I will reintegrate top/bottom. Atm there is 'only' favorites for individual items.

Aragon

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send_private_message 
musher0


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

PostPosted: Tue 07 Feb 2012, 23:52    Post_subject:  

Hello, aragon.

I found a way to integrate all the *.desktop files into one aemenu.
jwm-menu-create has the same problem. The solution is:

With simple additions at the top and the bottom of your file, we can create a /tmp/applications dir and send all the *.desktop files to it, then use the spm2 process in that directory. The result is more complete, since some applications store their *.desktop files in /usr/local/share/applications. When all is finished, we remove the files and the temporary directory.

This will do for the time being. There is another depot of *.desktop files, at /root/.local/share/applications/wine/babebibobu Smile , that is created by wine. But another strategy would be needed to incorporate those, because wine processes them differently than linux.

So here the modification in plain bash format for your review. I called it spm2-mod1 and did a few changes for the recall of the program to that effect (when you ask if spm2 should recrreate the menu).

Tell me what you think? Have a great day!

Code:

#!/bin/ash
##############################################################################
# spm2 - Simple Puppy Menu 2 (aemenu)
# spm2 is a simplified xdg-menu for puppylinux to use with aemenu.

# It uses
# a) a parser based on jwm_menu_create by technosaurus (thanks a lot)
#    for jwm on puppylinux (based on version: jwm-tools 0.8)
#    Original thread: http://www.murga-linux.com/puppy/viewtopic.php?t=70804
# b) aemenu to display (and execute) the menu
#
# Changelog:
# spm2 0.1: initial release
#      0.2: bring back code for intl. text from jwm_menu_create
#
# aragon, 2012/02/06
##############################################################################
# ajout par musher0
# incorporer /usr/share/applications/*.desktop et /usr/local/share/applications/*.desktop
#
mkdir /tmp/applications
sleep 0.5s
cp /usr/local/share/applications/*.desktop /tmp/applications
sleep 0.5s
cp /usr/share/applications/*.desktop /tmp/applications
sleep 0.5s
##

# variables
spm2aeversion="spm2 0.2, 2012.02.06"
spm2aerc="/tmp/spmaerc"
spm2aefav="`cat /root/.config/spm2/favorites`"

{   #localization block
[ $myLANG ] || myLANG=${LANGUAGE%% *}
[ $myLANG ] || myLANG=${LANG%_*}
}

# Create the menu
spm2aecreate() {
{   #parse .desktop files and sort generated menu entries into subcategories
for DESKTOP_FILE in /tmp/applications/*.desktop ; do
   CATS="" NAME="" EXEC="" LINE="" #prevent carryover from previous file
   while read LINE || [ "$LINE" ]; do
      case $LINE in
         Name=*|Name?${myLANG%_*}?=*) NAME="${LINE#*=}"'' ;; # sc0ttman... should use "Name[$myLANG]=" if found
         #Name=*) NAME="${LINE#*=}"'' ;; # aragon: only main language
         Categories=*) CATS="${LINE#*=}"''
         CAT="${CATS/;*/}"'' ;; #strip all but first cat
         Exec=*) EXEC="${LINE#*=}"''
         EXEC="${EXEC//\"/'}"'' ;; #convert " to '
      esac
   done < $DESKTOP_FILE   

   [ "${EXEC}" ] && MenuEntry='cmd "'${NAME}'" "'${EXEC}'"
      '
   case "$CAT" in
      X-Desktop|DesktopSettings|Screensaver|Accessibility|X-DesktopCountry|X-DesktopApplets)Desktop=${Desktop}${MenuEntry};;
      System|Monitor|Security|HardwareSettings|Core|X-SystemMemory|X-SystemSchedule)System=${System}${MenuEntry};;
      X-SetupEntry|PackageManager|X-SetupWizard|X-SetupUtility)Setup=${Setup}${MenuEntry};;
      Utility|Viewer|Development|Building|Debugger|IDE|Profiling|Translation|GUIDesigner|Archiving|TerminalEmulator|Shell)Utility=${Utility}${MenuEntry};; #sc0ttman utility typo
      FileSystem|FileManager|X-FilesystemMount|X-FilesystemUtility|X-FilesystemFind)Filesystem=${Filesystem}${MenuEntry};;
      2DGraphics|3DGraphics|Photography|Presentation|Chart|FlowChart|VectorGraphics|RasterGraphics|X-GraphicUtility)Graphic=${Graphic}${MenuEntry};;
      X-Document|WordProcessor|WebDevelopment|TextEditor|X-DocumentUtility|Dictionary)Document=${Document}${MenuEntry};;
      X-Calculate|Finance|Spreadsheet|ProjectManagement|Calculator|X-CalculateUtility)Business=${Business}${MenuEntry};;
      X-Personal|Calendar|ContactManagement|X-PersonalUtility)Personal=${Personal}${MenuEntry};;
      Dialup|Network|HamRadio|RemoteAccess)Network=${Network}${MenuEntry};;
      X-Internet|WebBrowser|Email|News|InstantMessaging|Telephony|IRCClient|FileTransfer|P2P)Internet=${Internet}${MenuEntry};;
      AudioVideo|Video|Player|AudioVideoEditing|Recorder|Music|Audio|Midi|Mixer|Sequencer|Tuner|Video|TV|DiskBurning)Multimedia=${Multimedia}${MenuEntry};;
      Game|Amusement|ActionGame|AdventureGame|ArcadeGame|BlocksGame|BoardGame|CardGame|KidsGame|LogicGame|RolePlaying|Simulation|SportsGame|StrategyGame)Fun=${Fun}${MenuEntry};;
      *)Other=${Other}${MenuEntry};;
   esac
done
}

{   #Now generate the full menu with some formatting
MENU='
menu "Desktop"
   '${Desktop}'
end
menu "System"
   '${System}'
end
menu "Setup"
   '${Setup}'
end
menu "Utility"
   '${Utility}'
end
menu "Filesystem"
   '${Filesystem}'
end
menu "Graphic"
   '${Graphic}'
end
menu "Document"
   '${Document}'
end
menu "Business"
   '${Business}'
end
menu "Personal"
   '${Personal}'
end
menu "Network"
   '${Network}'
end
menu "Internet"
   '${Internet}'
end
menu "Multimedia"
   '${Multimedia}'
end
menu "Fun"
   '${Fun}'
end
menu "Other"
   '${Other}'
end
'
}

{   #Add the 'puppy'-footer to the Menu
MENU='
'"$MENU"'
   cmd "Help" "defaulthtmlviewer file:///usr/share/doc/index.html"
menu "spm2"
   cmd "Recreate menu" "spm2-mod1 -c &"
   cmd   "Help" "spm2-mod1 -h | xmessage -center -file -"
end
menu "Favorites"
'"$spm2aefav"'
end
menu "Shutdown"
   cmd "Exit to prompt" "wmexit"
   cmd "Reboot" "wmreboot"
   cmd "Power off" "wmpoweroff"
   cmd "Restart X" "restartwm"
end
'
}

echo "$MENU" 1> ${spm2aerc} 2> /dev/null
}

# display the help message in terminal
spm2aehelp() {
echo "----------------------------------------
spm2 - SimplePuppyMenu 2 (aemenu)
----------------------------------------
Info: Creates and displays a simplified xdg-menu using aemenu.

Syntax: spm2-mod1 [option]

Options:
-c Create the menu-file
-m Display the menu
-v Display version info
-h Display help

Usage: To use spm2-mod1, assign a keyboard-shortcut to 'spm2-mod1 -m'. How this is done
depends on your windowmanager. The menu will be created on first run
(it will be written to /tmp, so it will be rebuild on every systemstart).
You can also recreate the menu with the so-named menu-option.

To include your own 'Favorites', create the file /root/.config/spm2/favorites
and add your favorites. A sample file could be found at /usr/share/doc/spm2

Note: spm2 only uses the first category-entry of a desktop-file.

Version: ${spm2aeversion}
----------------------------------------"
exit 0
}

# run spm2
spm2run(){
if [ ! -f ${spm2aerc} ]
   then
   spm2aecreate
fi
aemenu -rc ${spm2aerc} &
exit 0
}

# test for aemenu
if  [ ! `which aemenu` ]
   then
   xmessage -center "Aemenu seems not to be installed, aborting!" &
   exit 1
fi

# run spm2-aemenu
case $1 in
   -c|--create) spm2aecreate &;;
   -m|--menu) spm2run &;;
   -v|--version) echo ${spm2aeversion};;
   -h|--help) spm2aehelp;;
   *) xmessage -center "Missing or wrong option! Use spm2 -h to display the help!" & exit 1;;
esac
# ajout par musher0
sleep 2s
rm /tmp/applications/*.desktop
sleep 0.2s
rmdir /tmp/applications
##

_________________
"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_website 
musher0


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

PostPosted: Wed 08 Feb 2012, 00:01    Post_subject:  

Hello, again, aragon.

To come back to the *.desktop files created by wine, they fail to launch the intended program every time. This is no joke, but it's laughable! Smile

So either the user creates valid scripts for those programs (a lot of work), or we can simply put an entry for the PortableApps utility in the "favorites". The latter is simpler. Just a thought.

TWYL.

_________________
"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_website 
aragon

Joined: 15 Oct 2007
Posts: 1698
Location: Germany

PostPosted: Wed 08 Feb 2012, 17:25    Post_subject:  

uploaded version 0.3 to main post.

aragon

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send_private_message 
darkcity


Joined: 23 May 2010
Posts: 2462
Location: near here

PostPosted: Sat 11 Feb 2012, 10:10    Post_subject:  

on puppy 5.29 I get-

aemenu not installed

do i did a particular window manager?

_________________
helping Wiki for help | IF SendSpace link = "dead" THEN PM me ("up file to http://meownplanet.net/")
Back to top
View user's profile Send_private_message Visit_website 
harii4


Joined: 30 Jan 2009
Posts: 444
Location: La Porte City, IA , U.S.A.

PostPosted: Sat 11 Feb 2012, 13:44    Post_subject:  

Quote:
do i did a particular window manager?

you just need to install the aemenu DotPet too Smile

Very nice app. Cool

_________________
3.01 Fat Free / Fire Hydrant featherweight/ TXZ_pup / 431JP2012
----------------------------------------------------------------------------------------
Peace and Justice are two sides of the same coin.
Back to top
View user's profile Send_private_message Visit_website 
aragon

Joined: 15 Oct 2007
Posts: 1698
Location: Germany

PostPosted: Mon 04 Feb 2013, 09:34    Post_subject:  

See

http://www.murga-linux.com/puppy/viewtopic.php?p=682395

for spm3, which uses mygtkmenu instead of aemenu.

cheers
aragon

_________________
PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Topic_locked View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0962s ][ Queries: 13 (0.0069s) ][ GZIP on ]