How to add a category to the XDG / JWM menu?

Booting, installing, newbie
Post Reply
Message
Author
User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

How to add a category to the XDG / JWM menu?

#1 Post by UncleScrooge »

Hello folks,

I'd really like to add a fresh new category to the main menu.

I've made my way to the /etc/xdg/templates/_root_jwmrc and the various /etc/xdg/menus/puppy****.menu.

before I mess up anyone has got some hint on how to proceed to add myCategory to the main menu?

PS: Rummaging through the "HOWTO" forum I found this: http://murga-linux.com/puppy/viewtopic. ... 31&t=93637 but I'm still perplexed on how to proceed when it comes to add a new fresh "Category"

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#2 Post by HerrBert »

If i may ask: What category do you want to add?
And why?

Categories in Puppy's /etc/xdg/menus do not comply to freedesktop.org standards.
So desktop-files from different Linux Distributions/Installs in /usr/share/applications almost always have to be modified to show in jwm menus in the right place...

Of course you can add any Category you want to jwm's menu. But it needs a lot of fiddling with /etc/xdg/menus/myCategory.menu and any related submenus in /usr/share/desktop-directories/myCategory<-sub>.directory files.

Another approach can be to manually add a menu-entry to /etc/xdg/templates/_root_.jwmrc.

As an example let's say you want to add a menu "Office" to your main menu (see screenshot below).

Create a new menu file named office-main in /root/.jwm/root_menus with content:

Code: Select all

<JWM>
 <Menu label="Office" icon="openoffice4-main.png">
  <Program label="Startcenter" icon="openoffice4-main.png">openoffice4</Program>
  <Program label="Textverarbeitung" icon="openoffice4-writer.png">openoffice4 -writer</Program>
  <Program label="Tabellenkalkulation" icon="openoffice4-calc.png">openoffice4 -calc</Program>
  <Program label="Zeichnen" icon="openoffice4-draw.png">openoffice4 -draw</Program>
  <Program label="Präsentation" icon="openoffice4-impress.png">openoffice4 -impress</Program>
  <Program label="Formeleditor" icon="openoffice4-math.png">openoffice4 -math</Program>
  <!--   <Program label="Datenbank" icon="openoffice4-base.png">openoffice4 -base</Program> -->
 </Menu>
</JWM>
( :oops: all in german, help yourself... )

Just make sure your icons are in jwm's icon-path:
<!-- <Icons> -->
<IconPath>/usr/local/lib/X11/mini-icons</IconPath>
<IconPath>/usr/local/lib/X11/pixmaps</IconPath>
<IconPath>/usr/share/pixmaps</IconPath>
<IconPath>/usr/local/share/pixmaps</IconPath>
<IconPath>/usr/share/pixmaps/puppy</IconPath>
<!-- </Icons> -->
and executables are in $PATH

Now in /etc/xdg/templates/_root_.jwmrc add an Include tag at the place, you want your new menu-entry to appear. E.g.:

Code: Select all

...
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-desktop.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-system.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-setup.menu
	<Separator/>
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-utility.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-filesystem.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-graphic.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-document.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-calculate.menu
	<Include>/root/.jwm/root_menus/office-main</Include>
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-personal.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-network.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-internet.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-multimedia.menu
	PUPPYMENU jwm-xdgmenu /etc/xdg/menus/puppy-fun.menu
...
Open a terminal and type:

Code: Select all

fixmenus
jwm -reload
This way you can add many other submenus to jwm's menu
[edit]If you don't need the desktop-files in /usr/share/applications, you can remove them from menu either in JWM menu manager or delete them (!).
Attachments
jwm-menu1.jpg
New menu entry without Category
(50.38 KiB) Downloaded 175 times

User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

#3 Post by UncleScrooge »

@ HerrBert

thanks!!!!
that's exactly what I was looking for, especially the <include> trick.

What category and why?

this is the project I am working on atm:
http://www.murga-linux.com/puppy/viewtopic.php?t=118610

so the category will be "Service tools" for quick access by our personnel
it will contain proprietary SW as well as other process control common tools.

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#4 Post by HerrBert »

postscript:

I forgot to mention that jwm may play tricks on you...

Editing /etc/xdg/templates/_root_.jwmrc only alters jwm's menu, when opened from the traybutton, keyboard shortcut ALT+F1 or key F12.

But rightclicking the Desktop brings up a different menu.

Forum member gychang mentions to have this issue on bionicpup64 too.
See http://murga-linux.com/puppy/viewtopic.php?t=113784

Though i'm still not familiar with bionicpup64 my guess is, that ptheme still behaves this way.

To make them all refer to jwm's default rc, on my Slacko 6.3.2 i have edited three files:

1) /etc/xdg/templates/_root_.jwmrc
Changed:

Code: Select all

...
<RootMenu label="3" labeled="false" height="MENHEIGHT" onroot="3"><Include>exec:$HOME/.jwm/root_menus/menu3</Include></RootMenu>
...
<RootMenu label="Menu" labeled="false" height="MENHEIGHT" onroot="9">
...
<Key mask="A" key="F1">root:9</Key>
...
to:

Code: Select all

...
<!-- <RootMenu label="3" labeled="false" height="MENHEIGHT" onroot="3"><Include>exec:$HOME/.jwm/root_menus/menu3</Include></RootMenu> -->
...
<RootMenu label="Menu" labeled="false" height="MENHEIGHT" onroot="3">
...
<Key mask="A" key="F1">root:3</Key>
...
2) /root/.jwm/jwmrc-tray2
Changed:

Code: Select all

...
    <TrayButton label="Menu" icon="puppy.svg">root:9</TrayButton>
...
to:

Code: Select all

...
    <TrayButton label="Menu" icon="puppy.svg">root:3</TrayButton>
...
3) /root/.jwm/jwmrc-personal
Changed:

Code: Select all

...
<Key key="F12">root:9</Key>
...
<Key mask="A" key="F1">root:9</Key>
...
to:

Code: Select all

...
<Key key="F12">root:3</Key>
...
<Key mask="A" key="F1">root:3</Key>
...
As usual run fixmenus;jwm -reload

User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

#5 Post by UncleScrooge »

great recipe HerrBert :D

I'll go cooking :lol:

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#6 Post by mikeslr »

Hi again UncleScrooge,

A couple of the challenges faced by those new to Linux in general and Puppy Linux in particular, is what applications are available for various tasks, and where can they be found when you want to start them. Not everyone thinks alike. Adding another menu category can be helpful overcoming that challenge, especially if the newbie is already familiar with what usually shows up in such category.

Another way of overcoming that challenge is Menu>FileSystem>FindnRun, created --I believe-- by SFR, updated by step and included in Bionicpup64.

But personally, I like AppFinder as its display provides a description of the application's purpose, http://murga-linux.com/puppy/viewtopic. ... 914#982914 So, I've made it available for Bionicpup64. http://murga-linux.com/puppy/viewtopic. ... 00#1058900

Either findnrun or AppFinder can be added to the Taskbar (perhaps next to the Start Menu) by opening Desktop>JWMDeskManager, Clicking the Launch Tab, scrolling to their respective listing and clicking them (Up & Down Arrows to adjust location).

User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

#7 Post by UncleScrooge »

Hi mike,

nice hint as usual.
Installed AppFinder. This wil make frown your whiskers, I guess: my users will love the windows lookalike... :lol: :lol:

User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

#8 Post by UncleScrooge »

The <Include> trick suggested by HerrBert didn't work for me.

All I got was a plain replica of the <Include> line in the /root/.jwmrc and not the new menu defined in /root/.jwm/root_menus/myMenu

I triple checked all the syntaxes and everything was ok, but nothing. All I ended up with was this line inserted in /root/.jwmrc.

Code: Select all

<Include>/root/.jwm/root_menus/myMenu</Include>
What worked was to define the whole new menu shabang directly in /etc/xdg/templates/_root_.jwmrc instead of the <Include>

Also nesting submenus works like a charm.

And the customized menu pops up everywhere, even right clicking the desktop.
all in all a good training, thanx again.

I may post something about some tricks I had to use, as I struggled a bit to have some of the executables started when launching from the menus.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#9 Post by rockedge »

Hello UncleScrooge!!
I may post something about some tricks I had to use, as I struggled a bit to have some of the executables started when launching from the menus.
Yes! please do. I am working on a jwm rox --pinboard set up from scratch and would appreciate learning what you've discovered!

User avatar
UncleScrooge
Posts: 104
Joined: Tue 07 Apr 2020, 06:07
Location: Norway

#10 Post by UncleScrooge »

rockedge wrote:Hello UncleScrooge!!
I may post something about some tricks I had to use, as I struggled a bit to have some of the executables started when launching from the menus.
Yes! please do. I am working on a jwm rox --pinboard set up from scratch and would appreciate learning what you've discovered!
hi rockedge,

it basically all gets down to the use of the environment variables and their avalability in the shells.

Shell scripts
what I experienced is that no matter where I place the setting, for example:

Code: Select all

export PATH=$PATH:/myPath1:/mypath2:/myPath3 # and so on
or any other environment var that I may create in /root/.bashrc / or/and /etc/profile, when I launch a script from the menu my vars are not there.
I have some scripts residing in sub-directories of /root/my-applications which in turn call child processes, and use subfolders such as ./tmp and ./config and blah blah, so this:

Code: Select all

<Program label="Some Script" icon="someIcon">/root/my-applications/myScript/someScript.sh</Program>
will have the script crashing if it starts looking into relative paths or calling children with relative paths. So I had to add a few lines to all the ancestors at the very beginning of the scripts:

Code: Select all

mySelf="${0##*/}"   # must be unique in /root/.../... 
mySelf="$(find /root -name ${mySelf})" 
localPath="$(dirname ${mySelf})" 
cd $localPath 
export PATH=$PATH:$localPath
not elegant (let alone portable) but it does the trick.

Other executables
have the care to ALWAYS include arguments inside single quotation marks:

Code: Select all

<Program label="windows APP" icon="winIcon">wine '/root/.wine/dos_devices/c:/Program Files/mywindowsApp/winApp.exe'</Program>
<Program label="Some Utility" icon="someIcon">/root/my-applications/bin/myUtility 'arg_1 arg_2 ... arg_n'</Program>
all the above might sound trivial to most.
Last comment: unless I want to include my script in the puppy menus standard categories, I gave up creating a myscript.desktop file in the usr/share/applications

Post Reply