JWM Menu Info

Moderator: Forum moderators

Post Reply
User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

JWM Menu Info

Post by MochiMoppel »

JWM Menu Info can find full paths of menu items and can create desktop shortcuts.

This is a major update of the little utility mm_menuinfo which I posted here in the old Murga forum.
It now uses gtkdialog to display the info instead of gxmessage and most importantly it now shows all menus and all linked <Include> menus defined in JWM's config file.
Optional desktop icons are placed on the ROX pinboard currently in use (not necessarily PuppyPin). JWM menus may even be displayed while using a different window manager as long as the distro contains a root.jwm_jwmrc-menu template in directory /etc/xdg/templates.

Tested in Slacko5.6 and Fossapup64. Should work in other distros.

Usage:

Step 1: Download and decompress script, make it executable and run it.
Step 2: Select an item from menu (see instruction on start dialog)
Step 3: Use buttons to

  • run the item from console (safer and allows to view any error messages)
  • create a desktop shortcut
    or use "Files" menu to access listed files in ROX-Filer or view/edit them in Geany

Version History


2020-11-17 (version 3.1)
 Fixed: Very large menus can cause sed/grep error
 Fixed: Nested <Include> tags can cause syntax error
 Fixed: Dollar signs and quotation marks in Program code not preserved

2020-11-03 (version 3.0)
 Improved: Supports any number of created JWM menus (not just the first found in .jwmrc)
 Improved: Supports any level of <Include> tags
 Improved: Supports multiple bash commands in JWM <Program> tag
 Improved: Finds corresponding .desktop file (if any)
 Improved: Displays menu icon (if any)
 Improved: New "Files" menu allows access of listed files in ROX-Filer or Geany (to view/edit)
 Added: Consolidated .jwmrc file (a .jwmrc file including content of all <Include> files. Source for Rootmenus and useful as reference)
 Changed: Name (from mm_menuinfo to jwm_menuinfo)
 Deleted: Support for ROX panels
 Deleted: Drag&Drop functionality

2018-02-08
 Improved: Supports JWM version 2.3 ( <Dynamic> tag )
 Improved: Supports (multiline) comments in .jwmrc
 Improved: Ignores garbage strings in .jwmrc (created by 3rd party menu editors)
 Improved: Performance (e.g. speed)

2015-09-25
 Added: Drag&Drop support (accepts any menu file as long as it complies with main menu syntax)
 Added: Accepts menu file from mounted sfs puppies and adapts PATH to that of mounted sfs
 Added: Optional shortcut to ROX panel instead of pinboard (requires editing of script variable SHORTCUT_TYPE)
 Added: Tooltip indicating the name of the menu file
 Improved: Using 'Script' ,'Binary' or 'Executable' to describe the program type

2015-09-01
 Initial version

Screenshot.png
Screenshot.png (26.57 KiB) Viewed 907 times
Attachments
jwm_menuinfo.gz
Version 3.1
(4.38 KiB) Downloaded 69 times
Last edited by MochiMoppel on Wed Nov 18, 2020 10:40 am, edited 2 times in total.
User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Menu Info

Post by taersh »

Still doesn't work on my menus.

Code: Select all

** (gtkdialog:14686): ERROR **: 14:46:25.456: gtkdialog: Error in line 7, near token 'string': syntax error

/mnt/sda1/Dateien/Downloads/jwm_menuinfo: line 230: 14685 Datenübergabe unterbrochen (broken pipe)                 { echo '
<window title="'"$APPTITLE"'" window-position="2" width-request="460" height-request="225">
<vbox>
	<menubar>
		'"$MENU"'
		<menu visible="false">
			<menuitem>
				<variable>vMACRO</variable>
				<action>refresh:vEDIT</action>
				<action>disable:vMENUEXE</action>
				<action>disable:vMENUDTP</action>
				<action>disable:vMENUICO</action>
				<action>disable:vMENUSCR</action>
				<action>disable:vBUTEXEC</action>
				<action>disable:vBUTSCUT</action>
				<action>hide:vPIX</action>
				<action>IFS=$LF; ARR=($vEDIT);ln -fsn "${ARR[6]}" $fSYMLINK 2>/dev/null</action>
				<action condition="command_is_true([[ $(readlink -e $fSYMLINK 2>/dev/null) ]] && echo true )">show:vPIX</action>
				<action condition="command_is_true([[ $vEDIT = */usr/share*.desktop* ]] && echo true")>enable:vMENUDTP</action>
				<action condition="command_is_true([[ $vEDIT != *\"file not found in\"* ]] && echo true )">enable:vBUTEXEC</action>
				<action condition="command_is_true(grep -c ^shellscript $fTMPINFO)">enable:vMENUSCR</action>
				<action condition="sensitive_is_true(vBUTEXEC)">enable:vBUTSCUT</action> 
				<action condition="sensitive_is_true(vBUTEXEC)">enable:vMENUEXE</action> 
				<action condition="visible_is_true(vPIX)">enable:vMENUICO</action> 
				<action condition="visible_is_true(vPIX)">refresh:vPIX</action> 
			</menuitem>
		</menu>
		<menu label="Files     "  stock-id="gtk-file" >
			<menuitem label="Executable" stock-id="gtk-jump-to" tooltip-text="Show location of executable file">
				<variable>vMENUEXE</variable>
				<action>IFS=$LF; ARR=($vEDIT);rox -s "${ARR[3]}"</action>
			</menuitem>
			<menuitem label="Icon" stock-id="gtk-jump-to" tooltip-text="Show location of icon file">
				<variable>vMENUICO</variable>
				<action>IFS=$LF; ARR=($vEDIT);rox -s "${ARR[5]}"</action>
			</menuitem>
			<menuitem label=".desktop file" stock-id="gtk-edit" tooltip-text="View .desktop file">
				<variable>vMENUDTP</variable>
				<action>IFS=$LF; ARR=($vEDIT);$EDITOR "${ARR[5]}"</action>
			</menuitem>
			<menuitem label="Shellscript" stock-id="gtk-edit" tooltip-text="View shellscript'"$LF"'(if executable is of type shellscript">
				<variable>vMENUSCR</variable>
				<action>IFS=$LF; ARR=($vEDIT);$EDITOR "${ARR[3]}"</action>
			</menuitem>
			<menuitemseparator></menuitemseparator>
			<menuitem label="Consolidated .jwmrc" stock-id="gtk-edit"  tooltip-text="View consolidated .jwmrc'"${LF}${LF}"'This file consolidates $HOME/.jwmrc and any'${LF}'<Include> sections therein.">
				<action>$EDITOR $fTMPCONS &</action>
			</menuitem>
		</menu>
	</menubar>
	<vbox space-expand="true" space-fill="true">
		<hbox>
			<vbox spacing="0">
				<text label="'"$TXTLABEL"'"></text>
				<hbox>
					<text label="Icon:" space-expand="true" space-fill="true" xalign="0"></text>
					<pixmap visible="false"><variable>vPIX</variable><width>"24"</width><input file>'$fSYMLINK'</input></pixmap>
				</hbox>
			</vbox>
			<edit editable="false" left-margin="5" can-focus="false">
				<variable>vEDIT</variable>
				<input file>'$fTMPINFO'</input>
			</edit>
		</hbox>
	</vbox>
	<vbox space-expand="false" space-fill="false">
		<hbox space-expand="true"  space-fill="true">
			<button sensitive="false" label="❱▂ Run" width-request="100" tooltip-text="Run from commandline">
				<variable>vBUTEXEC</variable>
				<action>IFS=$LF; ARR=($vEDIT);'"$TERMINAL"' --geometry 40x10+0+0 --title "'"$APPTITLE"'" -e bash -c  "echo Executing ${ARR[1]}...;${ARR[1]}" &</action>
			</button>
			<button sensitive="false" width-request="100" tooltip-text="Create shortcut icon on desktop">
				<variable>vBUTSCUT</variable>
				<label>Shortcut</label>
				<input file stock="gtk-add"></input>
				<action>create_shortcut</action>
			</button>
			<button has-focus="true"  width-request="100">
				<label>Close</label>
				<variable>vBUTQUIT</variable>
				<input file stock="gtk-quit"></input>
				<action>rm -r $fTEMPDIR</action>
				<action>exit:</action>
			</button>
		</hbox>
	</vbox>
</vbox>
<action signal="show">disable:vMENUEXE</action>
<action signal="show">disable:vMENUDTP</action>
<action signal="show">disable:vMENUICO</action>
<action signal="show">disable:vMENUSCR</action>
<action signal="delete-event">rm -r $fTEMPDIR</action>
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">activate:vBUTQUIT</action>
</window>'; }
     14686 Trace/Breakpoint ausgelöst   | gtkdialog -s
Script completed hit RETURN to close window.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: JWM Menu Info

Post by MochiMoppel »

@taersh The .jwmrc you posted was one of my test files and as far as I can see works perfectly here. Could you please send me your complete .jwmrc , i.e. including the <Include> files?

User avatar
taersh
Posts: 951
Joined: Tue Jul 07, 2020 11:13 pm
Location: Germany
Has thanked: 53 times
Been thanked: 119 times

Re: JWM Menu Info

Post by taersh »

I have 3 different menus. One menu for each one of the mouse buttons. Probably its just too many code resulting for gtkdialog?

I have sent you .tar.gz archive by PM. It contains directory /root with all the hidden JWM files in directory /root and /root/.jwm, which is exactly all the JWM files I have in /root of my Puppy.

My Music:
https://soundcloud.com/user-633698367
Using my own build of Bionic64
The far-left is as fascist as the far-right is!

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: JWM Menu Info

Post by MochiMoppel »

taersh wrote: Wed Nov 04, 2020 1:04 am

I have 3 different menus. One menu for each one of the mouse buttons. Probably its just too many code resulting for gtkdialog?

This was indeed a problem when I first tested your rather big menu. Gtkdialog caused an "arguments too long" error. I could fix this by piping the code to stdin of gtkdialog (option -s) instead of using gtkdialog's -p option.

Thanks for the PM. I will try to find the cause.

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: JWM Menu Info

Post by MochiMoppel »

Update 2020-11-17 (see initial post)

This update addresses the problems reported by user @taersh, mainly caused by extremely large menus (in his case more than 1700 menu items :o ).
It also now supports shell code directly inserted into JWM's <Program> tags. Such code may be multilined, in which case jwm_menuinfo converts it into a one-liner so that the ROX desktop shortcut can read it as an argument.

Some code cleaning, as usual. Minor speed improvements. For plain vanilla JWM menus that come with most Puppies the previous version 3.0 should still work.

Post Reply

Return to “Desktop”